tasks/build.rake in auser-skelerl-0.0.2 vs tasks/build.rake in auser-skelerl-0.0.3

- old
+ new

@@ -1,15 +1,25 @@ # modified from http://21ccw.blogspot.com/2008/04/using-rake-for-erlang-unit-testing.html require 'rake/clean' require 'pp' +deps_dir = Dir.pwd + "/deps" + INCLUDE = File.dirname(__FILE__) + "/include" -ERLC_FLAGS = "-I#{INCLUDE} +warn_unused_vars +warn_unused_import" -SRC = FileList['src/*.erl'] +DEPS = Dir["#{deps_dir}/*"].select {|d| d if File.directory? d } +DEPS_FILES = DEPS.map {|d| "./deps/#{File.basename(d)}" } +EXTRA_ERLC = DEPS_FILES.map {|a| "-pa #{a}/ebin" }.join(" ") + +ERLC_FLAGS = "-I#{INCLUDE} +warn_unused_vars +warn_unused_import -o ebin -W0 #{EXTRA_ERLC}" + +SRC = FileList["src/*.erl"] SRC_OBJ = SRC.pathmap("%{src,ebin}X.beam") +DEP = DEPS_FILES.map {|d| FileList["#{d}/src/*.erl"]} +DEP_OBJ = DEP.map {|d| d.pathmap("%{src,ebin}X.beam")} + TEST = FileList['test/src/*.erl'] TEST_OBJ = TEST.pathmap("%{src,ebin}X.beam") CLEAN.include("ebin/*.beam", "test/ebin/*.beam") @@ -27,10 +37,17 @@ desc "Compile everything" task :compile => ["src:compile", "test:compile"] task :recompile => ["clean", "src:compile", "test:compile"] +desc "Compile deps" +task :compile_deps do + DEPS_FILES.each do |dir| + Kernel.system "cd #{dir} && rake compile" + end +end + namespace :src do desc "Compile src" task :compile => ['ebin'] + SRC_OBJ end @@ -89,7 +106,27 @@ end desc "Rebuild and repackage" task :repackage => [:build_boot_scripts] do cmd = "erl -pa ./ebin -s packager start -s init stop" + Kernel.system cmd +end + +desc "Shell command" +task :shell do + cmd = "erl -pa ./ebin #{EXTRA_ERLC} -boot start_sasl" + Kernel.system cmd +end + +desc "Update submodules" +task :update do + cmd = "git submodule update" + DEPS_FILES.each do |dir| + Kernel.system "cd #{dir} && #{cmd}" + end +end + +desc "Build eunit" +task :build_eunit do + cmd = "cd test/include/eunit && make" Kernel.system cmd end \ No newline at end of file