forked from larsch/ocra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
86 lines (66 loc) · 2.07 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- ruby -*-
require "rubygems"
require "hoe"
Hoe.plugin :minitest
spec = Hoe.spec "ocra" do
developer "Lars Christensen", "[email protected]"
license "MIT"
end
spec.urls.each { |key, url| url.chomp! }
task :build_stub do
sh "mingw32-make -C src"
cp "src/stub.exe", "share/ocra/stub.exe"
cp "src/stubw.exe", "share/ocra/stubw.exe"
cp "src/edicon.exe", "share/ocra/edicon.exe"
end
file "share/ocra/stub.exe" => :build_stub
file "share/ocra/stubw.exe" => :build_stub
file "share/ocra/edicon.exe" => :build_stub
task :test => :build_stub
task :standalone => ["bin/ocrasa.rb"]
standalone_zip = "bin/ocrasa-#{ENV["VERSION"]}.zip"
file standalone_zip => "bin/ocrasa.rb" do
chdir "bin" do
sh "zip", "ocrasa-#{ENV["VERSION"]}.zip", "ocrasa.rb"
end
end
task :release_standalone => standalone_zip do
load "bin/ocra"
sh "rubyforge add_release ocra ocra-standalone #{Ocra::VERSION} #{standalone_zip}"
end
file "bin/ocrasa.rb" => ["bin/ocra", "share/ocra/stub.exe", "share/ocra/stubw.exe", "share/ocra/lzma.exe", "share/ocra/edicon.exe"] do
cp "bin/ocra", "bin/ocrasa.rb"
File.open("bin/ocrasa.rb", "a") do |f|
f.puts "__END__"
stub = File.open("share/ocra/stub.exe", "rb") { |g| g.read }
stub64 = [stub].pack("m")
f.puts stub64.size
f.puts stub64
stub = File.open("share/ocra/stubw.exe", "rb") { |g| g.read }
stub64 = [stub].pack("m")
f.puts stub64.size
f.puts stub64
lzma = File.open("share/ocra/lzma.exe", "rb") { |g| g.read }
lzma64 = [lzma].pack("m")
f.puts lzma64.size
f.puts lzma64
lzma = File.open("share/ocra/edicon.exe", "rb") { |g| g.read }
lzma64 = [lzma].pack("m")
f.puts lzma64.size
f.puts lzma64
end
end
task :clean do
rm_f Dir["{bin,samples}/*.exe"]
rm_f Dir["share/ocra/{stub,stubw,edicon}.exe"]
sh "mingw32-make -C src clean"
end
task :test_standalone => :standalone do
ENV["TESTED_OCRA"] = "ocrasa.rb"
system("rake test")
ENV["TESTED_OCRA"] = nil
end
task :release_docs => :redocs do
sh "pscp -r doc/* [email protected]:/var/www/gforge-projects/ocra"
end
# vim: syntax=Ruby