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.

143 lines
4.5KB

  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: ["README.md", "docs/config.md", "docs/Pleroma-API.md"],
  23. main: "readme",
  24. output: "priv/static/doc"
  25. ]
  26. ]
  27. end
  28. # Configuration for the OTP application.
  29. #
  30. # Type `mix help compile.app` for more information.
  31. def application do
  32. [mod: {Pleroma.Application, []}, extra_applications: [:logger, :runtime_tools, :comeonin]]
  33. end
  34. # Specifies which paths to compile per environment.
  35. defp elixirc_paths(:test), do: ["lib", "test/support"]
  36. defp elixirc_paths(_), do: ["lib"]
  37. # Specifies your project dependencies.
  38. #
  39. # Type `mix help deps` for examples and options.
  40. defp deps do
  41. [
  42. # Until Phoenix 1.4.1 is released
  43. {:phoenix, github: "phoenixframework/phoenix", branch: "v1.4"},
  44. {:plug_cowboy, "~> 1.0"},
  45. {:phoenix_pubsub, "~> 1.1"},
  46. {:phoenix_ecto, "~> 3.3"},
  47. {:postgrex, ">= 0.13.5"},
  48. {:gettext, "~> 0.15"},
  49. {:comeonin, "~> 4.1.1"},
  50. {:pbkdf2_elixir, "~> 0.12.3"},
  51. {:trailing_format_plug, "~> 0.0.7"},
  52. {:html_sanitize_ex, "~> 1.3.0"},
  53. {:phoenix_html, "~> 2.10"},
  54. {:calendar, "~> 0.17.4"},
  55. {:cachex, "~> 3.0.2"},
  56. {:httpoison, "~> 1.2.0"},
  57. {:tesla, "~> 1.2"},
  58. {:jason, "~> 1.0"},
  59. {:mogrify, "~> 0.6.1"},
  60. {:ex_aws, "~> 2.0"},
  61. {:ex_aws_s3, "~> 2.0"},
  62. {:earmark, "~> 1.3"},
  63. {:ex_machina, "~> 2.2", only: :test},
  64. {:credo, "~> 0.9.3", only: [:dev, :test]},
  65. {:mock, "~> 0.3.1", only: :test},
  66. {:crypt,
  67. git: "https://github.com/msantos/crypt", ref: "1f2b58927ab57e72910191a7ebaeff984382a1d3"},
  68. {:cors_plug, "~> 1.5"},
  69. {:ex_doc, "~> 0.19", only: :dev, runtime: false},
  70. {:web_push_encryption, "~> 0.2.1"},
  71. {:swoosh, "~> 0.20"},
  72. {:gen_smtp, "~> 0.13"},
  73. {:websocket_client, git: "https://github.com/jeremyong/websocket_client.git", only: :test}
  74. ]
  75. end
  76. # Aliases are shortcuts or tasks specific to the current project.
  77. # For example, to create, migrate and run the seeds file at once:
  78. #
  79. # $ mix ecto.setup
  80. #
  81. # See the documentation for `Mix` for more info on aliases.
  82. defp aliases do
  83. [
  84. "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
  85. "ecto.reset": ["ecto.drop", "ecto.setup"],
  86. test: ["ecto.create --quiet", "ecto.migrate", "test"]
  87. ]
  88. end
  89. # Builds a version string made of:
  90. # * the application version
  91. # * a pre-release if ahead of the tag: the describe string (-count-commithash)
  92. # * build info:
  93. # * a build name if `PLEROMA_BUILD_NAME` or `:pleroma, :build_name` is defined
  94. # * the mix environment if different than prod
  95. defp version(version) do
  96. {git_tag, git_pre_release} =
  97. with {tag, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=0"]),
  98. tag = String.trim(tag),
  99. {describe, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=8"]),
  100. describe = String.trim(describe),
  101. ahead <- String.replace(describe, tag, "") do
  102. {String.replace_prefix(tag, "v", ""), if(ahead != "", do: String.trim(ahead))}
  103. else
  104. _ -> {nil, nil}
  105. end
  106. if git_tag && version != git_tag do
  107. Mix.shell().error(
  108. "Application version #{inspect(version)} does not match git tag #{inspect(git_tag)}"
  109. )
  110. end
  111. build_name =
  112. cond do
  113. name = Application.get_env(:pleroma, :build_name) -> name
  114. name = System.get_env("PLEROMA_BUILD_NAME") -> name
  115. true -> nil
  116. end
  117. env_name = if Mix.env() != :prod, do: to_string(Mix.env())
  118. build =
  119. [build_name, env_name]
  120. |> Enum.filter(fn string -> string && string != "" end)
  121. |> Enum.join("-")
  122. |> (fn
  123. "" -> nil
  124. string -> "+" <> string
  125. end).()
  126. [version, git_pre_release, build]
  127. |> Enum.filter(fn string -> string && string != "" end)
  128. |> Enum.join()
  129. end
  130. end