Skip to content

Commit

Permalink
Created rake_helper and refactored Rakefiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Apr 9, 2009
1 parent 12cd8d6 commit 2d67913
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 164 deletions.
56 changes: 56 additions & 0 deletions rake_helpers.rb
Original file line number Diff line number Diff line change
@@ -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
62 changes: 7 additions & 55 deletions remarkable/Rakefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
61 changes: 7 additions & 54 deletions remarkable_activerecord/Rakefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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|
Expand All @@ -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
62 changes: 7 additions & 55 deletions remarkable_rails/Rakefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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|
Expand All @@ -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

0 comments on commit 2d67913

Please sign in to comment.