Permalink
Browse files

More rake refactoring.

  • Loading branch information...
1 parent 2d67913 commit afeab80518f4af952994b2e53ed48486c54e6b01 @josevalim josevalim committed Apr 9, 2009
Showing with 49 additions and 74 deletions.
  1. +13 −11 Rakefile
  2. +27 −0 rake_helpers.rb
  3. +3 −21 remarkable/Rakefile
  4. +3 −21 remarkable_activerecord/Rakefile
  5. +3 −21 remarkable_rails/Rakefile
View
@@ -11,8 +11,20 @@ REMARKABLE_GEMS = [
:remarkable_rails
]
-REMARKABLE_GEMS_PATHS = REMARKABLE_GEMS.map{|g| File.join(current_dir, g.to_s) }
+REMARKABLE_GEMS_PATHS = REMARKABLE_GEMS.map{|g| File.join(current_dir, g.to_s)}
+# Create tasks that are called inside remarkable path
+def self.unique_tasks(*names)
+ names.each do |name|
+ desc "Run #{name} tasks in remarkable core gem"
+ task name do
+ cd REMARKABLE_GEMS_PATHS[0]
+ system "rake #{name}"
+ end
+ end
+end
+
+# Create tasks that are called in each path
def self.recursive_tasks(*names)
names.each do |name|
desc "Run #{name} tasks in all remarkable gems"
@@ -26,16 +38,6 @@ def self.recursive_tasks(*names)
end
end
-def self.unique_tasks(*names)
- names.each do |name|
- desc "Run #{name} tasks in remarkable core gem"
- task name do
- cd REMARKABLE_GEMS_PATHS[0]
- system "rake #{name}"
- end
- end
-end
-
unique_tasks :clobber_package
recursive_tasks :clobber_rdoc, :gem, :gemspec, :install, :package, :pre_commit,
:rdoc, :repackage, :rerdoc, :spec, :uninstall
View
@@ -16,6 +16,33 @@
RSPEC_VERSION = '1.2.0'
+def self.configure_gemspec!
+ $spec = Gem::Specification.new do |s|
+ s.rubyforge_project = RUBY_FORGE_PROJECT
+ s.name = GEM_NAME
+ s.version = GEM_VERSION
+ s.platform = Gem::Platform::RUBY
+ s.has_rdoc = true
+ s.extra_rdoc_files = EXTRA_RDOC_FILES
+ s.summary = PROJECT_SUMMARY
+ s.description = PROJECT_DESCRIPTION
+ s.authors = GEM_AUTHOR
+ s.email = GEM_EMAIL
+ s.homepage = PROJECT_URL
+ s.require_path = 'lib'
+ s.files = EXTRA_RDOC_FILES + Dir.glob("{lib,locale}/**/*")
+ s.test_files = Dir.glob("spec/**/*")
+ yield s
+ end
+
+ Rake::GemPackageTask.new($spec) do |pkg|
+ pkg.package_dir = PACKAGE_DIR
+ pkg.gem_spec = $spec
+ pkg.need_zip = true
+ pkg.need_tar = true
+ end
+end
+
desc "Create a gemspec file"
task :gemspec do
File.open("#{GEM_NAME}.gemspec", "w") do |file|
View
@@ -1,5 +1,3 @@
-########### Package && release
-
PROJECT_SUMMARY = "Remarkable: a framework for rspec matchers, with support to macros and I18n."
PROJECT_DESCRIPTION = PROJECT_SUMMARY
@@ -11,26 +9,10 @@ EXTRA_RDOC_FILES = ["README", "LICENSE", "CHANGELOG"]
require File.join(File.dirname(__FILE__), "..", "rake_helpers.rb")
-$spec = Gem::Specification.new do |s|
- s.rubyforge_project = RUBY_FORGE_PROJECT
- s.name = GEM_NAME
- s.version = GEM_VERSION
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
- s.extra_rdoc_files = EXTRA_RDOC_FILES
- s.summary = PROJECT_SUMMARY
- s.description = PROJECT_DESCRIPTION
- s.authors = GEM_AUTHOR
- s.email = GEM_EMAIL
- s.homepage = PROJECT_URL
- s.require_path = 'lib'
- s.add_dependency('rspec', ">= #{RSPEC_VERSION}")
- s.files = %w(Rakefile) + EXTRA_RDOC_FILES + Dir.glob("{lib,locale,spec}/**/*")
-end
+########### Package && release
-Rake::GemPackageTask.new($spec) do |pkg|
- pkg.package_dir = PACKAGE_DIR
- pkg.gem_spec = $spec
+configure_gemspec! do |s|
+ s.add_dependency('rspec', ">= #{RSPEC_VERSION}")
end
########### Specs
@@ -1,5 +1,3 @@
-########### Package && release
-
PROJECT_SUMMARY = "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
PROJECT_DESCRIPTION = PROJECT_SUMMARY
@@ -11,26 +9,10 @@ EXTRA_RDOC_FILES = ["README", "LICENSE", "CHANGELOG"]
require File.join(File.dirname(__FILE__), "..", "rake_helpers.rb")
-$spec = Gem::Specification.new do |s|
- s.rubyforge_project = RUBY_FORGE_PROJECT
- s.name = GEM_NAME
- s.version = GEM_VERSION
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
- s.extra_rdoc_files = EXTRA_RDOC_FILES
- s.summary = PROJECT_SUMMARY
- s.description = PROJECT_DESCRIPTION
- s.authors = GEM_AUTHOR
- s.email = GEM_EMAIL
- s.homepage = PROJECT_URL
- s.require_path = 'lib'
- s.add_dependency('remarkable', ">= #{GEM_VERSION}")
- s.files = %w(Rakefile) + EXTRA_RDOC_FILES + Dir.glob("{lib,locale,spec}/**/*")
-end
+########### Package && release
-Rake::GemPackageTask.new($spec) do |pkg|
- pkg.package_dir = PACKAGE_DIR
- pkg.gem_spec = $spec
+configure_gemspec! do |s|
+ s.add_dependency('remarkable', ">= #{GEM_VERSION}")
end
########### Specs
@@ -1,5 +1,3 @@
-########### Package && release
-
PROJECT_SUMMARY = "Remarkable Rails: collection of matchers and macros with I18n for Rails"
PROJECT_DESCRIPTION = PROJECT_SUMMARY
@@ -11,28 +9,12 @@ EXTRA_RDOC_FILES = ["README", "LICENSE", "CHANGELOG"]
require File.join(File.dirname(__FILE__), "..", "rake_helpers.rb")
-$spec = Gem::Specification.new do |s|
- s.rubyforge_project = RUBY_FORGE_PROJECT
- s.name = GEM_NAME
- s.version = GEM_VERSION
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
- s.extra_rdoc_files = EXTRA_RDOC_FILES
- s.summary = PROJECT_SUMMARY
- s.description = PROJECT_DESCRIPTION
- s.authors = GEM_AUTHOR
- s.email = GEM_EMAIL
- s.homepage = PROJECT_URL
- s.require_path = 'lib'
+########### Package && release
+
+configure_gemspec! do |s|
s.add_dependency('rspec-rails', ">= #{RSPEC_VERSION}")
s.add_dependency('remarkable', ">= #{GEM_VERSION}")
s.add_dependency('remarkable_activerecord', ">= #{GEM_VERSION}")
- s.files = %w(Rakefile) + EXTRA_RDOC_FILES + Dir.glob("{lib,locale,spec}/**/*")
-end
-
-Rake::GemPackageTask.new($spec) do |pkg|
- pkg.package_dir = PACKAGE_DIR
- pkg.gem_spec = $spec
end
########### Specs

0 comments on commit afeab80

Please sign in to comment.