Permalink
Browse files

Modify the rakefiles to be DRY

  • Loading branch information...
1 parent 9b7bbed commit 8b2b7a67d2aea2220e842066d497448d729568b6 @wycats committed Oct 31, 2008
View
10 Rakefile
@@ -20,6 +20,7 @@ merb_more_gem_paths = %w[
merb-param-protection
merb-slices
merb_datamapper
+ merb
]
merb_gem_paths = %w[merb-core] + merb_more_gem_paths
@@ -102,7 +103,7 @@ task :clobber_gems do
end
end
-task :package => ["lib/merb-more.rb"]
+task :package => ["lib/merb-more.rb", :build_gems]
desc "Create merb-more.rb"
task "lib/merb-more.rb" do
mkdir_p "lib"
@@ -115,6 +116,13 @@ task "lib/merb-more.rb" do
end
end
+task :package do
+ mkdir_p "gems"
+ Dir["**/pkg/*.gem"].each do |file|
+ FileUtils.cp(file, "gems")
+ end
+end
+
RUBY_FORGE_PROJECT = "merb"
GROUP_NAME = "merb"
View
7 merb-action-args/Rakefile
@@ -1,9 +1,4 @@
-require 'rubygems'
-require "merb-core"
-require 'rake/gempackagetask'
-require "extlib"
-require File.join(File.dirname(__FILE__), '../merb-core/lib/merb-core/tasks/merb_rake_helper')
-require "spec/rake/spectask"
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
8 merb-assets/Rakefile
@@ -1,10 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
-
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
19 merb-auth/Rakefile
@@ -1,14 +1,7 @@
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
-
-require "rake/clean"
-require "rake/gempackagetask"
-require 'rubygems/specification'
-require "spec/rake/spectask"
-require 'merb-core/tasks/merb_rake_helper'
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
require 'fileutils'
include FileUtils
-
-require "extlib/tasks/release"
+require 'rake/clean'
RUBY_FORGE_PROJECT = "merb-auth"
PROJECT_URL = "http://merbivore.com"
@@ -71,7 +64,7 @@ Rake::GemPackageTask.new(merb_auth_spec) do |package|
package.gem_spec = merb_auth_spec
end
-task :package => ["lib/merb-auth.rb"]
+task :package => ["lib/merb-auth.rb", :build_children]
desc "Create merb-auth.rb"
task "lib/merb-auth.rb" do
mkdir_p "lib"
@@ -84,6 +77,12 @@ task "lib/merb-auth.rb" do
end
end
+task :build_children do
+ %w(merb-auth-core merb-auth-more merb-auth-slice-password).each do |dir|
+ Dir.chdir(dir) { sh "#{Gem.ruby} -S rake package" }
+ end
+end
+
desc "install the plugin as a gem"
task :install do
Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
View
11 merb-auth/merb-auth-core/Rakefile
@@ -1,13 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rubygems/specification'
-require 'date'
-require "spec/rake/spectask"
-require File.join(File.dirname(__FILE__), "../../merb-core/lib/merb-core/version")
-require File.join(File.dirname(__FILE__), "../../merb-core/lib/merb-core/tasks/merb_rake_helper")
-require 'rake/testtask'
-
-require "extlib/tasks/release"
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "rake_helpers"))
RUBY_FORGE_PROJECT = "merb-auth"
GEM_NAME = "merb-auth-core"
View
11 merb-auth/merb-auth-more/Rakefile
@@ -1,13 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rubygems/specification'
-require 'date'
-require "spec/rake/spectask"
-require 'merb-core/tasks/merb_rake_helper'
-require 'rake/testtask'
-require "extlib/tasks/release"
-
-require File.join(File.dirname(__FILE__), "../../merb-core/lib/merb-core/version.rb")
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "rake_helpers"))
RUBY_FORGE_PROJECT = "merb-auth"
GEM_NAME = "merb-auth-more"
View
9 merb-auth/merb-auth-slice-password/Rakefile
@@ -1,9 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-
-require 'merb-core'
-require 'merb-core/tasks/merb'
-require "extlib/tasks/release"
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "rake_helpers"))
RUBY_FORGE_PROJECT = "merb-auth"
GEM_NAME = "merb-auth-slice-password"
@@ -49,7 +44,5 @@ task :gemspec do
end
end
-require 'spec/rake/spectask'
-require 'merb-core/test/tasks/spectasks'
desc 'Default: run spec examples'
task :default => 'spec'
View
7 merb-cache/Rakefile
@@ -1,9 +1,4 @@
-require 'rubygems'
-require "merb-core"
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
9 merb-exceptions/Rakefile
@@ -1,11 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require "rake/rdoctask"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
-require "extlib/tasks/release"
-
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
8 merb-gen/Rakefile
@@ -1,10 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
-
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
8 merb-haml/Rakefile
@@ -1,10 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
-
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
8 merb-helpers/Rakefile
@@ -1,10 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
-
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
8 merb-mailer/Rakefile
@@ -1,10 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
-
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
8 merb-param-protection/Rakefile
@@ -1,11 +1,5 @@
-require 'rubygems'
-require 'rubygems/specification'
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
##############################################################################
# Package && release
##############################################################################
View
8 merb-slices/Rakefile
@@ -1,10 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
-
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
7 merb/Rakefile
@@ -1,9 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rubygems/specification'
-require 'date'
-require 'merb-core/version'
-require 'merb-core/tasks/merb_rake_helper'
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
NAME = "merb"
AUTHOR = "Merb Team"
View
9 merb_datamapper/Rakefile
@@ -1,11 +1,4 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-require "extlib"
-require 'merb-core/tasks/merb_rake_helper'
-require "spec/rake/spectask"
-
-require File.join(File.dirname(__FILE__), "../merb-core/lib/merb-core/version.rb")
-
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "rake_helpers"))
##############################################################################
# Package && release
View
10 rake_helpers.rb
@@ -0,0 +1,10 @@
+require 'rubygems'
+require 'rake/gempackagetask'
+require 'rubygems/specification'
+require 'date'
+require "spec/rake/spectask"
+require File.join(File.dirname(__FILE__), "merb-core/lib/merb-core/version")
+require File.join(File.dirname(__FILE__), "merb-core/lib/merb-core/tasks/merb_rake_helper")
+require 'rake/testtask'
+
+require "extlib/tasks/release"

0 comments on commit 8b2b7a6

Please sign in to comment.