diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/gem_dependency.rb | 31 | ||||
-rw-r--r-- | railties/lib/rails/plugin.rb | 10 |
2 files changed, 24 insertions, 17 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 30bdf416fc..4cac7f725a 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -98,27 +98,26 @@ module Rails self.name == other.name && self.requirement == other.requirement end -private ################################################################### - def specification @spec ||= Gem.source_index.search(Gem::Dependency.new(@name, @requirement)).sort_by { |s| s.version }.last end - def gem_command - RUBY_PLATFORM =~ /win32/ ? 'gem.bat' : 'gem' - end + private + def gem_command + RUBY_PLATFORM =~ /win32/ ? 'gem.bat' : 'gem' + end - def install_command - cmd = %w(install) << @name - cmd << "--version" << %("#{@requirement.to_s}") if @requirement - cmd << "--source" << @source if @source - cmd - end + def install_command + cmd = %w(install) << @name + cmd << "--version" << %("#{@requirement.to_s}") if @requirement + cmd << "--source" << @source if @source + cmd + end - def unpack_command - cmd = %w(unpack) << @name - cmd << "--version" << %("#{@requirement.to_s}") if @requirement - cmd - end + def unpack_command + cmd = %w(unpack) << @name + cmd << "--version" << %("#{@requirement.to_s}") if @requirement + cmd + end end end diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 256f4b0132..a54ab85dbe 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -74,10 +74,18 @@ module Rails File.join(directory, 'lib') end - def init_path + def classic_init_path File.join(directory, 'init.rb') end + def gem_init_path + File.join(directory, 'rails', 'init.rb') + end + + def init_path + File.file?(gem_init_path) ? gem_init_path : classic_init_path + end + def has_lib_directory? File.directory?(lib_path) end |