-
Notifications
You must be signed in to change notification settings - Fork 13
/
Rakefile
57 lines (45 loc) · 1.65 KB
/
Rakefile
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
require 'rake'
require 'rake/clean'
# Configuration
START_MODULE = "stocks_example"
START_DIRECT_MODULE = "stocks_direct_example"
TEST_MODULE = "test_stocks_example"
MNESIA_DIR = "/tmp"
# No Need to change
PWD = `pwd`.strip
INCLUDE = "include"
ERLC_FLAGS = "-I#{INCLUDE} -I#{PWD}/deps/rabbitmq-erlang-client/deps +warn_unused_vars +warn_unused_import"
ERL_EBIN_PATHS = "-pa #{PWD}/ebin -pa #{PWD}/deps/rabbitmq-erlang-client/ebin -pa #{PWD}/deps/rabbitmq-erlang-client/rabbitmq-server/ebin"
SRC = FileList['src/**/*.erl']
OBJ = SRC.pathmap("%{src,ebin}X.beam")
CLEAN.include(['**/*.dump'])
CLEAN.include(['**/*.beam'])
CLOBBER.include(['**/*.beam'])
# create the ./ebin dir
directory 'ebin'
rule ".beam" => ["%{ebin,src}X.erl"] do |t|
sh "erlc -pa ebin -W #{ERLC_FLAGS} -o ebin #{t.source}"
end
desc "Compile all"
task :compile => ['ebin'] + OBJ
desc "Open up a shell"
task :shell => [:compile] do
sh("erl -sname #{START_MODULE} #{ERL_EBIN_PATHS} -mnesia /tmp -boot start_sasl")
end
desc "Open up a shell and run #{START_MODULE}:start()"
task :run => [:compile] do
sh("erl -sname #{START_MODULE} #{ERL_EBIN_PATHS} -run #{START_MODULE}")
end
desc "Open up a shell, start RabbitMQ, and run #{START_DIRECT_MODULE}:start()"
task :run_direct => [:compile] do
sh("erl -sname #{START_DIRECT_MODULE} #{ERL_EBIN_PATHS} -mnesia /tmp -boot start_sasl -s rabbit -run #{START_DIRECT_MODULE}")
end
#desc "Run Unit Tests"
#task :test do
# sh("erl -noshell -s #{TEST_MODULE} test -s init stop")
#end
desc "Generate Documentation"
task :doc do
sh("cd doc && erl -noshell -run edoc files ../#{SRC.join(" ../")} -run init stop")
end
task :default => :compile