forked from wycats/merb-more
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
119 lines (102 loc) · 3.5 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
## THESE ARE CRUCIAL
module Merb
# Set this to the version of merb-core that you are building against/for
VERSION = "0.9.4"
# Set this to the version of merb-more you plan to release
MORE_VERSION = "0.9.4"
end
require "rake/clean"
require "rake/gempackagetask"
require 'fileutils'
include FileUtils
gems = %w[
merb-action-args merb-assets merb-gen merb-haml
merb-builder merb-mailer merb-parts merb-cache merb-freezer
]
merb_more_spec = Gem::Specification.new do |s|
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
merb_spec = Gem::Specification.new do |s|
s.name = "merb"
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-core + merb-more) == all of Merb"
s.description = s.summary
s.files = %w( LICENSE README Rakefile TODO )
s.add_dependency "merb-core", "= #{Merb::VERSION}"
s.add_dependency "merb-more", "= #{Merb::MORE_VERSION}"
s.add_dependency "mongrel", ">= 1.0.1"
end
CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache", "lib/merb-more.rb"]
windows = (PLATFORM =~ /win32|cygwin/) rescue nil
SUDO = windows ? "" : "sudo"
Rake::GemPackageTask.new(merb_more_spec) do |package|
package.gem_spec = merb_more_spec
end
Rake::GemPackageTask.new(merb_spec) do |package|
package.gem_spec = merb_spec
end
gem_home = ENV['GEM_HOME'] ? "GEM_HOME=#{ENV['GEM_HOME']}" : ""
install_home = ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : ""
desc "Install it all"
task :install => [:install_gems, :package] do
sh %{#{SUDO} gem install #{install_home} --local pkg/merb-more-#{Merb::MORE_VERSION}.gem --no-update-sources}
sh %{#{SUDO} gem install #{install_home} --local pkg/merb-#{Merb::MORE_VERSION}.gem --no-update-sources}
end
desc "Build the merb-more gems"
task :build_gems do
gems.each do |dir|
Dir.chdir(dir){ sh "rake package" }
end
end
desc "Install the merb-more sub-gems"
task :install_gems do
gems.each do |dir|
Dir.chdir(dir){ sh "rake install" }
end
end
desc "Uninstall the merb-more sub-gems"
task :uninstall_gems do
gems.each do |sub_gem|
sh %{#{SUDO} gem uninstall #{sub_gem}}
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|
File.open("#{gem}/Rakefile") do |rakefile|
rakefile.read.detect {|l| l =~ /^VERSION\s*=\s*"(.*)"$/ }
sh %{cp #{gem}/pkg/#{gem}-#{$1}.gem bundle/}
end
end
end