Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Created rake_helper and refactored Rakefiles.

  • Loading branch information...
commit 2d67913190e8f73654457f1278f86343e180fd74 1 parent 12cd8d6
@josevalim josevalim authored
View
56 rake_helpers.rb
@@ -0,0 +1,56 @@
+current_dir = File.dirname(__FILE__)
+require File.join(current_dir, "remarkable/lib/remarkable/version.rb")
+
+require 'rubygems'
+require 'rake/gempackagetask'
+require 'rake/rdoctask'
+
+########### Common package && release
+
+RUBY_FORGE_PROJECT = "remarkable"
+PROJECT_URL = "http://github.com/carlosbrando/remarkable"
+
+GEM_VERSION = Remarkable::VERSION
+PACKAGE_DIR = File.join(File.dirname(__FILE__), 'pkg')
+RELEASE_NAME = "REL #{GEM_VERSION}"
+
+RSPEC_VERSION = '1.2.0'
+
+desc "Create a gemspec file"
+task :gemspec do
+ File.open("#{GEM_NAME}.gemspec", "w") do |file|
+ file.puts $spec.to_ruby
+ end
+end
+
+desc "Build the gem and install it"
+task :install => :gem do
+ system("sudo gem install #{PACKAGE_DIR}/#{GEM_NAME}-#{GEM_VERSION}.gem --local --ignore-dependencies")
+end
+
+desc "Uninstall the gem"
+task :uninstall do
+ system("sudo gem uninstall #{GEM_NAME} --version #{GEM_VERSION}")
+end
+
+########### Common specs
+
+gem 'rspec', ENV['RSPEC_VERSION'] || '1.2.2'
+require 'spec/rake/spectask'
+
+desc "Run the specs under spec"
+Spec::Rake::SpecTask.new do |t|
+ t.spec_opts = ['--options', "spec/spec.opts"]
+ t.spec_files = FileList['spec/**/*_spec.rb']
+end
+
+########## Common rdoc
+
+Rake::RDocTask.new do |rdoc|
+ rdoc.main = "README"
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = GEM_NAME
+ rdoc.rdoc_files.include(*EXTRA_RDOC_FILES)
+ rdoc.rdoc_files.include('lib/**/*.rb')
+ rdoc.options << '--line-numbers' << '--inline-source'
+end
View
62 remarkable/Rakefile
@@ -1,28 +1,17 @@
-require File.join(File.dirname(__FILE__), "..", "remarkable", "lib", "remarkable", "version.rb")
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-
########### Package && release
-RUBY_FORGE_PROJECT = "remarkable"
-PROJECT_URL = "http://github.com/carlosbrando/remarkable"
-PROJECT_SUMMARY = "Remarkable: a framework for rspec matchers, with support to macros and I18n."
+PROJECT_SUMMARY = "Remarkable: a framework for rspec matchers, with support to macros and I18n."
PROJECT_DESCRIPTION = PROJECT_SUMMARY
+GEM_NAME = "remarkable"
GEM_AUTHOR = [ "Carlos Brando", "José Valim" ]
GEM_EMAIL = [ "eduardobrando@gmail.com", "jose.valim@gmail.com" ]
-GEM_NAME = "remarkable"
-GEM_VERSION = Remarkable::VERSION
-
-PACKAGE_DIR = File.join(File.dirname(__FILE__), '..', 'pkg')
-RELEASE_NAME = "REL #{GEM_VERSION}"
-
-RSPEC_VERSION = '1.2.0'
EXTRA_RDOC_FILES = ["README", "LICENSE", "CHANGELOG"]
-spec = Gem::Specification.new do |s|
+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
@@ -39,52 +28,15 @@ spec = Gem::Specification.new do |s|
s.files = %w(Rakefile) + EXTRA_RDOC_FILES + Dir.glob("{lib,locale,spec}/**/*")
end
-Rake::GemPackageTask.new(spec) do |pkg|
+Rake::GemPackageTask.new($spec) do |pkg|
pkg.package_dir = PACKAGE_DIR
- pkg.gem_spec = spec
-end
-
-desc "Create a gemspec file"
-task :gemspec do
- File.open("#{GEM_NAME}.gemspec", "w") do |file|
- file.puts spec.to_ruby
- end
-end
-
-desc "Build the gem and install it"
-task :install => :gem do
- system("sudo gem install #{PACKAGE_DIR}/#{GEM_NAME}-#{GEM_VERSION}.gem --local --ignore-dependencies")
-end
-
-desc "Uninstall the gem"
-task :uninstall do
- system("sudo gem uninstall #{GEM_NAME} --version #{GEM_VERSION}")
+ pkg.gem_spec = $spec
end
########### Specs
-gem 'rspec', ENV['RSPEC_VERSION'] || '1.2.2'
-require 'spec/rake/spectask'
-
-desc "Run the specs under spec"
-Spec::Rake::SpecTask.new do |t|
- t.spec_opts = ['--options', "spec/spec.opts"]
- t.spec_files = FileList['spec/**/*_spec.rb']
-end
-
desc "Run the specs under spec"
task :pre_commit do
puts "\n=> #{GEM_NAME}: rake spec"
Rake::Task[:spec].execute
end
-
-########### RDoc
-
-Rake::RDocTask.new do |rdoc|
- rdoc.main = "README"
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = GEM_NAME
- rdoc.rdoc_files.include(*EXTRA_RDOC_FILES)
- rdoc.rdoc_files.include('lib/**/*.rb')
- rdoc.options << '--line-numbers' << '--inline-source'
-end
View
61 remarkable_activerecord/Rakefile
@@ -1,27 +1,17 @@
-require File.join(File.dirname(__FILE__), "..", "remarkable", "lib", "remarkable", "version.rb")
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-
########### Package && release
-RUBY_FORGE_PROJECT = "remarkable"
-PROJECT_URL = "http://github.com/carlosbrando/remarkable"
-PROJECT_SUMMARY = "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
+PROJECT_SUMMARY = "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
PROJECT_DESCRIPTION = PROJECT_SUMMARY
+GEM_NAME = "remarkable_activerecord"
GEM_AUTHOR = [ "Carlos Brando", "José Valim", "Diego Carrion" ]
GEM_EMAIL = [ "eduardobrando@gmail.com", "jose.valim@gmail.com", "dc.rec1@gmail.com" ]
-GEM_NAME = "remarkable_activerecord"
-GEM_VERSION = Remarkable::VERSION
-
-PACKAGE_DIR = File.join(File.dirname(__FILE__), '..', 'pkg')
-RELEASE_NAME = "REL #{GEM_VERSION}"
-
EXTRA_RDOC_FILES = ["README", "LICENSE", "CHANGELOG"]
-spec = Gem::Specification.new do |s|
+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
@@ -38,41 +28,15 @@ spec = Gem::Specification.new do |s|
s.files = %w(Rakefile) + EXTRA_RDOC_FILES + Dir.glob("{lib,locale,spec}/**/*")
end
-Rake::GemPackageTask.new(spec) do |pkg|
+Rake::GemPackageTask.new($spec) do |pkg|
pkg.package_dir = PACKAGE_DIR
- pkg.gem_spec = spec
-end
-
-desc "Create a gemspec file"
-task :gemspec do
- File.open("#{GEM_NAME}.gemspec", "w") do |file|
- file.puts spec.to_ruby
- end
-end
-
-desc "Build the gem and install it"
-task :install => :gem do
- system("sudo gem install #{PACKAGE_DIR}/#{GEM_NAME}-#{GEM_VERSION}.gem --local --ignore-dependencies")
-end
-
-desc "Uninstall the gem"
-task :uninstall do
- system("sudo gem uninstall #{GEM_NAME} --version #{GEM_VERSION}")
+ pkg.gem_spec = $spec
end
########### Specs
-gem 'rspec', ENV['RSPEC_VERSION'] || '1.2.2'
-require 'spec/rake/spectask'
-
RAILS_VERSIONS = ['2.1.2', '2.2.2', '2.3.2']
-desc "Run the specs under spec"
-Spec::Rake::SpecTask.new do |t|
- t.spec_opts = ['--options', "spec/spec.opts"]
- t.spec_files = FileList['spec/**/*_spec.rb']
-end
-
desc "Run the specs under spec with supported Rails versions"
task :pre_commit do
RAILS_VERSIONS.each do |version|
@@ -81,14 +45,3 @@ task :pre_commit do
Rake::Task[:spec].execute
end
end
-
-########### RDoc
-
-Rake::RDocTask.new do |rdoc|
- rdoc.main = "README"
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = GEM_NAME
- rdoc.rdoc_files.include(*EXTRA_RDOC_FILES)
- rdoc.rdoc_files.include('lib/**/*.rb')
- rdoc.options << '--line-numbers' << '--inline-source'
-end
View
62 remarkable_rails/Rakefile
@@ -1,28 +1,17 @@
-require File.join(File.dirname(__FILE__), "..", "remarkable", "lib", "remarkable", "version.rb")
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-
########### Package && release
-RUBY_FORGE_PROJECT = "remarkable"
-PROJECT_URL = "http://github.com/carlosbrando/remarkable"
-PROJECT_SUMMARY = "Remarkable Rails: collection of matchers and macros with I18n for Rails"
+PROJECT_SUMMARY = "Remarkable Rails: collection of matchers and macros with I18n for Rails"
PROJECT_DESCRIPTION = PROJECT_SUMMARY
+GEM_NAME = "remarkable_rails"
GEM_AUTHOR = [ "Carlos Brando", "José Valim" ]
GEM_EMAIL = [ "eduardobrando@gmail.com", "jose.valim@gmail.com" ]
-GEM_NAME = "remarkable_rails"
-GEM_VERSION = Remarkable::VERSION
-
-PACKAGE_DIR = File.join(File.dirname(__FILE__), '..', 'pkg')
-RELEASE_NAME = "REL #{GEM_VERSION}"
-
-RSPEC_VERSION = '1.2.0'
EXTRA_RDOC_FILES = ["README", "LICENSE", "CHANGELOG"]
-spec = Gem::Specification.new do |s|
+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
@@ -41,41 +30,15 @@ spec = Gem::Specification.new do |s|
s.files = %w(Rakefile) + EXTRA_RDOC_FILES + Dir.glob("{lib,locale,spec}/**/*")
end
-Rake::GemPackageTask.new(spec) do |pkg|
+Rake::GemPackageTask.new($spec) do |pkg|
pkg.package_dir = PACKAGE_DIR
- pkg.gem_spec = spec
-end
-
-desc "Create a gemspec file"
-task :gemspec do
- File.open("#{GEM_NAME}.gemspec", "w") do |file|
- file.puts spec.to_ruby
- end
-end
-
-desc "Build the gem and install it"
-task :install => :gem do
- system("sudo gem install #{PACKAGE_DIR}/#{GEM_NAME}-#{GEM_VERSION}.gem --local --ignore-dependencies")
-end
-
-desc "Uninstall the gem"
-task :uninstall do
- system("sudo gem uninstall #{GEM_NAME} --version #{GEM_VERSION}")
+ pkg.gem_spec = $spec
end
########### Specs
-gem 'rspec', ENV['RSPEC_VERSION'] || '1.2.2'
-require 'spec/rake/spectask'
-
RAILS_VERSIONS = ['2.1.2', '2.2.2', '2.3.2']
-desc "Run the specs under spec"
-Spec::Rake::SpecTask.new do |t|
- t.spec_opts = ['--options', "spec/spec.opts"]
- t.spec_files = FileList['spec/**/*_spec.rb']
-end
-
desc "Run the specs under spec with supported Rails versions"
task :pre_commit do
RAILS_VERSIONS.each do |version|
@@ -84,14 +47,3 @@ task :pre_commit do
Rake::Task[:spec].execute
end
end
-
-########### RDoc
-
-Rake::RDocTask.new do |rdoc|
- rdoc.main = "README"
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = GEM_NAME
- rdoc.rdoc_files.include(*EXTRA_RDOC_FILES)
- rdoc.rdoc_files.include('lib/**/*.rb')
- rdoc.options << '--line-numbers' << '--inline-source'
-end
Please sign in to comment.
Something went wrong with that request. Please try again.