From ab321268f86d9013cbd4ecd0b5f46e7b05ec55a9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 22 Apr 2009 16:10:49 -0700 Subject: No more free lunch --- railties/lib/rails/plugin.rb | 10 ++++++---- railties/lib/rails/rack/metal.rb | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 80deb73bbb..e66166306a 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,3 +1,5 @@ +require 'active_support/core_ext/kernel/reporting' + module Rails # The Plugin class should be an object which provides the following methods: # @@ -35,10 +37,10 @@ module Rails def load_paths report_nonexistant_or_empty_plugin! unless valid? - returning [] do |load_paths| - load_paths << lib_path if has_lib_directory? - load_paths << app_paths if has_app_directory? - end.flatten + load_paths = [] + load_paths << lib_path if has_lib_directory? + load_paths << app_paths if has_app_directory? + load_paths.flatten end # Evaluates a plugin's init.rb file. diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb index adc43da864..7a616c7911 100644 --- a/railties/lib/rails/rack/metal.rb +++ b/railties/lib/rails/rack/metal.rb @@ -1,4 +1,5 @@ require 'active_support/ordered_hash' +require 'active_support/core_ext/class/attribute_accessors' module Rails module Rack -- cgit v1.2.3 From f5d720fb96f2e085acc4ed17f63272c4d38e567e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 22 Apr 2009 16:41:06 -0700 Subject: Opt in to Dependencies --- railties/lib/rails/plugin.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index e66166306a..dd840ef058 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/kernel/reporting' +require 'active_support/dependencies' module Rails # The Plugin class should be an object which provides the following methods: -- cgit v1.2.3 From cbcc0ca57b0ea713d7d32364b599d88f2bef6d92 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 24 Apr 2009 10:41:45 -0700 Subject: Use Symbol#to_proc in rails plugin internals --- railties/lib/rails/plugin.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index dd840ef058..63864058ee 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/kernel/reporting' +require 'active_support/core_ext/symbol' require 'active_support/dependencies' module Rails -- cgit v1.2.3 From b825bef74cdde2a29ee050a5ddf4034633abcfe0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 28 Apr 2009 17:58:51 -0700 Subject: Fix missing core extension dependencies --- railties/lib/rails/plugin.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 63864058ee..bc28bec57e 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,3 +1,4 @@ +require 'active_support' require 'active_support/core_ext/kernel/reporting' require 'active_support/core_ext/symbol' require 'active_support/dependencies' -- cgit v1.2.3 From acd5db300b755d5abae2748f239441fb865c6b62 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 28 Apr 2009 18:21:03 -0700 Subject: Rejig active support dependencies to behave better with the boot process --- railties/lib/rails/backtrace_cleaner.rb | 3 +++ railties/lib/rails/plugin.rb | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/backtrace_cleaner.rb b/railties/lib/rails/backtrace_cleaner.rb index 923ed8b31d..1605429e8b 100644 --- a/railties/lib/rails/backtrace_cleaner.rb +++ b/railties/lib/rails/backtrace_cleaner.rb @@ -1,3 +1,6 @@ +require 'active_support/backtrace_cleaner' +require 'rails/gem_dependency' + module Rails class BacktraceCleaner < ActiveSupport::BacktraceCleaner ERB_METHOD_SIG = /:in `_run_erb_.*/ diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index bc28bec57e..0f924724cd 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,8 +1,3 @@ -require 'active_support' -require 'active_support/core_ext/kernel/reporting' -require 'active_support/core_ext/symbol' -require 'active_support/dependencies' - module Rails # The Plugin class should be an object which provides the following methods: # -- cgit v1.2.3 From 599f2cfb4a0e0ec4135265bf5c56b83f1450beea Mon Sep 17 00:00:00 2001 From: David Dollar Date: Wed, 29 Apr 2009 01:22:54 -0400 Subject: Attempt to deal with more cases of gems with native components. This commit adds a rudimentary check for 'unbuilt' gems, so that we can abort the application load if there are any gems that have native components that have not yet been built. The rake task gems:build has now only builds 'unbuilt' gems as a result. The rake task gems:build:force has been added to deal with cases of incomplete builds, or any case where you need to force the build of all of your gems. Changes the gems:build task to get its gem list by parsing directory entries in vendor/gems, which sidesteps the chicken/egg issues involved with having a gem unpacked into vendor/gems without before its native bits are compiled. [#2266 state:committed] Signed-off-by: Jeremy Kemper --- railties/lib/rails/gem_dependency.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 3062a77104..ee3d0d81ba 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -29,6 +29,15 @@ module Rails end end + def self.from_directory_name(directory_name) + directory_name_parts = File.basename(directory_name).split('-') + name = directory_name_parts[0..-2].join('-') + version = directory_name_parts.last + self.new(name, :version => version) + rescue ArgumentError => e + raise "Unable to determine gem name and version from '#{directory_name}'" + end + def initialize(name, options = {}) require 'rubygems' unless Object.const_defined?(:Gem) @@ -101,8 +110,12 @@ module Rails end def built? - # TODO: If Rubygems ever gives us a way to detect this, we should use it - false + 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) + end + true end def framework_gem? @@ -155,9 +168,9 @@ module Rails specification && File.exists?(unpacked_gem_directory) end - def build + def build(options={}) require 'rails/gem_builder' - unless built? + if options[:force] || !built? return unless File.exists?(unpacked_specification_filename) spec = YAML::load_file(unpacked_specification_filename) Rails::GemBuilder.new(spec, unpacked_gem_directory).build_extensions -- cgit v1.2.3 From e3891601d137a400722cfd0f941b9195b0a8217b Mon Sep 17 00:00:00 2001 From: Tim Connor Date: Mon, 4 May 2009 20:11:24 -0500 Subject: fix problems with requires in metal choking under development reloading [#2579 state:resolved] Signed-off-by: Joshua Peek --- railties/lib/rails/rack/metal.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb index 7a616c7911..b031be29af 100644 --- a/railties/lib/rails/rack/metal.rb +++ b/railties/lib/rails/rack/metal.rb @@ -1,5 +1,6 @@ require 'active_support/ordered_hash' require 'active_support/core_ext/class/attribute_accessors' +require 'active_support/dependencies' module Rails module Rack @@ -27,7 +28,7 @@ module Rails load_list.map do |requested_metal| if metal = all_metals[requested_metal] - require metal + require_dependency metal requested_metal.constantize end end.compact -- cgit v1.2.3 From e8550ee0329586b32de425e905c7af7e65bc78a8 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 13 May 2009 01:10:37 -0700 Subject: Cherry-pick core extensions --- railties/lib/rails/plugin.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 0f924724cd..e66166306a 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,3 +1,5 @@ +require 'active_support/core_ext/kernel/reporting' + module Rails # The Plugin class should be an object which provides the following methods: # -- cgit v1.2.3 From 4fa871654dc6e591c08cbc53e7eac2e008056fee Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sat, 16 May 2009 12:28:25 -0700 Subject: Get Railties passing again --- railties/lib/rails/plugin/loader.rb | 12 ++++++------ railties/lib/rails/plugin/locator.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin/loader.rb b/railties/lib/rails/plugin/loader.rb index 66e01d70da..bc22dfc591 100644 --- a/railties/lib/rails/plugin/loader.rb +++ b/railties/lib/rails/plugin/loader.rb @@ -24,7 +24,7 @@ module Rails # Returns the plugins that are in engine-form (have an app/ directory) def engines - @engines ||= plugins.select(&:engine?) + @engines ||= plugins.select {|plugin| plugin.engine? } end # Returns all the plugins that could be found by the current locators. @@ -66,7 +66,7 @@ module Rails end def engine_metal_paths - engines.collect(&:metal_path) + engines.collect {|engine| engine.metal_path } end protected @@ -79,18 +79,18 @@ module Rails end def add_engine_routing_configurations - engines.select(&:routed?).collect(&:routing_file).each do |routing_file| + engines.select {|engine| engine.routed? }.map {|engine| engine.routing_file }.each do |routing_file| ActionController::Routing::Routes.add_configuration_file(routing_file) end end def add_engine_controller_paths - ActionController::Routing.controller_paths += engines.collect(&:controller_path) + ActionController::Routing.controller_paths += engines.collect {|engine| engine.controller_path } end def add_engine_view_paths # reverse it such that the last engine can overwrite view paths from the first, like with routes - paths = ActionView::PathSet.new(engines.collect(&:view_path).reverse) + paths = ActionView::PathSet.new(engines.collect {|engine| engine.view_path }.reverse) ActionController::Base.view_paths.concat(paths) ActionMailer::Base.view_paths.concat(paths) if configuration.frameworks.include?(:action_mailer) end @@ -170,7 +170,7 @@ module Rails # so we load all in alphabetical order. If it is an empty array, we load no plugins, if it is # non empty, we load the named plugins in the order specified. def registered_plugin_names - configuration.plugins ? configuration.plugins.map(&:to_s) : nil + configuration.plugins ? configuration.plugins.map {|plugin| plugin.to_s } : nil end def loaded?(plugin_name) diff --git a/railties/lib/rails/plugin/locator.rb b/railties/lib/rails/plugin/locator.rb index a6fc388a8e..1057c004e0 100644 --- a/railties/lib/rails/plugin/locator.rb +++ b/railties/lib/rails/plugin/locator.rb @@ -25,7 +25,7 @@ module Rails end def plugin_names - plugins.map(&:name) + plugins.map {|plugin| plugin.name } end end -- cgit v1.2.3 From 0bdef30f35501953ffdcb34f1c8d3a1e23f9434d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 19 May 2009 12:19:58 -0700 Subject: Lazy-require Kernel#silence_warnings --- railties/lib/rails/plugin.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index e66166306a..49ec5c7fba 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,5 +1,3 @@ -require 'active_support/core_ext/kernel/reporting' - module Rails # The Plugin class should be an object which provides the following methods: # @@ -141,6 +139,7 @@ module Rails def evaluate_init_rb(initializer) if has_init_file? + require 'active_support/core_ext/kernel/reporting' silence_warnings do # Allow plugins to reference the current configuration object config = initializer.configuration -- cgit v1.2.3