Skip to content

Instantly share code, notes, and snippets.

@leandrosilva
Created December 27, 2009 05:59
Show Gist options
  • Select an option

  • Save leandrosilva/264171 to your computer and use it in GitHub Desktop.

Select an option

Save leandrosilva/264171 to your computer and use it in GitHub Desktop.
Thorfile for my Ebuild
require 'thor'
class Ebuild < Thor
desc 'all', 'clean, compile and generate edoc for all modules'
def all
clean
compile
doc
end
desc 'clean', 'clean ebin directory'
def clean
`rm -rf ebin/*`
end
desc 'compile', 'compile all source code'
def compile
clean
`erlc -o ebin/ -I include/ src/*.erl test/*.erl`
`cp src/*.app ebin/`
end
desc 'doc', 'generate edoc for all modules'
def doc
Dir.glob(File.expand_path('src/*.erl')).each do |filename|
`erl -noshell -run edoc file src/#{File.basename(filename)} -run init stop`
end
`mv src/*.html doc/`
Dir.glob(File.expand_path('test/*.erl')).each do |filename|
`erl -noshell -run edoc file test/#{File.basename(filename)} -run init stop`
end
`mv test/*.html doc/`
end
desc 'test', 'run a EUnit tests'
def test(name)
puts `erl -pa ebin/ -noshell -run #{name} test -run init stop`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment