-
Notifications
You must be signed in to change notification settings - Fork 116
/
Rakefile
247 lines (208 loc) · 6.33 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
## THESE ARE CRUCIAL
require File.join(File.dirname(__FILE__), "merb-core/lib/merb-core/version.rb")
require "rake/clean"
require "rake/gempackagetask"
require File.join(File.dirname(__FILE__), 'merb-core/lib/merb-core/tasks/merb_rake_helper')
require 'fileutils'
include FileUtils
merb_more_gem_paths = %w[
merb-action-args
merb-assets
merb-slices
merb-auth
merb-cache
merb-exceptions
merb-gen
merb-haml
merb-helpers
merb-mailer
merb-param-protection
]
merb_release = {
"merb-auth" =>
[
"merb-auth",
"merb-auth-core",
"merb-auth-more",
"merb-auth-slice-password"
],
"merb" =>
[
"merb-action-args",
"merb-assets",
"merb-slices",
"merb-cache",
"merb-core",
"merb-exceptions",
"merb-gen",
"merb-haml",
"merb-helpers",
"merb-mailer",
"merb-param-protection",
"merb_datamapper",
"merb",
"merb-more"
]
}
merb_gem_paths = %w[merb-core merb_datamapper] + merb_more_gem_paths + %w[merb]
merb_gems = merb_gem_paths.map { |p| File.basename(p) }
merb_more_gems = merb_more_gem_paths.map { |p| File.basename(p) }
merb_more_spec = Gem::Specification.new do |s|
s.rubyforge_project = 'merb-more'
s.name = "merb-more"
s.version = Merb::VERSION
s.platform = Gem::Platform::RUBY
s.author = "Engine Yard"
s.email = "[email protected]"
s.homepage = "http://www.merbivore.com"
s.summary = "(merb - merb-core) == merb-more. The Full Stack. Take what you need; leave what you don't."
s.description = s.summary
s.files = %w( LICENSE README Rakefile TODO lib/merb-more.rb )
s.required_rubygems_version = ">= 1.3.0"
s.add_dependency "merb-core", ">= #{Merb::VERSION}"
merb_more_gems.each do |gem|
s.add_dependency gem, "= #{Merb::VERSION}"
end
end
CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache", "lib/merb-more.rb", "gems/*"]
Rake::GemPackageTask.new(merb_more_spec) do |package|
package.gem_spec = merb_more_spec
end
namespace :install do
desc "Install core gem"
task :core => :clean do
Merb::RakeHelper.install('merb-core', :version => Merb::VERSION)
end
desc "Install all merb-more gems"
task :more => :clean do
merb_more_gems.each do |gem|
Merb::RakeHelper.install(gem, :version => Merb::VERSION)
end
Merb::RakeHelper.install("merb", :version => Merb::VERSION)
end
end
namespace :uninstall do
desc "Uninstall core gem"
task :core do
Merb::RakeHelper.uninstall('merb-core', :version => Merb::VERSION)
end
desc "Uninstall all merb-more gems"
task :more do
merb_more_gems.each do |gem|
Merb::RakeHelper.uninstall(gem, :version => Merb::VERSION)
end
end
end
desc "Install all gems"
task :install do
merb_gems.each do |gem|
Merb::RakeHelper.install(gem, :version => Merb::VERSION)
end
end
desc "Uninstall all gems"
task :uninstall do
merb_gems.each do |gem|
Merb::RakeHelper.uninstall(gem, :version => Merb::VERSION)
end
Merb::RakeHelper.uninstall('merb-auth-slice-password', :version => Merb::VERSION)
Merb::RakeHelper.uninstall('merb-auth-more', :version => Merb::VERSION)
Merb::RakeHelper.uninstall('merb-auth-core', :version => Merb::VERSION)
end
desc "Build the merb-more gems"
task :build_gems do
merb_gem_paths.each do |dir|
Dir.chdir(dir) { sh "#{Gem.ruby} -S rake package" }
end
end
desc "Clobber the merb-more sub-gems"
task :clobber_gems do
merb_gem_paths.each do |dir|
Dir.chdir(dir) { sh "#{Gem.ruby} -S rake clobber" }
end
end
task :package => ["lib/merb-more.rb", :build_gems]
desc "Create merb-more.rb"
task "lib/merb-more.rb" do
mkdir_p "lib"
File.open("lib/merb-more.rb","w+") do |file|
file.puts "### AUTOMATICALLY GENERATED. DO NOT EDIT!"
merb_more_gems.each do |gem|
next if gem == "merb-gen"
file.puts "require \"#{gem}\""
end
end
end
task :package do
mkdir_p "gems"
Dir["**/pkg/*.gem"].each do |file|
FileUtils.cp(file, "gems")
end
end
# This task is only for releasing edge gems on edge.merbivore.com
task :release_edge => :package do
FileUtils.cp(Dir["gems/*.gem"], "../gems")
Dir.chdir("..") do
`gem generate_index`
end
end
RUBY_FORGE_PROJECT = "merb"
GROUP_NAME = "merb"
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
PKG_VERSION = Merb::VERSION + PKG_BUILD
RELEASE_NAME = "REL #{PKG_VERSION}"
namespace :release do
desc "Publish Merb More release files to RubyForge."
task :merb_more => [ :package ] do
require 'rubyforge'
require 'rake/contrib/rubyforgepublisher'
packages = %w( gem tgz zip ).collect{ |ext| "pkg/merb-more-#{PKG_VERSION}.#{ext}" }
begin
sh %{rubyforge login}
sh %{rubyforge add_release #{RUBY_FORGE_PROJECT} merb-more #{Merb::VERSION} #{packages.join(' ')}}
sh %{rubyforge add_file #{RUBY_FORGE_PROJECT} merb-more #{Merb::VERSION} #{packages.join(' ')}}
rescue Exception => e
puts
puts "Release failed: #{e.message}"
puts
puts "Set PKG_BUILD environment variable if you do a subrelease (0.9.4.2008_08_02 when version is 0.9.4)"
end
end
desc "Publish Merb More gem to RubyForge, one by one."
task :merb_more_gems => [ :build_gems ] do
merb_more_gems.each do |gem|
Dir.chdir(gem){ sh "#{Gem.ruby} -S rake release" }
end
end
desc "Publish Merb release files to RubyForge."
task :merb => [ :package ] do
require 'rubyforge'
r = RubyForge.new
r.configure
puts "\nLogging in...\n\n"
r.login
merb_release.each do |project, packages|
packages.each do |package|
begin
puts "Adding #{project}: #{package}"
file = "gems/#{package}-#{PKG_VERSION}.gem"
r.add_release project, package, Merb::VERSION, file
r.add_file project, package, Merb::VERSION, file
rescue Exception => e
if e.message =~ /You have already released this version/
puts "You already released #{project}: #{package}. Continuing\n\n"
else
raise e
end
end
end
end
end
end
desc "Run spec examples for Merb More gems, one by one."
task :spec do
merb_gem_paths.each do |gem|
Dir.chdir(gem) { sh "#{Gem.ruby} -S rake spec" }
end
end
desc 'Default: run spec examples for all the gems.'
task :default => 'spec'