forked from cstar/erldis
/
Rakefile
44 lines (39 loc) · 1.24 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
task :default => :build
if File.file?('erlang_config.rb')
require 'erlang_config'
else
puts "erlang_config.rb file is missing."
puts "You need to fill it with your local configuration."
puts "An sample has been generated for you."
File.open("erlang_config.rb",'w') do |file|
file.write("ERL_TOP=\"<path to your erlang installation>\"\n")
file.write("EMAKE_COMPILE_OPTIONS = []\n")
end
exit(-1)
end
task :build do
sh "#{ERL_TOP}/bin/erl -make"
end
desc "installs in $ERL_TOP/lib/"
task :install => [:build] do |t|
FileList.new('ebin/*.app').each do |dir|
#vsn = extract_version_information("vsn.config","vsn").gsub("\"","")
name = dir.gsub("ebin/","").gsub(".app","")
destination = "#{erlang_home}/lib/#{name}"
puts "#{name} will be installed in #{destination}"
sh "mkdir -p #{destination}"
%w{ebin doc include }.each do |d|
sh "cp -R #{d} #{destination}"
end
end
end
def erlang_home
@erlang_home||=IO.popen("#{ERL_TOP}/bin/erl -noinput -noshell -eval 'io:format(code:root_dir()).' -s init stop").readlines[0]
end
def extract_version_information(file, type)
informations = []
IO.foreach(file) { |line|
informations << $1 if line =~ /\{#{type},(.*)\}/
}
informations[0]
end