From 9eab435631e1b0a659126d068972ee88cff160de Mon Sep 17 00:00:00 2001 From: "J.D. Hollis" Date: Tue, 30 Jun 2009 08:58:35 -0400 Subject: Only check for built extensions on gem dependencies that are in vendor/gems. [#2825 state:resolved] Signed-off-by: Yehuda Katz + Carl Lerche --- railties/lib/rails/gem_dependency.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 3cc75494e4..06d830ba24 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -122,10 +122,14 @@ module Rails def built? return false unless frozen? - specification.extensions.each do |ext| - makefile = File.join(unpacked_gem_directory, File.dirname(ext), 'Makefile') - return false unless File.exists?(makefile) + + if vendor_gem? + specification.extensions.each do |ext| + makefile = File.join(unpacked_gem_directory, File.dirname(ext), 'Makefile') + return false unless File.exists?(makefile) + end end + true end -- cgit v1.2.3 From 913bb2f4c2feb79dcbc9ed2c0fb1ef6d436f7d02 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 2 Jul 2009 15:47:11 -0700 Subject: Modify the Rails::Application::Path object to allow for more concise path definition. --- railties/lib/rails/paths.rb | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index d2f6d83659..ca56199cbc 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -6,8 +6,8 @@ module Rails def method_missing(id, *args) name = id.to_s - if name =~ /^(.*)=$/ - @children[$1] = Path.new(args.first, @root) + if name =~ /^(.*)=$/ || args.any? + @children[$1 || name] = Path.new(@root, *args) elsif path = @children[name] path else @@ -28,17 +28,15 @@ module Rails # TODO: Move logic from set_root_path initializer @path = File.expand_path(path) @root = self - @load_once, @eager_load, @all_paths = [], [], [] + @all_paths = [] end def load_once - @load_once.uniq! - @load_once + all_paths.map { |path| path.paths if path.load_once? }.compact.flatten.uniq end def eager_load - @eager_load.uniq! - @eager_load + all_paths.map { |path| path.paths if path.eager_load? }.compact.flatten.uniq end def all_paths @@ -47,7 +45,7 @@ module Rails end def load_paths - all_paths.map { |path| path.paths }.flatten + all_paths.map { |path| path.paths if path.load_path? }.compact.flatten.uniq end def add_to_load_path @@ -55,6 +53,14 @@ module Rails $LOAD_PATH.unshift(path) if File.directory?(path) end end + + def push(*) + raise "Application root can only have one physical path" + end + + alias unshift push + alias << push + alias concat push end class Path @@ -63,11 +69,18 @@ module Rails attr_reader :path attr_accessor :glob - def initialize(path, root) + def initialize(root, *paths) + @options = paths.extract_options! @children = {} @root = root - @paths = [path].flatten - @glob = "**/*.rb" + @paths = paths.flatten + @glob = @options[:glob] || "**/*.rb" + + @load_once = @options[:load_once] + @eager_load = @options[:eager_load] + @load_path = @options[:load_path] || @eager_load + + @root.all_paths << self end def push(path) @@ -86,7 +99,6 @@ module Rails def load_once! @load_once = true - @root.load_once.push *self.paths end def load_once? @@ -95,8 +107,7 @@ module Rails def eager_load! @eager_load = true - @root.all_paths << self - @root.eager_load.push *self.paths + @load_path = true end def eager_load? @@ -105,7 +116,6 @@ module Rails def load_path! @load_path = true - @root.all_paths << self end def load_path? -- cgit v1.2.3 From 940aad225af0b963f435a0bf015daece2218d502 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 2 Jul 2009 15:49:35 -0700 Subject: Compact the way application paths are defined --- railties/lib/rails/configuration.rb | 40 ++++++++++++------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index d877915460..1a2f217d20 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -62,33 +62,19 @@ module Rails end @paths = Rails::Application::Root.new(root_path) - @paths.app = "app" - @paths.app.metals = "app/metal" - @paths.app.models = "app/models" - @paths.app.controllers = "app/controllers" - @paths.app.helpers = "app/helpers" - @paths.app.services = "app/services" - @paths.lib = "lib" - @paths.vendor = "vendor" - @paths.vendor.plugins = "vendor/plugins" - @paths.cache = "tmp/cache" - @paths.config = "config" - @paths.config.locales = "config/locales" - @paths.config.environments = "config/environments" - - @paths.app.controllers.concat builtin_directories - - @paths.app.load_path! - @paths.app.metals.load_path! - @paths.app.models.eager_load! - @paths.app.controllers.eager_load! - @paths.app.helpers.eager_load! - @paths.app.services.load_path! - @paths.app.metals.eager_load! - @paths.lib.load_path! - @paths.vendor.load_path! - - @paths.config.environments.glob = "#{RAILS_ENV}.rb" + @paths.app "app", :load_path => true + @paths.app.metals "app/metal", :eager_load => true + @paths.app.models "app/models", :eager_load => true + @paths.app.controllers "app/controllers", builtin_directories, :eager_load => true + @paths.app.helpers "app/helpers", :eager_load => true + @paths.app.services "app/services", :load_path => true + @paths.lib "lib", :load_path => true + @paths.vendor "vendor", :load_path => true + @paths.vendor.plugins "vendor/plugins" + @paths.cache "tmp/cache" + @paths.config "config" + @paths.config.locales "config/locales" + @paths.config.environments "config/environments", :glob => "#{RAILS_ENV}.rb" RAILS_ROOT.replace root_path end -- cgit v1.2.3 From 378a65a909439ebca909125fdfada23ed89cec63 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 2 Jul 2009 17:52:46 -0700 Subject: Added tests for the :install_gem_spec_stubs initializer --- railties/lib/initializer.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index cd23158e98..560105670f 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -125,11 +125,8 @@ module Rails if Rails.vendor_rails? begin; require "rubygems"; rescue LoadError; return; end - stubs = %w(rails activesupport activerecord actionpack actionmailer activeresource) - stubs.reject! { |s| Gem.loaded_specs.key?(s) } - - stubs.each do |stub| - Gem.loaded_specs[stub] = Gem::Specification.new do |s| + %w(rails activesupport activerecord actionpack actionmailer activeresource).each do |stub| + Gem.loaded_specs[stub] ||= Gem::Specification.new do |s| s.name = stub s.version = Rails::VERSION::STRING s.loaded_from = "" -- cgit v1.2.3 From 3c1dab72259d01c6335bf359d7f9b3af69d45bb4 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Fri, 3 Jul 2009 12:23:57 +0100 Subject: Revert "Modify the Rails::Application::Path object to allow for more concise path definition." This reverts commit 913bb2f4c2feb79dcbc9ed2c0fb1ef6d436f7d02. Reason : The server does not start --- railties/lib/rails/paths.rb | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index ca56199cbc..d2f6d83659 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -6,8 +6,8 @@ module Rails def method_missing(id, *args) name = id.to_s - if name =~ /^(.*)=$/ || args.any? - @children[$1 || name] = Path.new(@root, *args) + if name =~ /^(.*)=$/ + @children[$1] = Path.new(args.first, @root) elsif path = @children[name] path else @@ -28,15 +28,17 @@ module Rails # TODO: Move logic from set_root_path initializer @path = File.expand_path(path) @root = self - @all_paths = [] + @load_once, @eager_load, @all_paths = [], [], [] end def load_once - all_paths.map { |path| path.paths if path.load_once? }.compact.flatten.uniq + @load_once.uniq! + @load_once end def eager_load - all_paths.map { |path| path.paths if path.eager_load? }.compact.flatten.uniq + @eager_load.uniq! + @eager_load end def all_paths @@ -45,7 +47,7 @@ module Rails end def load_paths - all_paths.map { |path| path.paths if path.load_path? }.compact.flatten.uniq + all_paths.map { |path| path.paths }.flatten end def add_to_load_path @@ -53,14 +55,6 @@ module Rails $LOAD_PATH.unshift(path) if File.directory?(path) end end - - def push(*) - raise "Application root can only have one physical path" - end - - alias unshift push - alias << push - alias concat push end class Path @@ -69,18 +63,11 @@ module Rails attr_reader :path attr_accessor :glob - def initialize(root, *paths) - @options = paths.extract_options! + def initialize(path, root) @children = {} @root = root - @paths = paths.flatten - @glob = @options[:glob] || "**/*.rb" - - @load_once = @options[:load_once] - @eager_load = @options[:eager_load] - @load_path = @options[:load_path] || @eager_load - - @root.all_paths << self + @paths = [path].flatten + @glob = "**/*.rb" end def push(path) @@ -99,6 +86,7 @@ module Rails def load_once! @load_once = true + @root.load_once.push *self.paths end def load_once? @@ -107,7 +95,8 @@ module Rails def eager_load! @eager_load = true - @load_path = true + @root.all_paths << self + @root.eager_load.push *self.paths end def eager_load? @@ -116,6 +105,7 @@ module Rails def load_path! @load_path = true + @root.all_paths << self end def load_path? -- cgit v1.2.3 From a4bdc00fec623f72592e663e6d7830eea0bc6ea4 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Fri, 3 Jul 2009 12:24:26 +0100 Subject: Revert "Compact the way application paths are defined" This reverts commit 940aad225af0b963f435a0bf015daece2218d502. Reason : The server does not start --- railties/lib/rails/configuration.rb | 40 +++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 1a2f217d20..d877915460 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -62,19 +62,33 @@ module Rails end @paths = Rails::Application::Root.new(root_path) - @paths.app "app", :load_path => true - @paths.app.metals "app/metal", :eager_load => true - @paths.app.models "app/models", :eager_load => true - @paths.app.controllers "app/controllers", builtin_directories, :eager_load => true - @paths.app.helpers "app/helpers", :eager_load => true - @paths.app.services "app/services", :load_path => true - @paths.lib "lib", :load_path => true - @paths.vendor "vendor", :load_path => true - @paths.vendor.plugins "vendor/plugins" - @paths.cache "tmp/cache" - @paths.config "config" - @paths.config.locales "config/locales" - @paths.config.environments "config/environments", :glob => "#{RAILS_ENV}.rb" + @paths.app = "app" + @paths.app.metals = "app/metal" + @paths.app.models = "app/models" + @paths.app.controllers = "app/controllers" + @paths.app.helpers = "app/helpers" + @paths.app.services = "app/services" + @paths.lib = "lib" + @paths.vendor = "vendor" + @paths.vendor.plugins = "vendor/plugins" + @paths.cache = "tmp/cache" + @paths.config = "config" + @paths.config.locales = "config/locales" + @paths.config.environments = "config/environments" + + @paths.app.controllers.concat builtin_directories + + @paths.app.load_path! + @paths.app.metals.load_path! + @paths.app.models.eager_load! + @paths.app.controllers.eager_load! + @paths.app.helpers.eager_load! + @paths.app.services.load_path! + @paths.app.metals.eager_load! + @paths.lib.load_path! + @paths.vendor.load_path! + + @paths.config.environments.glob = "#{RAILS_ENV}.rb" RAILS_ROOT.replace root_path end -- cgit v1.2.3