forked from skeltoac/http_prebind
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
37 lines (32 loc) · 1.09 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
## a set of tasks to make this nicer
def ejabberd_path
begin
File.stat "/usr/local/lib/ejabberd"
"/usr/local/lib/ejabberd"
rescue Errno::ENOENT
"/usr/lib/ejabberd"
end
end
desc "configure the erlang build system to make this friendly enough to work"
task :configure do
# where's ejabberd?
open("Emakefile", "w") do |file|
file.write "{'src/http_prebind', [debug_info, {outdir, 'ebin'}, {i, '#{ejabberd_path}/include'}, {i,'#{ejabberd_path}/include/web'}]}.\n"
end
puts "Crafted an Emakefile to allow you to build this sucker..."
puts "Now, edit src/http_prebind.erl to your taste, remember to replace AUTH_USER, AUTH_PASS and EJABBERD_DOMAIN"
end
desc "build the beam file"
task :build do
begin
puts `mkdir -p ebin` # perhaps the ebin folder doesn't yet exist?
puts `erl -make ` if File.stat(File.getpwd + "Emakefile")
rescue
puts "Emakefile not found, you should run rake configure"
end
end
desc "install the beam to #{ejabberd_path}"
task :install do
puts `sudo cp ebin/http_prebind.beam #{ejabberd_path}/ebin`
puts "installed to #{ejabberd_path}"
end