From f221a6f19f4cee31e2d103ea9a1930f59223fc25 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 1 Mar 2010 23:36:54 -0500 Subject: [PATCH] Leverage VERSION constants from gemspecs to avoid tedious updates when releasing --- Rakefile | 11 ++++++++--- actionmailer/Rakefile | 1 - actionmailer/actionmailer.gemspec | 7 +++++-- actionpack/Rakefile | 1 - actionpack/actionpack.gemspec | 9 ++++++--- activemodel/Rakefile | 1 - activemodel/activemodel.gemspec | 7 +++++-- activerecord/Rakefile | 1 - activerecord/activerecord.gemspec | 9 ++++++--- activeresource/Rakefile | 2 -- activeresource/activeresource.gemspec | 9 ++++++--- activesupport/Rakefile | 2 -- activesupport/activesupport.gemspec | 5 ++++- rails.gemspec | 17 ++++++++++------- railties/Rakefile | 3 --- railties/lib/rails/tasks/documentation.rake | 2 +- railties/railties.gemspec | 9 ++++++--- 17 files changed, 57 insertions(+), 39 deletions(-) diff --git a/Rakefile b/Rakefile index 0c1c240410..50700fdeac 100644 --- a/Rakefile +++ b/Rakefile @@ -3,10 +3,15 @@ require 'rake/rdoctask' require 'rake/gempackagetask' PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties) +PROJECTS.each { |project| $:.unshift "#{project}/lib" } -Dir["#{File.dirname(__FILE__)}/*/lib/*/version.rb"].each do |version_path| - require version_path -end +require "active_support/version" +require "active_model/version" +require "action_pack/version" +require "action_mailer/version" +require "active_resource/version" +require "active_record/version" +require "rails/version" desc 'Run all tests by default' task :default => %w(test test:isolated) diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile index 0cc743dfa6..5b72843f5e 100644 --- a/actionmailer/Rakefile +++ b/actionmailer/Rakefile @@ -4,7 +4,6 @@ require 'rake/testtask' require 'rake/rdoctask' require 'rake/packagetask' require 'rake/gempackagetask' -require File.join(File.dirname(__FILE__), 'lib', 'action_mailer', 'version') desc "Default Task" task :default => [ :test ] diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index 13983aa663..c7a363575b 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -1,7 +1,10 @@ +$:.unshift "lib" +require "action_mailer/version" + Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'actionmailer' - s.version = '3.0.0.beta1' + s.version = ActionMailer::VERSION::STRING s.summary = 'Email composition, delivery, and recieval framework (part of Rails).' s.description = 'Email composition, delivery, and recieval framework (part of Rails).' s.required_ruby_version = '>= 1.8.7' @@ -17,7 +20,7 @@ Gem::Specification.new do |s| s.has_rdoc = true - s.add_dependency('actionpack', '= 3.0.0.beta1') + s.add_dependency('actionpack', "= #{ActionMailer::VERSION::STRING}") s.add_dependency('mail', '~> 2.1.3') s.add_dependency('text-format', '~> 1.0.0') end diff --git a/actionpack/Rakefile b/actionpack/Rakefile index f099a4613e..b9ace8658a 100644 --- a/actionpack/Rakefile +++ b/actionpack/Rakefile @@ -4,7 +4,6 @@ require 'rake/testtask' require 'rake/rdoctask' require 'rake/packagetask' require 'rake/gempackagetask' -require File.join(File.dirname(__FILE__), 'lib', 'action_pack', 'version') desc "Default Task" task :default => :test diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index 00c4d7de1c..d19649a386 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -1,7 +1,10 @@ +$:.unshift "lib" +require "action_pack/version" + Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'actionpack' - s.version = '3.0.0.beta1' + s.version = ActionPack::VERSION::STRING s.summary = 'Web-flow and rendering framework putting the VC in MVC (part of Rails).' s.description = 'Web-flow and rendering framework putting the VC in MVC (part of Rails).' s.required_ruby_version = '>= 1.8.7' @@ -17,8 +20,8 @@ Gem::Specification.new do |s| s.has_rdoc = true - s.add_dependency('activesupport', '= 3.0.0.beta1') - s.add_dependency('activemodel', '= 3.0.0.beta1') + s.add_dependency('activesupport', "= #{ActionPack::VERSION::STRING}") + s.add_dependency('activemodel', "= #{ActionPack::VERSION::STRING}") s.add_dependency('rack', '~> 1.1.0') s.add_dependency('rack-test', '~> 0.5.0') s.add_dependency('rack-mount', '~> 0.5.1') diff --git a/activemodel/Rakefile b/activemodel/Rakefile index b1ebf07af0..d4a00c5073 100755 --- a/activemodel/Rakefile +++ b/activemodel/Rakefile @@ -1,5 +1,4 @@ dir = File.dirname(__FILE__) -require "#{dir}/lib/active_model/version" require 'rake/testtask' diff --git a/activemodel/activemodel.gemspec b/activemodel/activemodel.gemspec index b4fbe26d97..00e06c35be 100644 --- a/activemodel/activemodel.gemspec +++ b/activemodel/activemodel.gemspec @@ -1,7 +1,10 @@ +$:.unshift "lib" +require "active_model/version" + Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'activemodel' - s.version = '3.0.0.beta1' + s.version = ActiveModel::VERSION::STRING s.summary = "A toolkit for building other modeling frameworks like ActiveRecord" s.description = %q{Extracts common modeling concerns from ActiveRecord to share between similar frameworks like ActiveResource.} s.required_ruby_version = '>= 1.8.7' @@ -13,7 +16,7 @@ Gem::Specification.new do |s| s.has_rdoc = true - s.add_dependency('activesupport', '= 3.0.0.beta1') + s.add_dependency('activesupport', "= #{ActiveModel::VERSION::STRING}") s.require_path = 'lib' s.files = Dir["CHANGELOG", "MIT-LICENSE", "README", "lib/**/*"] diff --git a/activerecord/Rakefile b/activerecord/Rakefile index c53215e75e..e638da0f3e 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -5,7 +5,6 @@ require 'rake/rdoctask' require 'rake/packagetask' require 'rake/gempackagetask' -require File.join(File.dirname(__FILE__), 'lib', 'active_record', 'version') require File.expand_path(File.dirname(__FILE__)) + "/test/config" MYSQL_DB_USER = 'rails' diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec index aeaafbb694..b269126a86 100644 --- a/activerecord/activerecord.gemspec +++ b/activerecord/activerecord.gemspec @@ -1,7 +1,10 @@ +$:.unshift "lib" +require "active_record/version" + Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'activerecord' - s.version = '3.0.0.beta1' + s.version = ActiveRecord::VERSION::STRING s.summary = 'Object-relational mapper framework (part of Rails).' s.description = 'Object-relational mapper framework (part of Rails).' s.required_ruby_version = '>= 1.8.7' @@ -18,7 +21,7 @@ Gem::Specification.new do |s| s.extra_rdoc_files = %w( README ) s.rdoc_options.concat ['--main', 'README'] - s.add_dependency('activesupport', '= 3.0.0.beta1') - s.add_dependency('activemodel', '= 3.0.0.beta1') + s.add_dependency('activesupport', "= #{ActiveRecord::VERSION::STRING}") + s.add_dependency('activemodel', "= #{ActiveRecord::VERSION::STRING}") s.add_dependency('arel', '~> 0.2.1') end diff --git a/activeresource/Rakefile b/activeresource/Rakefile index a0a8ab19d1..175b379699 100644 --- a/activeresource/Rakefile +++ b/activeresource/Rakefile @@ -5,8 +5,6 @@ require 'rake/rdoctask' require 'rake/packagetask' require 'rake/gempackagetask' -require File.join(File.dirname(__FILE__), 'lib', 'active_resource', 'version') - desc "Default Task" task :default => [ :test ] diff --git a/activeresource/activeresource.gemspec b/activeresource/activeresource.gemspec index 1722ebeb8e..4cee5dbddd 100644 --- a/activeresource/activeresource.gemspec +++ b/activeresource/activeresource.gemspec @@ -1,7 +1,10 @@ +$:.unshift "lib" +require "active_resource/version" + Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'activeresource' - s.version = '3.0.0.beta1' + s.version = ActiveResource::VERSION::STRING s.summary = 'REST-model framework (part of Rails).' s.description = 'REST-model framework (part of Rails).' s.required_ruby_version = '>= 1.8.7' @@ -18,6 +21,6 @@ Gem::Specification.new do |s| s.extra_rdoc_files = %w( README ) s.rdoc_options.concat ['--main', 'README'] - s.add_dependency('activesupport', '= 3.0.0.beta1') - s.add_dependency('activemodel', '= 3.0.0.beta1') + s.add_dependency('activesupport', "= #{ActiveResource::VERSION::STRING}") + s.add_dependency('activemodel', "= #{ActiveResource::VERSION::STRING}") end diff --git a/activesupport/Rakefile b/activesupport/Rakefile index 64e3111cf8..43f4722dbc 100644 --- a/activesupport/Rakefile +++ b/activesupport/Rakefile @@ -2,8 +2,6 @@ require 'rake/testtask' require 'rake/rdoctask' require 'rake/gempackagetask' -require File.join(File.dirname(__FILE__), 'lib', 'active_support', 'version') - task :default => :test Rake::TestTask.new do |t| t.libs << 'test' diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec index 90d68a215a..d76f752457 100644 --- a/activesupport/activesupport.gemspec +++ b/activesupport/activesupport.gemspec @@ -1,7 +1,10 @@ +$:.unshift "lib" +require "active_support/version" + Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'activesupport' - s.version = '3.0.0.beta1' + s.version = ActiveSupport::VERSION::STRING s.summary = 'Support and utility classes used by the Rails framework.' s.description = 'Support and utility classes used by the Rails framework.' s.required_ruby_version = '>= 1.8.7' diff --git a/rails.gemspec b/rails.gemspec index 4ebbd8061f..52d82eee1f 100644 --- a/rails.gemspec +++ b/rails.gemspec @@ -1,7 +1,10 @@ +$:.unshift "railties/lib" +require "rails/version" + Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'rails' - s.version = '3.0.0.beta1' + s.version = Rails::VERSION::STRING s.summary = 'Full-stack web-application framework.' s.description = 'Full-stack web-application framework.' s.required_ruby_version = '>= 1.8.7' @@ -14,11 +17,11 @@ Gem::Specification.new do |s| s.files = [] s.require_path = [] - s.add_dependency('activesupport', '= 3.0.0.beta1') - s.add_dependency('actionpack', '= 3.0.0.beta1') - s.add_dependency('activerecord', '= 3.0.0.beta1') - s.add_dependency('activeresource', '= 3.0.0.beta1') - s.add_dependency('actionmailer', '= 3.0.0.beta1') - s.add_dependency('railties', '= 3.0.0.beta1') + s.add_dependency('activesupport', "= #{Rails::VERSION::STRING}") + s.add_dependency('actionpack', "= #{Rails::VERSION::STRING}") + s.add_dependency('activerecord', "= #{Rails::VERSION::STRING}") + s.add_dependency('activeresource', "= #{Rails::VERSION::STRING}") + s.add_dependency('actionmailer', "= #{Rails::VERSION::STRING}") + s.add_dependency('railties', "= #{Rails::VERSION::STRING}") s.add_dependency('bundler', '>= 0.9.8') end diff --git a/railties/Rakefile b/railties/Rakefile index d62bfb71eb..fe049d565f 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -8,9 +8,6 @@ require 'rake/gempackagetask' require 'date' require 'rbconfig' -$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib" -require 'rails/version' - task :default => :test task :test => 'test:isolated' diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index f7cc6ff4be..1f4067d29e 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -14,7 +14,7 @@ namespace :doc do desc 'Generate documentation for the Rails framework. Specify path with PATH="/path/to/rails"' Rake::RDocTask.new("rails") { |rdoc| path = ENV['RAILS_PATH'] || 'vendor/gems/gems' - version = '-3.0.0.beta1' unless ENV['RAILS_PATH'] + version = "-#{Rails::VERSION::STRING}" unless ENV['RAILS_PATH'] rdoc.rdoc_dir = 'doc/api' rdoc.template = "#{ENV['template']}.rb" if ENV['template'] rdoc.title = "Rails Framework Documentation" diff --git a/railties/railties.gemspec b/railties/railties.gemspec index c43bb7e1e9..e2758a84e5 100644 --- a/railties/railties.gemspec +++ b/railties/railties.gemspec @@ -1,7 +1,10 @@ +$:.unshift "lib" +require "rails/version" + Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'railties' - s.version = '3.0.0.beta1' + s.version = Rails::VERSION::STRING s.summary = 'Controls boot-up, rake tasks and generators for the Rails framework.' s.description = 'Controls boot-up, rake tasks and generators for the Rails framework.' s.required_ruby_version = '>= 1.8.7' @@ -22,6 +25,6 @@ Gem::Specification.new do |s| s.add_dependency('rake', '>= 0.8.3') s.add_dependency('thor', '~> 0.13.4') - s.add_dependency('activesupport', '= 3.0.0.beta1') - s.add_dependency('actionpack', '= 3.0.0.beta1') + s.add_dependency('activesupport', "= #{Rails::VERSION::STRING}") + s.add_dependency('actionpack', "= #{Rails::VERSION::STRING}") end