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.

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