mix.exs (2623B)
1 defmodule EarmarkParser.MixProject do 2 use Mix.Project 3 4 @version "1.4.29" 5 @url "https://github.com/RobertDober/earmark_parser" 6 7 @deps [ 8 {:earmark_ast_dsl, "~> 0.3.7", only: [:test]}, 9 {:excoveralls, "~> 0.14.4", only: [:test]}, 10 {:extractly, "~> 0.5.3", only: [:dev]}, 11 {:floki, "~> 0.32", only: [:dev, :test]} 12 ] 13 14 @description """ 15 Earmark AST the parser and AST Generator for 16 Dave Thomas' Earmark. 17 18 The parser generates 19 an Abstract Syntax Tree from Markdown. 20 21 The original Earmark will still provide the HTML Transformation and 22 the CLI, however its Scanner, Parser and AST Renderer have been 23 extracted into this library. 24 """ 25 26 ############################################################ 27 28 def project do 29 [ 30 app: :earmark_parser, 31 version: @version, 32 elixir: "~> 1.11", 33 elixirc_paths: elixirc_paths(Mix.env()), 34 deps: @deps, 35 description: @description, 36 package: package(), 37 preferred_cli_env: [ 38 coveralls: :test, 39 "coveralls.detail": :test, 40 "coveralls.post": :test, 41 "coveralls.html": :test 42 ], 43 test_coverage: [tool: ExCoveralls], 44 aliases: [docs: &build_docs/1] 45 ] 46 end 47 48 defp package do 49 [ 50 files: [ 51 "lib", 52 "src/*.xrl", 53 "src/*.yrl", 54 "mix.exs", 55 "README.md", 56 "RELEASE.md", 57 "LICENSE" 58 ], 59 maintainers: [ 60 "Robert Dober <robert.dober@gmail.com>" 61 ], 62 licenses: [ 63 "Apache-2.0" 64 ], 65 links: %{ 66 "Changelog" => "#{@url}/blob/master/RELEASE.md", 67 "GitHub" => @url 68 } 69 ] 70 end 71 72 defp elixirc_paths(:test), do: ["lib", "test/support", "dev"] 73 defp elixirc_paths(:dev), do: ["lib", "bench", "dev"] 74 defp elixirc_paths(_), do: ["lib"] 75 76 @prerequisites """ 77 run `mix escript.install hex ex_doc` and adjust `PATH` accordingly 78 """ 79 @module "EarmarkParser" 80 defp build_docs(_) do 81 Mix.Task.run("compile") 82 ex_doc = Path.join(Mix.path_for(:escripts), "ex_doc") 83 Mix.shell().info("Using escript: #{ex_doc} to build the docs") 84 85 unless File.exists?(ex_doc) do 86 raise "cannot build docs because escript for ex_doc is not installed, make sure to \n#{ 87 @prerequisites 88 }" 89 end 90 91 args = [@module, @version, Mix.Project.compile_path()] 92 opts = ~w[--main #{@module} --source-ref v#{@version} --source-url #{@url}] 93 94 Mix.shell().info("Running: #{ex_doc} #{inspect(args ++ opts)}") 95 System.cmd(ex_doc, args ++ opts) 96 Mix.shell().info("Docs built successfully") 97 end 98 99 end 100 101 # SPDX-License-Identifier: Apache-2.0