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.

162 lines
5.2KB

  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. xref: [exclude: [:eldap]],
  12. start_permanent: Mix.env() == :prod,
  13. aliases: aliases(),
  14. deps: deps(),
  15. # Docs
  16. name: "Pleroma",
  17. source_url: "https://git.pleroma.social/pleroma/pleroma",
  18. source_url_pattern:
  19. "https://git.pleroma.social/pleroma/pleroma/blob/develop/%{path}#L%{line}",
  20. homepage_url: "https://pleroma.social/",
  21. docs: [
  22. logo: "priv/static/static/logo.png",
  23. extras: ["README.md" | Path.wildcard("docs/**/*.md")],
  24. groups_for_extras: [
  25. "Installation manuals": Path.wildcard("docs/installation/*.md"),
  26. Configuration: Path.wildcard("docs/config/*.md"),
  27. Administration: Path.wildcard("docs/admin/*.md"),
  28. "Pleroma's APIs and Mastodon API extensions": Path.wildcard("docs/api/*.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, "~> 4.0"},
  57. {:ecto_sql, "~>3.0.5"},
  58. {:postgrex, ">= 0.13.5"},
  59. {:gettext, "~> 0.15"},
  60. {:comeonin, "~> 4.1.1"},
  61. {:pbkdf2_elixir, "~> 0.12.3"},
  62. {:trailing_format_plug, "~> 0.0.7"},
  63. {:html_sanitize_ex, "~> 1.3.0"},
  64. {:html_entities, "~> 0.4"},
  65. {:phoenix_html, "~> 2.10"},
  66. {:calendar, "~> 0.17.4"},
  67. {:cachex, "~> 3.0.2"},
  68. {:httpoison, "~> 1.2.0"},
  69. {:tesla, "~> 1.2"},
  70. {:jason, "~> 1.0"},
  71. {:mogrify, "~> 0.6.1"},
  72. {:ex_aws, "~> 2.0"},
  73. {:ex_aws_s3, "~> 2.0"},
  74. {:earmark, "~> 1.3"},
  75. {:ex_machina, "~> 2.3", only: :test},
  76. {:credo, "~> 0.9.3", only: [:dev, :test]},
  77. {:mock, "~> 0.3.1", only: :test},
  78. {:crypt,
  79. git: "https://github.com/msantos/crypt", ref: "1f2b58927ab57e72910191a7ebaeff984382a1d3"},
  80. {:cors_plug, "~> 1.5"},
  81. {:ex_doc, "~> 0.19", only: :dev, runtime: false},
  82. {:web_push_encryption, "~> 0.2.1"},
  83. {:swoosh, "~> 0.20"},
  84. {:gen_smtp, "~> 0.13"},
  85. {:websocket_client, git: "https://github.com/jeremyong/websocket_client.git", only: :test},
  86. {:floki, "~> 0.20.0"},
  87. {:ex_syslogger, github: "slashmili/ex_syslogger", tag: "1.4.0"},
  88. {:timex, "~> 3.5"},
  89. {:auto_linker,
  90. git: "https://git.pleroma.social/pleroma/auto_linker.git",
  91. ref: "94193ca5f97c1f9fdf3d1469653e2d46fac34bcd"},
  92. {:pleroma_job_queue, "~> 0.2.0"}
  93. ]
  94. end
  95. # Aliases are shortcuts or tasks specific to the current project.
  96. # For example, to create, migrate and run the seeds file at once:
  97. #
  98. # $ mix ecto.setup
  99. #
  100. # See the documentation for `Mix` for more info on aliases.
  101. defp aliases do
  102. [
  103. "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
  104. "ecto.reset": ["ecto.drop", "ecto.setup"],
  105. test: ["ecto.create --quiet", "ecto.migrate", "test"]
  106. ]
  107. end
  108. # Builds a version string made of:
  109. # * the application version
  110. # * a pre-release if ahead of the tag: the describe string (-count-commithash)
  111. # * build info:
  112. # * a build name if `PLEROMA_BUILD_NAME` or `:pleroma, :build_name` is defined
  113. # * the mix environment if different than prod
  114. defp version(version) do
  115. {git_tag, git_pre_release} =
  116. with {tag, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=0"]),
  117. tag = String.trim(tag),
  118. {describe, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=8"]),
  119. describe = String.trim(describe),
  120. ahead <- String.replace(describe, tag, "") do
  121. {String.replace_prefix(tag, "v", ""), if(ahead != "", do: String.trim(ahead))}
  122. else
  123. _ -> {nil, nil}
  124. end
  125. if git_tag && version != git_tag do
  126. Mix.shell().error(
  127. "Application version #{inspect(version)} does not match git tag #{inspect(git_tag)}"
  128. )
  129. end
  130. build_name =
  131. cond do
  132. name = Application.get_env(:pleroma, :build_name) -> name
  133. name = System.get_env("PLEROMA_BUILD_NAME") -> name
  134. true -> nil
  135. end
  136. env_name = if Mix.env() != :prod, do: to_string(Mix.env())
  137. build =
  138. [build_name, env_name]
  139. |> Enum.filter(fn string -> string && string != "" end)
  140. |> Enum.join("-")
  141. |> (fn
  142. "" -> nil
  143. string -> "+" <> string
  144. end).()
  145. [version, git_pre_release, build]
  146. |> Enum.filter(fn string -> string && string != "" end)
  147. |> Enum.join()
  148. end
  149. end