public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fixed that boot.rb would set RAILS_GEM_VERSION twice, not respect an 
uncommented RAILS_GEM_VERSION line, and not use require_gem [DHH] Added 
rake rails:update:configs to update config/boot.rb from the latest (also 
included in rake rails:update) [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4197 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Fri Apr 07 11:21:52 -0700 2006
commit  2120651ddee58e0fed07d8af213c8c223a3aaccc
tree    9a1d2a074f1dbff0c60be6478542f89e01314889
parent  e1deb6accad581f1f56e8b3e490ed61676f58b0a
...
 
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
8
0
@@ -1,3 +1,8 @@
0
+*SVN*
0
+
0
+* Fixed that boot.rb would set RAILS_GEM_VERSION twice, not respect an uncommented RAILS_GEM_VERSION line, and not use require_gem [DHH]
0
+
0
+
0
 *1.1.1* (April 6th, 2005)
0
 
0
 * Enhances plugin#discover allowing it to discover svn:// like URIs (closes #4565) [ruben.nine@gmail.com]
...
2
3
4
 
5
6
7
8
 
9
10
11
12
13
14
15
 
 
 
 
 
16
17
18
19
 
 
 
20
21
22
 
 
23
24
25
 
 
 
 
 
 
 
 
 
 
26
27
28
29
30
31
 
 
32
33
34
35
36
37
38
 
 
...
2
3
4
5
6
7
8
9
10
11
12
13
 
 
 
 
14
15
16
17
18
19
 
 
 
20
21
22
23
 
 
24
25
26
 
 
27
28
29
30
31
32
33
34
35
36
37
 
 
 
 
 
38
39
40
 
 
41
 
42
 
43
44
0
@@ -2,38 +2,44 @@
0
 
0
 unless defined?(RAILS_ROOT)
0
   root_path = File.join(File.dirname(__FILE__), '..')
0
+
0
   unless RUBY_PLATFORM =~ /mswin32/
0
     require 'pathname'
0
     root_path = Pathname.new(root_path).cleanpath(true).to_s
0
   end
0
+
0
   RAILS_ROOT = root_path
0
 end
0
 
0
-if File.directory?("#{RAILS_ROOT}/vendor/rails")
0
- require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
0
-else
0
- require 'rubygems'
0
+unless defined?(Rails::Initializer)
0
+ if File.directory?("#{RAILS_ROOT}/vendor/rails")
0
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
0
+ else
0
+ require 'rubygems'
0
 
0
- if !defined?(RAILS_GEM_VERSION) && File.read(File.dirname(__FILE__) + '/environment.rb') =~ /RAILS_GEM_VERSION = '([\d.]+)'/
0
- RAILS_GEM_VERSION = $1
0
- end
0
+ environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
0
+ environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
0
+ rails_gem_version = $1
0
 
0
- if defined?(RAILS_GEM_VERSION)
0
- rails_gem = Gem.cache.search('rails', "=#{RAILS_GEM_VERSION}").first
0
+ if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
0
+ rails_gem = Gem.cache.search('rails', "=#{version}").first
0
 
0
- if rails_gem
0
- require rails_gem.full_gem_path + '/lib/initializer'
0
+ if rails_gem
0
+ require_gem "rails", "=#{version}"
0
+ require rails_gem.full_gem_path + '/lib/initializer'
0
+ else
0
+ STDERR.puts %(Cannot find gem for Rails =#{version}:
0
+ Install the missing gem with 'gem install -v=#{version} rails', or
0
+ change environment.rb to define RAILS_GEM_VERSION with your desired version.
0
+ )
0
+ exit 1
0
+ end
0
     else
0
- STDERR.puts %(Cannot find gem for Rails =#{RAILS_GEM_VERSION}:
0
- Install the missing gem with 'gem install -v=#{RAILS_GEM_VERSION} rails', or
0
- change environment.rb to define RAILS_GEM_VERSION with your desired version.
0
-)
0
- exit 1
0
+ require_gem "rails"
0
+ require 'initializer'
0
     end
0
- else
0
- require 'initializer'
0
   end
0
-end
0
 
0
-Rails::Initializer.run(:set_load_path)
0
+ Rails::Initializer.run(:set_load_path)
0
+end
...
71
72
73
74
75
 
 
76
77
78
...
101
102
103
 
 
 
 
 
 
 
 
104
105
106
...
71
72
73
 
 
74
75
76
77
78
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
0
@@ -71,8 +71,8 @@
0
     rm_rf "vendor/rails"
0
   end
0
 
0
- desc "Update both scripts and public/javascripts from Rails"
0
- task :update => [ "update:scripts", "update:javascripts" ]
0
+ desc "Update both configs, scripts and public/javascripts from Rails"
0
+ task :update => [ "update:scripts", "update:javascripts", "update:configs" ]
0
 
0
   namespace :update do
0
     desc "Add new scripts to the application script/ directory"
0
@@ -101,6 +101,14 @@
0
       scripts = Dir[RAILTIES_PATH + '/html/javascripts/*.js']
0
       scripts.reject!{|s| File.basename(s) == 'application.js'} if File.exists?(project_dir + 'application.js')
0
       FileUtils.cp(scripts, project_dir)
0
+ end
0
+
0
+ desc "Update boot/config.rb from your current rails install"
0
+ task :configs do
0
+ require 'railties_path'
0
+ project_dir = RAILS_ROOT + '/public/javascripts/'
0
+ scripts = Dir[RAILTIES_PATH + '/html/javascripts/*.js']
0
+ FileUtils.cp(RAILTIES_PATH + '/environments/boot.rb', RAILTIES_PATH + '/environments/boot.rb')
0
     end
0
   end
0
 end

Comments

    No one has commented yet.