-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
94 lines (79 loc) · 2.43 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
87
88
89
90
91
92
93
94
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
namespace :gem do
require 'hoe'
$: << './lib'
$: << './ext'
require 'shooting_star/version'
hoe = Hoe.new('shooting_star', ShootingStar::VERSION) do |hoe|
hoe.author = 'Genki Takiuchi'
hoe.email = '[email protected]'
hoe.description = 'A comet server.'
hoe.rubyforge_name = 'shooting-star'
hoe.summary = hoe.paragraphs_of('README.txt', 2)[0]
hoe.description = hoe.paragraphs_of('README.txt', 2..5).join("\n\n")
hoe.url = hoe.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
hoe.changes = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
hoe.extra_deps = [['json']]
hoe.spec_extras = {
:extensions => 'ext/extconf.rb',
:rdoc_options => ['-S',
'--template', 'kilmer',
'--main', 'README.txt',
'--exclude', 'ext/asteroid',
'README.txt']
}
end
desc 'generate gem spec'
task :gemspec do
open('shooting-star.gemspec', 'w').write hoe.spec.to_ruby
end
end
desc 'default gem task.'
task :gem => 'gem:default'
desc 'update generator template files.'
task 'update_generator_template_files' => :swf do
templates = 'vendor/plugins/meteor_strike/generators/meteor/templates'
cp 'app/controllers/meteor_controller.rb',
templates + '/controller.rb'
cp 'app/models/meteor.rb',
templates + '/model.rb'
cp 'app/helpers/meteor_helper.rb',
templates + '/helper.rb'
cp 'app/views/meteor/strike.rhtml',
templates + '/view.rhtml'
cp 'test/unit/meteor_test.rb',
templates + '/unit_test.rb'
cp 'test/functional/meteor_controller_test.rb',
templates + '/functional_test.rb'
cp 'public/meteor_strike.swf',
templates + '/meteor_strike.swf'
end
desc 'test all tests'
task 'test:all' => [:test, 'test:plugins', 'test:exts', 'test:libs']
desc 'default task'
task :default => 'test:all'
desc 'make swf file'
task :swf => 'public/meteor_strike.swf'
file 'public/meteor_strike.swf' => 'as/meteor_strike.as' do
sh ['mtasc -version 8 -header 300:300:30',
'-swf public/meteor_strike.swf',
'-main as/meteor_strike.as'].join(' ')
end
desc 'making ext'
task :ext => 'ext/asteroid.so'
file 'ext/asteroid.so' => 'ext/Makefile' do
cwd = `pwd`
cd 'ext/'
sh 'make'
cd cwd.chomp
end
file 'ext/Makefile' => 'ext/extconf.rb' do
cwd = `pwd`
cd 'ext/'
sh 'ruby extconf.rb'
cd cwd.chomp
end