-
Notifications
You must be signed in to change notification settings - Fork 5
/
mix.exs
129 lines (115 loc) · 2.88 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
defmodule ModestEx.MixProject do
use Mix.Project
def project do
[
app: :modest_ex,
version: "1.0.4",
elixir: "~> 1.5",
compilers: [:modest_ex_compile] ++ Mix.compilers(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
name: "ModestEx",
description: """
ModestEx - A library to do pipeable transformations on html strings with CSS selectors, e.g. find(), prepend(), append(), replace() etc.
Erlang/Elixir binding to Alexander Borisov's Modest. Binding implemented as a C-Node based on the excellent example of Lukas Rieder's cnodex.
""",
docs: docs(),
deps: deps(),
package: package()
]
end
defp docs do
[
main: "ModestEx"
]
end
def package do
[
maintainers: ["Frank Eickhoff"],
licenses: ["GNU LGPL"],
links: %{
"Github" => "https://github.com/f34nk/modest_ex",
"Issues" => "https://github.com/f34nk/modest_ex/issues",
"nodex" => "https://github.com/Overbryd/nodex",
"modest_html" => "https://github.com/f34nk/modest_html",
"Modest" => "https://github.com/lexborisov/Modest"
},
files: [
"lib",
"target",
"test",
"priv/compile.sh",
"priv/clean.sh",
"priv/test.sh",
"mix.exs",
"README.md",
"LICENSE"
]
]
end
def application do
[
extra_applications: [:logger],
mod: {ModestEx.Safe, []},
# used to detect conflicts with other applications named processes
registered: [ModestEx.Safe.Cnode, ModestEx.Safe.Supervisor],
env: [
mode: ModestEx.Safe
]
]
end
defp deps do
[
# documentation helpers
{:ex_doc, ">= 0.0.0", only: :dev},
# cnode helpers
{:nodex, "~> 0.1.1"}
]
end
end
defmodule Shell do
def exec(exe, args, opts \\ [:stream]) when is_list(args) do
port =
Port.open(
{:spawn_executable, exe},
opts ++ [{:args, args}, :binary, :exit_status, :hide, :use_stdio, :stderr_to_stdout]
)
handle_output(port)
end
def handle_output(port) do
receive do
{^port, {:data, data}} ->
# Replace this with the appropriate broadcast
IO.binwrite(data)
handle_output(port)
{^port, {:exit_status, status}} ->
status
end
end
end
defmodule Mix.Tasks.Compile.ModestExCompile do
def run(_) do
if match?({:win32, _}, :os.type()) do
IO.warn("Windows is not supported yet.")
exit(1)
else
Shell.exec("priv/compile.sh", [])
end
:ok
end
def clean() do
Shell.exec("priv/clean.sh", [])
:ok
end
end
defmodule Mix.Tasks.Test.Target do
def run(_) do
if match?({:win32, _}, :os.type()) do
IO.warn("Windows is not supported yet.")
exit(1)
else
Shell.exec("priv/test.sh", [])
end
:ok
end
end