Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
5.0KB

  1. defmodule Pleroma.Mixfile do
  2. use Mix.Project
  3. def project do
  4. [
  5. app: :pleroma,
  6. version: version("0.9.0"),
  7. elixir: "~> 1.7",
  8. elixirc_paths: elixirc_paths(Mix.env()),
  9. compilers: [:phoenix, :gettext] ++ Mix.compilers(),
  10. elixirc_options: [warnings_as_errors: true],
  11. start_permanent: Mix.env() == :prod,
  12. aliases: aliases(),
  13. deps: deps(),
  14. # Docs
  15. name: "Pleroma",
  16. source_url: "https://git.pleroma.social/pleroma/pleroma",
  17. source_url_pattern:
  18. "https://git.pleroma.social/pleroma/pleroma/blob/develop/%{path}#L%{line}",
  19. homepage_url: "https://pleroma.social/",
  20. docs: [
  21. logo: "priv/static/static/logo.png",
  22. extras: [
  23. "README.md",
  24. "docs/config.md",
  25. "docs/Pleroma-API.md",
  26. "docs/Admin-API.md",
  27. "docs/Clients.md",
  28. "docs/Differences-in-MastodonAPI-Responses.md"
  29. ],
  30. main: "readme",
  31. output: "priv/static/doc"
  32. ]
  33. ]
  34. end
  35. # Configuration for the OTP application.
  36. #
  37. # Type `mix help compile.app` for more information.
  38. def application do
  39. [
  40. mod: {Pleroma.Application, []},
  41. extra_applications: [:logger, :runtime_tools, :comeonin],
  42. included_applications: [:ex_syslogger]
  43. ]
  44. end
  45. # Specifies which paths to compile per environment.
  46. defp elixirc_paths(:test), do: ["lib", "test/support"]
  47. defp elixirc_paths(_), do: ["lib"]
  48. # Specifies your project dependencies.
  49. #
  50. # Type `mix help deps` for examples and options.
  51. defp deps do
  52. [
  53. {:phoenix, "~> 1.4.1"},
  54. {:plug_cowboy, "~> 2.0"},
  55. {:phoenix_pubsub, "~> 1.1"},
  56. {:phoenix_ecto, "~> 3.3"},
  57. {:postgrex, ">= 0.13.5"},
  58. {:gettext, "~> 0.15"},
  59. {:comeonin, "~> 4.1.1"},
  60. {:pbkdf2_elixir, "~> 0.12.3"},
  61. {:trailing_format_plug, "~> 0.0.7"},
  62. {:html_sanitize_ex, "~> 1.3.0"},
  63. {:html_entities, "~> 0.4"},
  64. {:phoenix_html, "~> 2.10"},
  65. {:calendar, "~> 0.17.4"},
  66. {:cachex, "~> 3.0.2"},
  67. {:httpoison, "~> 1.2.0"},
  68. {:tesla, "~> 1.2"},
  69. {:jason, "~> 1.0"},
  70. {:mogrify, "~> 0.6.1"},
  71. {:ex_aws, "~> 2.0"},
  72. {:ex_aws_s3, "~> 2.0"},
  73. {:earmark, "~> 1.3"},
  74. {:ex_machina, "~> 2.2", only: :test},
  75. {:credo, "~> 0.9.3", only: [:dev, :test]},
  76. {:mock, "~> 0.3.1", only: :test},
  77. {:crypt,
  78. git: "https://github.com/msantos/crypt", ref: "1f2b58927ab57e72910191a7ebaeff984382a1d3"},
  79. {:cors_plug, "~> 1.5"},
  80. {:ex_doc, "~> 0.19", only: :dev, runtime: false},
  81. {:web_push_encryption, "~> 0.2.1"},
  82. {:swoosh, "~> 0.20"},
  83. {:gen_smtp, "~> 0.13"},
  84. {:websocket_client, git: "https://github.com/jeremyong/websocket_client.git", only: :test},
  85. {:floki, "~> 0.20.0"},
  86. {:ex_syslogger, github: "slashmili/ex_syslogger", tag: "1.4.0"},
  87. {:timex, "~> 3.5"},
  88. {:auto_linker,
  89. git: "https://git.pleroma.social/pleroma/auto_linker.git",
  90. ref: "94193ca5f97c1f9fdf3d1469653e2d46fac34bcd"}
  91. ]
  92. end
  93. # Aliases are shortcuts or tasks specific to the current project.
  94. # For example, to create, migrate and run the seeds file at once:
  95. #
  96. # $ mix ecto.setup
  97. #
  98. # See the documentation for `Mix` for more info on aliases.
  99. defp aliases do
  100. [
  101. "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
  102. "ecto.reset": ["ecto.drop", "ecto.setup"],
  103. test: ["ecto.create --quiet", "ecto.migrate", "test"]
  104. ]
  105. end
  106. # Builds a version string made of:
  107. # * the application version
  108. # * a pre-release if ahead of the tag: the describe string (-count-commithash)
  109. # * build info:
  110. # * a build name if `PLEROMA_BUILD_NAME` or `:pleroma, :build_name` is defined
  111. # * the mix environment if different than prod
  112. defp version(version) do
  113. {git_tag, git_pre_release} =
  114. with {tag, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=0"]),
  115. tag = String.trim(tag),
  116. {describe, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=8"]),
  117. describe = String.trim(describe),
  118. ahead <- String.replace(describe, tag, "") do
  119. {String.replace_prefix(tag, "v", ""), if(ahead != "", do: String.trim(ahead))}
  120. else
  121. _ -> {nil, nil}
  122. end
  123. if git_tag && version != git_tag do
  124. Mix.shell().error(
  125. "Application version #{inspect(version)} does not match git tag #{inspect(git_tag)}"
  126. )
  127. end
  128. build_name =
  129. cond do
  130. name = Application.get_env(:pleroma, :build_name) -> name
  131. name = System.get_env("PLEROMA_BUILD_NAME") -> name
  132. true -> nil
  133. end
  134. env_name = if Mix.env() != :prod, do: to_string(Mix.env())
  135. build =
  136. [build_name, env_name]
  137. |> Enum.filter(fn string -> string && string != "" end)
  138. |> Enum.join("-")
  139. |> (fn
  140. "" -> nil
  141. string -> "+" <> string
  142. end).()
  143. [version, git_pre_release, build]
  144. |> Enum.filter(fn string -> string && string != "" end)
  145. |> Enum.join()
  146. end
  147. end