Skip to content
This repository
Browse code

Read Rails version from a file instead of modifying the load path and…

… doing requires

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
commit deb00bcb8cf88eb6420282c9af0af64fb69aeed4 1 parent 46bf2f0
Bryan Helmkamp authored March 04, 2010 jeremy committed March 04, 2010
1  RAILS_VERSION
... ...
@@ -0,0 +1 @@
  1
+3.0.0.beta1
15  Rakefile
@@ -3,15 +3,6 @@ require 'rake/rdoctask'
3 3
 require 'rake/gempackagetask'
4 4
 
5 5
 PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
6  
-PROJECTS.each { |project| $:.unshift "#{project}/lib" }
7  
-
8  
-require "active_support/version"
9  
-require "active_model/version"
10  
-require "action_pack/version"
11  
-require "action_mailer/version"
12  
-require "active_resource/version"
13  
-require "active_record/version"
14  
-require "rails/version"
15 6
 
16 7
 desc 'Run all tests by default'
17 8
 task :default => %w(test test:isolated)
@@ -130,6 +121,12 @@ task :pdoc => :rdoc do
130 121
 end
131 122
 
132 123
 task :update_versions do
  124
+  require File.dirname(__FILE__) + "/version"
  125
+
  126
+  File.open("RAILS_VERSION", "w") do |f|
  127
+    f.write Rails::VERSION::STRING + "\n"
  128
+  end
  129
+
133 130
   constants = {
134 131
     "activesupport"   => "ActiveSupport",
135 132
     "activemodel"     => "ActiveModel",
7  actionmailer/actionmailer.gemspec
... ...
@@ -1,10 +1,9 @@
1  
-$:.unshift "lib"
2  
-require "action_mailer/version"
  1
+version = File.read("../RAILS_VERSION").strip
3 2
 
4 3
 Gem::Specification.new do |s|
5 4
   s.platform    = Gem::Platform::RUBY
6 5
   s.name        = 'actionmailer'
7  
-  s.version     = ActionMailer::VERSION::STRING
  6
+  s.version     = version
8 7
   s.summary     = 'Email composition, delivery, and receiving framework (part of Rails).'
9 8
   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.'
10 9
   s.required_ruby_version = '>= 1.8.7'
@@ -20,7 +19,7 @@ Gem::Specification.new do |s|
20 19
 
21 20
   s.has_rdoc = true
22 21
 
23  
-  s.add_dependency('actionpack',  "= #{ActionMailer::VERSION::STRING}")
  22
+  s.add_dependency('actionpack',  version)
24 23
   s.add_dependency('mail',        '~> 2.1.3')
25 24
   s.add_dependency('text-format', '~> 1.0.0')
26 25
 end
9  actionpack/actionpack.gemspec
... ...
@@ -1,10 +1,9 @@
1  
-$:.unshift "lib"
2  
-require "action_pack/version"
  1
+version = File.read("../RAILS_VERSION").strip
3 2
 
4 3
 Gem::Specification.new do |s|
5 4
   s.platform    = Gem::Platform::RUBY
6 5
   s.name        = 'actionpack'
7  
-  s.version     = ActionPack::VERSION::STRING
  6
+  s.version     = version
8 7
   s.summary     = 'Web-flow and rendering framework putting the VC in MVC (part of Rails).'
9 8
   s.description = 'Web apps on Rails. Simple, battle-tested conventions for building and testing MVC web applications. Works with any Rack-compatible server.'
10 9
   s.required_ruby_version = '>= 1.8.7'
@@ -20,8 +19,8 @@ Gem::Specification.new do |s|
20 19
 
21 20
   s.has_rdoc = true
22 21
 
23  
-  s.add_dependency('activesupport', "= #{ActionPack::VERSION::STRING}")
24  
-  s.add_dependency('activemodel',   "= #{ActionPack::VERSION::STRING}")
  22
+  s.add_dependency('activesupport', version)
  23
+  s.add_dependency('activemodel',   version)
25 24
   s.add_dependency('rack',          '~> 1.1.0')
26 25
   s.add_dependency('rack-test',     '~> 0.5.0')
27 26
   s.add_dependency('rack-mount',    '~> 0.5.1')
7  activemodel/activemodel.gemspec
... ...
@@ -1,10 +1,9 @@
1  
-$:.unshift "lib"
2  
-require "active_model/version"
  1
+version = File.read("../RAILS_VERSION").strip
3 2
 
4 3
 Gem::Specification.new do |s|
5 4
   s.platform = Gem::Platform::RUBY
6 5
   s.name = 'activemodel'
7  
-  s.version = ActiveModel::VERSION::STRING
  6
+  s.version = version
8 7
   s.summary = 'A toolkit for building modeling frameworks (part of Rails).'
9 8
   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.'
10 9
   s.required_ruby_version = '>= 1.8.7'
@@ -16,7 +15,7 @@ Gem::Specification.new do |s|
16 15
 
17 16
   s.has_rdoc = true
18 17
 
19  
-  s.add_dependency('activesupport', "= #{ActiveModel::VERSION::STRING}")
  18
+  s.add_dependency('activesupport', version)
20 19
 
21 20
   s.require_path = 'lib'
22 21
   s.files = Dir["CHANGELOG", "MIT-LICENSE", "README", "lib/**/*"]
9  activerecord/activerecord.gemspec
... ...
@@ -1,10 +1,9 @@
1  
-$:.unshift "lib"
2  
-require "active_record/version"
  1
+version = File.read("../RAILS_VERSION").strip
3 2
 
4 3
 Gem::Specification.new do |s|
5 4
   s.platform    = Gem::Platform::RUBY
6 5
   s.name        = 'activerecord'
7  
-  s.version     = ActiveRecord::VERSION::STRING
  6
+  s.version     = version
8 7
   s.summary     = 'Object-relational mapper framework (part of Rails).'
9 8
   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.'
10 9
   s.required_ruby_version = '>= 1.8.7'
@@ -21,7 +20,7 @@ Gem::Specification.new do |s|
21 20
   s.extra_rdoc_files = %w( README )
22 21
   s.rdoc_options.concat ['--main',  'README']
23 22
 
24  
-  s.add_dependency('activesupport', "= #{ActiveRecord::VERSION::STRING}")
25  
-  s.add_dependency('activemodel',   "= #{ActiveRecord::VERSION::STRING}")
  23
+  s.add_dependency('activesupport', version)
  24
+  s.add_dependency('activemodel',   version)
26 25
   s.add_dependency('arel',          '~> 0.2.1')
27 26
 end
9  activeresource/activeresource.gemspec
... ...
@@ -1,10 +1,9 @@
1  
-$:.unshift "lib"
2  
-require "active_resource/version"
  1
+version = File.read("../RAILS_VERSION").strip
3 2
 
4 3
 Gem::Specification.new do |s|
5 4
   s.platform    = Gem::Platform::RUBY
6 5
   s.name        = 'activeresource'
7  
-  s.version     = ActiveResource::VERSION::STRING
  6
+  s.version     = version
8 7
   s.summary     = 'REST modeling framework (part of Rails).'
9 8
   s.description = 'REST on Rails. Wrap your RESTful web app with Ruby classes and work with them like Active Record models.'
10 9
   s.required_ruby_version = '>= 1.8.7'
@@ -21,6 +20,6 @@ Gem::Specification.new do |s|
21 20
   s.extra_rdoc_files = %w( README )
22 21
   s.rdoc_options.concat ['--main',  'README']
23 22
 
24  
-  s.add_dependency('activesupport', "= #{ActiveResource::VERSION::STRING}")
25  
-  s.add_dependency('activemodel',   "= #{ActiveResource::VERSION::STRING}")
  23
+  s.add_dependency('activesupport', version)
  24
+  s.add_dependency('activemodel',   version)
26 25
 end
5  activesupport/activesupport.gemspec
... ...
@@ -1,10 +1,9 @@
1  
-$:.unshift "lib"
2  
-require "active_support/version"
  1
+version = File.read("../RAILS_VERSION").strip
3 2
 
4 3
 Gem::Specification.new do |s|
5 4
   s.platform    = Gem::Platform::RUBY
6 5
   s.name        = 'activesupport'
7  
-  s.version     = ActiveSupport::VERSION::STRING
  6
+  s.version     = version
8 7
   s.summary     = 'A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.'
9 8
   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.'
10 9
   s.required_ruby_version = '>= 1.8.7'
17  rails.gemspec
... ...
@@ -1,10 +1,9 @@
1  
-$:.unshift "railties/lib"
2  
-require "rails/version"
  1
+version = File.read("RAILS_VERSION").strip
3 2
 
4 3
 Gem::Specification.new do |s|
5 4
   s.platform    = Gem::Platform::RUBY
6 5
   s.name        = 'rails'
7  
-  s.version     = Rails::VERSION::STRING
  6
+  s.version     = version
8 7
   s.summary     = 'Full-stack web application framework.'
9 8
   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.'
10 9
   s.required_ruby_version = '>= 1.8.7'
@@ -17,11 +16,11 @@ Gem::Specification.new do |s|
17 16
   s.files = []
18 17
   s.require_path = []
19 18
 
20  
-  s.add_dependency('activesupport',    "= #{Rails::VERSION::STRING}")
21  
-  s.add_dependency('actionpack',       "= #{Rails::VERSION::STRING}")
22  
-  s.add_dependency('activerecord',     "= #{Rails::VERSION::STRING}")
23  
-  s.add_dependency('activeresource',   "= #{Rails::VERSION::STRING}")
24  
-  s.add_dependency('actionmailer',     "= #{Rails::VERSION::STRING}")
25  
-  s.add_dependency('railties',         "= #{Rails::VERSION::STRING}")
  19
+  s.add_dependency('activesupport',    version)
  20
+  s.add_dependency('actionpack',       version)
  21
+  s.add_dependency('activerecord',     version)
  22
+  s.add_dependency('activeresource',   version)
  23
+  s.add_dependency('actionmailer',     version)
  24
+  s.add_dependency('railties',         version)
26 25
   s.add_dependency('bundler',          '>= 0.9.8')
27 26
 end
9  railties/railties.gemspec
... ...
@@ -1,10 +1,9 @@
1  
-$:.unshift "lib"
2  
-require "rails/version"
  1
+version = File.read("../RAILS_VERSION").strip
3 2
 
4 3
 Gem::Specification.new do |s|
5 4
   s.platform    = Gem::Platform::RUBY
6 5
   s.name        = 'railties'
7  
-  s.version     = Rails::VERSION::STRING
  6
+  s.version     = version
8 7
   s.summary     = 'Tools for creating, working with, and running Rails applications.'
9 8
   s.description = 'Rails internals: application bootup, plugins, generators, and rake tasks.'
10 9
   s.required_ruby_version = '>= 1.8.7'
@@ -25,6 +24,6 @@ Gem::Specification.new do |s|
25 24
 
26 25
   s.add_dependency('rake',          '>= 0.8.3')
27 26
   s.add_dependency('thor',          '~> 0.13.4')
28  
-  s.add_dependency('activesupport', "= #{Rails::VERSION::STRING}")
29  
-  s.add_dependency('actionpack',    "= #{Rails::VERSION::STRING}")
  27
+  s.add_dependency('activesupport', version)
  28
+  s.add_dependency('actionpack',    version)
30 29
 end

0 notes on commit deb00bc

Please sign in to comment.
Something went wrong with that request. Please try again.