From deb00bcb8cf88eb6420282c9af0af64fb69aeed4 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 4 Mar 2010 22:41:39 -0500 Subject: Read Rails version from a file instead of modifying the load path and doing requires Signed-off-by: Jeremy Kemper --- RAILS_VERSION | 1 + Rakefile | 15 ++++++--------- actionmailer/actionmailer.gemspec | 7 +++---- actionpack/actionpack.gemspec | 9 ++++----- activemodel/activemodel.gemspec | 7 +++---- activerecord/activerecord.gemspec | 9 ++++----- activeresource/activeresource.gemspec | 9 ++++----- activesupport/activesupport.gemspec | 5 ++--- rails.gemspec | 17 ++++++++--------- railties/railties.gemspec | 9 ++++----- 10 files changed, 39 insertions(+), 49 deletions(-) create mode 100644 RAILS_VERSION diff --git a/RAILS_VERSION b/RAILS_VERSION new file mode 100644 index 0000000000..efcd59e268 --- /dev/null +++ b/RAILS_VERSION @@ -0,0 +1 @@ +3.0.0.beta1 diff --git a/Rakefile b/Rakefile index 50700fdeac..cc12696b83 100644 --- a/Rakefile +++ b/Rakefile @@ -3,15 +3,6 @@ require 'rake/rdoctask' require 'rake/gempackagetask' PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties) -PROJECTS.each { |project| $:.unshift "#{project}/lib" } - -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) @@ -130,6 +121,12 @@ task :pdoc => :rdoc do end task :update_versions do + require File.dirname(__FILE__) + "/version" + + File.open("RAILS_VERSION", "w") do |f| + f.write Rails::VERSION::STRING + "\n" + end + constants = { "activesupport" => "ActiveSupport", "activemodel" => "ActiveModel", diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index fc7f3f1e5f..3c9ffd1749 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -1,10 +1,9 @@ -$:.unshift "lib" -require "action_mailer/version" +version = File.read("../RAILS_VERSION").strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'actionmailer' - s.version = ActionMailer::VERSION::STRING + s.version = version s.summary = 'Email composition, delivery, and receiving framework (part of Rails).' s.description = 'Email on Rails. Compose, deliver, receive, and test emails using the familiar controller/view pattern. First-class support for multipart email and attachments.' s.required_ruby_version = '>= 1.8.7' @@ -20,7 +19,7 @@ Gem::Specification.new do |s| s.has_rdoc = true - s.add_dependency('actionpack', "= #{ActionMailer::VERSION::STRING}") + s.add_dependency('actionpack', version) s.add_dependency('mail', '~> 2.1.3') s.add_dependency('text-format', '~> 1.0.0') end diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index a281df8642..a50c55ed9a 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -1,10 +1,9 @@ -$:.unshift "lib" -require "action_pack/version" +version = File.read("../RAILS_VERSION").strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'actionpack' - s.version = ActionPack::VERSION::STRING + s.version = version s.summary = 'Web-flow and rendering framework putting the VC in MVC (part of Rails).' s.description = 'Web apps on Rails. Simple, battle-tested conventions for building and testing MVC web applications. Works with any Rack-compatible server.' s.required_ruby_version = '>= 1.8.7' @@ -20,8 +19,8 @@ Gem::Specification.new do |s| s.has_rdoc = true - s.add_dependency('activesupport', "= #{ActionPack::VERSION::STRING}") - s.add_dependency('activemodel', "= #{ActionPack::VERSION::STRING}") + s.add_dependency('activesupport', version) + s.add_dependency('activemodel', version) 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/activemodel.gemspec b/activemodel/activemodel.gemspec index 9183558c7c..395ee6a378 100644 --- a/activemodel/activemodel.gemspec +++ b/activemodel/activemodel.gemspec @@ -1,10 +1,9 @@ -$:.unshift "lib" -require "active_model/version" +version = File.read("../RAILS_VERSION").strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'activemodel' - s.version = ActiveModel::VERSION::STRING + s.version = version s.summary = 'A toolkit for building modeling frameworks (part of Rails).' s.description = 'A toolkit for building modeling frameworks like Active Record and Active Resource. Rich support for attributes, callbacks, validations, observers, serialization, internationalization, and testing.' s.required_ruby_version = '>= 1.8.7' @@ -16,7 +15,7 @@ Gem::Specification.new do |s| s.has_rdoc = true - s.add_dependency('activesupport', "= #{ActiveModel::VERSION::STRING}") + s.add_dependency('activesupport', version) s.require_path = 'lib' s.files = Dir["CHANGELOG", "MIT-LICENSE", "README", "lib/**/*"] diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec index 5d76333950..08666f08e9 100644 --- a/activerecord/activerecord.gemspec +++ b/activerecord/activerecord.gemspec @@ -1,10 +1,9 @@ -$:.unshift "lib" -require "active_record/version" +version = File.read("../RAILS_VERSION").strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'activerecord' - s.version = ActiveRecord::VERSION::STRING + s.version = version s.summary = 'Object-relational mapper framework (part of Rails).' s.description = 'Databases on Rails. Build a persistent domain model by mapping database tables to Ruby classes. Strong conventions for associations, validations, aggregations, migrations, and testing come baked-in.' s.required_ruby_version = '>= 1.8.7' @@ -21,7 +20,7 @@ Gem::Specification.new do |s| s.extra_rdoc_files = %w( README ) s.rdoc_options.concat ['--main', 'README'] - s.add_dependency('activesupport', "= #{ActiveRecord::VERSION::STRING}") - s.add_dependency('activemodel', "= #{ActiveRecord::VERSION::STRING}") + s.add_dependency('activesupport', version) + s.add_dependency('activemodel', version) s.add_dependency('arel', '~> 0.2.1') end diff --git a/activeresource/activeresource.gemspec b/activeresource/activeresource.gemspec index 209364a5dc..001c8dc62a 100644 --- a/activeresource/activeresource.gemspec +++ b/activeresource/activeresource.gemspec @@ -1,10 +1,9 @@ -$:.unshift "lib" -require "active_resource/version" +version = File.read("../RAILS_VERSION").strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'activeresource' - s.version = ActiveResource::VERSION::STRING + s.version = version s.summary = 'REST modeling framework (part of Rails).' s.description = 'REST on Rails. Wrap your RESTful web app with Ruby classes and work with them like Active Record models.' s.required_ruby_version = '>= 1.8.7' @@ -21,6 +20,6 @@ Gem::Specification.new do |s| s.extra_rdoc_files = %w( README ) s.rdoc_options.concat ['--main', 'README'] - s.add_dependency('activesupport', "= #{ActiveResource::VERSION::STRING}") - s.add_dependency('activemodel', "= #{ActiveResource::VERSION::STRING}") + s.add_dependency('activesupport', version) + s.add_dependency('activemodel', version) end diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec index 89e8dca278..a4609789a6 100644 --- a/activesupport/activesupport.gemspec +++ b/activesupport/activesupport.gemspec @@ -1,10 +1,9 @@ -$:.unshift "lib" -require "active_support/version" +version = File.read("../RAILS_VERSION").strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'activesupport' - s.version = ActiveSupport::VERSION::STRING + s.version = version s.summary = 'A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.' s.description = 'A toolkit of support libraries and Ruby core extensions extracted from the Rails framework. Rich support for multibyte strings, internationalization, time zones, and testing.' s.required_ruby_version = '>= 1.8.7' diff --git a/rails.gemspec b/rails.gemspec index 0cd4540ec3..58a08f1446 100644 --- a/rails.gemspec +++ b/rails.gemspec @@ -1,10 +1,9 @@ -$:.unshift "railties/lib" -require "rails/version" +version = File.read("RAILS_VERSION").strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'rails' - s.version = Rails::VERSION::STRING + s.version = version s.summary = 'Full-stack web application framework.' s.description = 'Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity. It encourages beautiful code by favoring convention over configuration.' s.required_ruby_version = '>= 1.8.7' @@ -17,11 +16,11 @@ Gem::Specification.new do |s| s.files = [] s.require_path = [] - 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('activesupport', version) + s.add_dependency('actionpack', version) + s.add_dependency('activerecord', version) + s.add_dependency('activeresource', version) + s.add_dependency('actionmailer', version) + s.add_dependency('railties', version) s.add_dependency('bundler', '>= 0.9.8') end diff --git a/railties/railties.gemspec b/railties/railties.gemspec index 7b17642667..c42ed9b891 100644 --- a/railties/railties.gemspec +++ b/railties/railties.gemspec @@ -1,10 +1,9 @@ -$:.unshift "lib" -require "rails/version" +version = File.read("../RAILS_VERSION").strip Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'railties' - s.version = Rails::VERSION::STRING + s.version = version s.summary = 'Tools for creating, working with, and running Rails applications.' s.description = 'Rails internals: application bootup, plugins, generators, and rake tasks.' s.required_ruby_version = '>= 1.8.7' @@ -25,6 +24,6 @@ Gem::Specification.new do |s| s.add_dependency('rake', '>= 0.8.3') s.add_dependency('thor', '~> 0.13.4') - s.add_dependency('activesupport', "= #{Rails::VERSION::STRING}") - s.add_dependency('actionpack', "= #{Rails::VERSION::STRING}") + s.add_dependency('activesupport', version) + s.add_dependency('actionpack', version) end -- cgit v1.2.3