Группа :: Разработка/Ruby
Пакет: ruby-rails
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: railties-2.0.2-alt2.patch
Скачать
Скачать
bin/rails | 9 ++--
environments/boot.rb | 55 +-------------------
lib/rails_generator.rb | 3 -
.../generators/applications/app/app_generator.rb | 2 +-
lib/rubyprof_ext.rb | 35 ------------
lib/tasks/framework.rake | 2 +-
6 files changed, 9 insertions(+), 97 deletions(-)
diff --git a/bin/rails b/bin/rails
index ae0cc8a..a229a73 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,7 +1,8 @@
-require File.dirname(__FILE__) + '/../lib/ruby_version_check'
+#!/usr/bin/ruby
+
Signal.trap("INT") { puts; exit }
-require File.dirname(__FILE__) + '/../lib/rails/version'
+require 'rails/version'
if %w(--version -v).include? ARGV.first
puts "Rails #{Rails::VERSION::STRING}"
exit(0)
@@ -10,10 +11,10 @@ end
freeze = ARGV.any? { |option| %w(--freeze -f).include?(option) }
app_path = ARGV.first
-require File.dirname(__FILE__) + '/../lib/rails_generator'
+require 'rails_generator'
require 'rails_generator/scripts/generate'
Rails::Generator::Base.use_application_sources!
Rails::Generator::Scripts::Generate.new.run(ARGV, :generator => 'app')
-Dir.chdir(app_path) { `rake rails:freeze:gems`; puts "froze" } if freeze
\ No newline at end of file
+Dir.chdir(app_path) { `rake rails:freeze:gems`; puts "froze" } if freeze
diff --git a/environments/boot.rb b/environments/boot.rb
index 5697cc1..8087d29 100644
--- a/environments/boot.rb
+++ b/environments/boot.rb
@@ -17,7 +17,7 @@ module Rails
end
def pick_boot
- (vendor_rails? ? VendorBoot : GemBoot).new
+ (vendor_rails? ? VendorBoot : SystemBoot).new
end
def vendor_rails?
@@ -47,61 +47,10 @@ module Rails
end
end
- class GemBoot < Boot
+ class SystemBoot < Boot
def load_initializer
- self.class.load_rubygems
- load_rails_gem
require 'initializer'
end
-
- def load_rails_gem
- if version = self.class.gem_version
- gem 'rails', version
- else
- gem 'rails'
- end
- rescue Gem::LoadError => load_error
- $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
- exit 1
- end
-
- class << self
- def rubygems_version
- Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
- end
-
- def gem_version
- if defined? RAILS_GEM_VERSION
- RAILS_GEM_VERSION
- elsif ENV.include?('RAILS_GEM_VERSION')
- ENV['RAILS_GEM_VERSION']
- else
- parse_gem_version(read_environment_rb)
- end
- end
-
- def load_rubygems
- require 'rubygems'
-
- unless rubygems_version >= '0.9.4'
- $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
- exit 1
- end
-
- rescue LoadError
- $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
- exit 1
- end
-
- def parse_gem_version(text)
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
- end
-
- private
- def read_environment_rb
- File.read("#{RAILS_ROOT}/config/environment.rb")
- end
- end
end
end
diff --git a/lib/rails_generator.rb b/lib/rails_generator.rb
index 9f0ffc1..5a55084 100644
--- a/lib/rails_generator.rb
+++ b/lib/rails_generator.rb
@@ -21,9 +21,6 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-$:.unshift(File.dirname(__FILE__))
-$:.unshift(File.dirname(__FILE__) + "/../../activesupport/lib")
-
begin
require 'active_support'
rescue LoadError
diff --git a/lib/rails_generator/generators/applications/app/app_generator.rb b/lib/rails_generator/generators/applications/app/app_generator.rb
index 1dd72f3..7f0f213 100644
--- a/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -10,7 +10,7 @@ class AppGenerator < Rails::Generator::Base
default_options :db => (ENV["RAILS_DEFAULT_DATABASE"] || "sqlite3"),
:shebang => DEFAULT_SHEBANG, :freeze => false
- mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
+ mandatory_options :source => "@RAILS_DATADIR@"
def initialize(runtime_args, runtime_options = {})
super
diff --git a/lib/rubyprof_ext.rb b/lib/rubyprof_ext.rb
deleted file mode 100644
index f6e9035..0000000
--- a/lib/rubyprof_ext.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-require 'prof'
-
-module Prof #:nodoc:
- # Adapted from Shugo Maeda's unprof.rb
- def self.print_profile(results, io = $stderr)
- total = results.detect { |i|
- i.method_class.nil? && i.method_id == :"#toplevel"
- }.total_time
- total = 0.001 if total < 0.001
-
- io.puts " %% cumulative self self total"
- io.puts " time seconds seconds calls ms/call ms/call name"
-
- sum = 0.0
- for r in results
- sum += r.self_time
-
- name = if r.method_class.nil?
- r.method_id.to_s
- elsif r.method_class.is_a?(Class)
- "#{r.method_class}##{r.method_id}"
- else
- "#{r.method_class}.#{r.method_id}"
- end
- io.printf "%6.2f %8.3f %8.3f %8d %8.2f %8.2f %s\n",
- r.self_time / total * 100,
- sum,
- r.self_time,
- r.count,
- r.self_time * 1000 / r.count,
- r.total_time * 1000 / r.count,
- name
- end
- end
-end
diff --git a/lib/tasks/framework.rake b/lib/tasks/framework.rake
index ebc24f4..52cf8f6 100644
--- a/lib/tasks/framework.rake
+++ b/lib/tasks/framework.rake
@@ -84,7 +84,7 @@ namespace :rails do
desc "Add new scripts to the application script/ directory"
task :scripts do
local_base = "script"
- edge_base = "#{File.dirname(__FILE__)}/../../bin"
+ edge_base = "#{RAILTIES_PATH}/bin"
local = Dir["#{local_base}/**/*"].reject { |path| File.directory?(path) }
edge = Dir["#{edge_base}/**/*"].reject { |path| File.directory?(path) }