-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
executable file
·68 lines (56 loc) · 1.61 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
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env rake
# Rakefile
# @Author: Brian Finney ([email protected])
# @Website:
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
# @Created: 2009-01-01
# @Original: http://medevyoujane.com/blog/2008/8/21/erlang-make-rake-and-emake.html
# @Revision: 0.1
#
# = Description
# = Usage
# = TODO
# = CHANGES
require 'rake'
require 'rake/clean'
# Rakefile:
# Configuration
START_MODULE = "CHANGE ME"
TEST_MODULE = "eunit"
TEST_FLAG = "EUNIT"
MNESIA_DIR = "/tmp"
# No Need to change
PWD = Dir.getwd()
INCLUDE = "include"
ERLC_FLAGS = "-I#{INCLUDE} +warn_unused_vars +warn_unused_import"
SRC = FileList['src/**/*.erl']
OBJ = SRC.pathmap("%{src,ebin}X.beam")
MODS = OBJ.map() do |obj|
obj[/^(.*\/)?(.+?).beam$/,2]
end
CLEAN.include(['**/*.dump'])
CLOBBER.include(['**/*.beam'])
directory 'ebin'
rule ".beam" => ["%{ebin,src}X.erl"] do |t|
sh "erlc -D #{TEST_FLAG} -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} -pa #{PWD}/ebin")
end
desc "Open up a shell and run #{START_MODULE}:start()"
task :run => [:compile] do
sh("erl -sname #{START_MODULE} -pa #{PWD}/ebin -run #{START_MODULE} start")
end
desc "Run Unit Tests"
task :test => [:compile] do
puts "Testing Modules with #{TEST_MODULE}: #{MODS.join(', ')}\n"
sh("erl -noshell -s #{TEST_MODULE} test #{MODS.join(' ')} -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