forked from wycats/merb-more
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
174 lines (146 loc) · 4.99 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
## THESE ARE CRUCIAL
module Merb
# Set this to the version of merb-core that you are building against/for
VERSION = "0.9.9"
# Set this to the version of merb-more you plan to release
MORE_VERSION = "0.9.9"
end
GEM_VERSION = Merb::VERSION
require "rake/clean"
require "rake/gempackagetask"
require 'merb-core/tasks/merb_rake_helper'
require 'fileutils'
include FileUtils
gems = %w[
merb-action-args merb-assets merb-gen merb-haml
merb-builder merb-mailer merb-parts merb-cache merb-slices
merb-jquery merb-helpers
]
merb_more_spec = Gem::Specification.new do |s|
s.rubyforge_project = 'merb'
s.name = "merb-more"
s.version = Merb::MORE_VERSION
s.platform = Gem::Platform::RUBY
s.author = "Ezra Zygmuntowicz"
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.add_dependency "merb-core", ">= #{Merb::VERSION}"
gems.each do |gem|
s.add_dependency gem, [">= #{Merb::VERSION}", "<= 1.0"]
end
end
CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache", "lib/merb-more.rb"]
Rake::GemPackageTask.new(merb_more_spec) do |package|
package.gem_spec = merb_more_spec
end
desc "Install all gems"
task :install do
Merb::RakeHelper.install('merb-more', :version => Merb::MORE_VERSION)
Merb::RakeHelper.install_package("pkg/merb-#{Merb::MORE_VERSION}.gem")
end
desc "Uninstall all gems"
task :uninstall => :uninstall_gems do
Merb::RakeHelper.uninstall('merb-more', :version => Merb::MORE_VERSION)
Merb::RakeHelper.uninstall('merb', :version => Merb::MORE_VERSION)
end
desc "Build the merb-more gems"
task :build_gems do
gems.each do |dir|
Dir.chdir(dir) { sh "#{Gem.ruby} -S rake package" }
end
end
desc "Install the merb-more sub-gems"
task :install_gems do
gems.each do |dir|
Dir.chdir(dir) { sh "#{Gem.ruby} -S rake install" }
end
end
desc "Uninstall the merb-more sub-gems"
task :uninstall_gems do
gems.each do |dir|
Dir.chdir(dir) { sh "#{Gem.ruby} -S rake uninstall" }
end
end
desc "Clobber the merb-more sub-gems"
task :clobber_gems do
gems.each do |dir|
Dir.chdir(dir) { sh "#{Gem.ruby} -S rake clobber" }
end
end
task :package => ["lib/merb-more.rb"]
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."
gems.each do |gem|
next if gem == "merb-gen"
file.puts "require '#{gem}'"
end
end
end
desc "Bundle up all the merb-more gems"
task :bundle => [:package, :build_gems] do
mkdir_p "bundle"
cp "pkg/merb-#{Merb::MORE_VERSION}.gem", "bundle"
cp "pkg/merb-more-#{Merb::MORE_VERSION}.gem", "bundle"
gems.each do |gem|
sh %{cp #{gem}/pkg/#{gem}-#{Merb::MORE_VERSION}.gem bundle/}
end
end
RUBY_FORGE_PROJECT = "merb"
GROUP_NAME = "merb"
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
PKG_VERSION = GEM_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::MORE_VERSION} #{packages.join(' ')}}
sh %{rubyforge add_file #{RUBY_FORGE_PROJECT} merb-more #{Merb::MORE_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
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'
require 'rake/contrib/rubyforgepublisher'
packages = %w( gem tgz zip ).collect{ |ext| "pkg/merb-#{PKG_VERSION}.#{ext}" }
begin
sh %{rubyforge login}
sh %{rubyforge add_release #{RUBY_FORGE_PROJECT} merb #{Merb::VERSION} #{packages.join(' ')}}
sh %{rubyforge add_file #{RUBY_FORGE_PROJECT} merb #{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
end
desc "Run spec examples for Merb More gems, one by one."
task :spec do
gems.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'