add -o option (num nodes) to fuzed local
[fuzed.git] / Rakefile
blob729eed4bd386002166adf8cdcd7a7e9461004f26
1 require 'rubygems'
2 require 'hoe'
4 if %w{check_manifest clean package}.include?(ARGV[0])
5   Hoe.new('fuzed', "0.2.0") do |p|
6    p.rubyforge_name = 'fuzed'
7    p.author = ['Dave Fayram', 'Tom Preston-Werner']
8    p.email = ['tom@rubyisawesome.com']
9    p.summary = 'Leverage the YAWS webserver (and additional erlang-based infrastructure) to run Rails.'
10    p.url = 'fuzed.rubyforge.org'
11    # p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
12    # p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
13    p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
14    p.extra_deps << ['erlectricity', '>= 0.2.0']
15   end
16 end
18 ERLC_TEST_FLAGS = "-pa ebin/eunit -I include/eunit -DTEST"
19 ERLC_FLAGS = "+debug_info -W2 -I include -I include/yaws -o ebin"
20 ERLR_FLAGS = "+Bc +K true -smp enable -pz /usr/local/lib/yaws/ebin -pz ./etest -pz ./ebin/ -pz ./ebin/eunit"
22 task :default do
23   sh "erlc  #{ERLC_FLAGS} #{ERLC_TEST_FLAGS} elibs/*.erl"
24 end
26 task :build do
27   sh "erlc  #{ERLC_FLAGS} elibs/*.erl"
28 end
30 task :install do
31   sh "rake clean"
32   sh "rake package"
33   sh "sudo gem install pkg/fuzed*.gem"
34 end
36 task :econsole do
37   sh "erl #{ERLR_FLAGS} -sname fuzed_console_#{$$}"
38 end
40 desc 'Generate manifest from git files'
41 task :manifest do
42   sh 'git ls-tree --name-only -r HEAD > Manifest.txt'
43 end
45 task :test => [:default] do
46   mods = []
47   mod_directives = ""
48   env_peek = ENV['MOD'] || ENV['MODS'] || ENV['MODULE'] || ENV['MODULES']
49   if env_peek
50     mods = env_peek.split(",")
51   else 
52     mods = Dir["etest/*_test.erl"].map { |x| x.match(/etest\/(.*)_test.erl/)[1] }
53   end
54   mod_directives = mods.map {|m| "-run #{m} test"}.join(" ")
55   # -run #{ENV['MOD']} test
56   sh %Q{erl +K true -smp enable -pz ./etest -pz ./ebin/yaws -pz ./ebin/ -pa ./ebin/eunit -sname local_console_#{$$} -noshell #{mod_directives} -run erlang halt}
57 end
59 desc "Upload site to Rubyforge"
60 task :site do
61   sh "scp -r site/* mojombo@god.rubyforge.org:/var/www/gforge-projects/fuzed"
62 end
64 task :fuzed do
65   # sh "erl -boot start_sasl +Bc +K true -smp enable -pz ./etest -pz ./ebin -pz ./ebin/eunit -name 'master@volcano.local' -run fuzed start"
66   sh %Q{yaws --conf fuzed.conf --pa './ebin' --name "master@volano.local" --runmod fuzed --erlarg '+Bc +K true -smp enabled'}
67 end