Rails 2.1.1
Among other things, a security fix.
This commit is contained in:
parent
d2c4c8737c
commit
d4f97345db
354 changed files with 21027 additions and 3072 deletions
|
@ -23,9 +23,13 @@ module Rails
|
|||
@unpack_directory = nil
|
||||
end
|
||||
|
||||
def unpacked_paths
|
||||
Dir[File.join(self.class.unpacked_path, "#{@name}-#{@version || "*"}")]
|
||||
end
|
||||
|
||||
def add_load_paths
|
||||
return if @loaded || @load_paths_added
|
||||
unpacked_paths = Dir[File.join(self.class.unpacked_path, "#{@name}-#{@version || "*"}")]
|
||||
unpacked_paths = self.unpacked_paths
|
||||
if unpacked_paths.empty?
|
||||
args = [@name]
|
||||
args << @requirement.to_s if @requirement
|
||||
|
@ -39,7 +43,7 @@ module Rails
|
|||
@load_paths_added = true
|
||||
rescue Gem::LoadError
|
||||
end
|
||||
|
||||
|
||||
def dependencies
|
||||
all_dependencies = specification.dependencies.map do |dependency|
|
||||
GemDependency.new(dependency.name, :requirement => dependency.version_requirements)
|
||||
|
@ -47,14 +51,14 @@ module Rails
|
|||
all_dependencies += all_dependencies.map(&:dependencies).flatten
|
||||
all_dependencies.uniq
|
||||
end
|
||||
|
||||
|
||||
def gem_dir(base_directory)
|
||||
File.join(base_directory, specification.full_name)
|
||||
end
|
||||
|
||||
def load
|
||||
return if @loaded || @load_paths_added == false
|
||||
require(@lib || @name)
|
||||
require(@lib || @name) unless @lib == false
|
||||
@loaded = true
|
||||
rescue LoadError
|
||||
puts $!.to_s
|
||||
|
@ -78,13 +82,13 @@ module Rails
|
|||
puts cmd
|
||||
puts %x(#{cmd})
|
||||
end
|
||||
|
||||
|
||||
def unpack_to(directory)
|
||||
FileUtils.mkdir_p directory
|
||||
Dir.chdir directory do
|
||||
Gem::GemRunner.new.run(unpack_command)
|
||||
end
|
||||
|
||||
|
||||
# copy the gem's specification into GEMDIR/.specification so that
|
||||
# we can access information about the gem on deployment systems
|
||||
# without having the gem installed
|
||||
|
@ -98,27 +102,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
|
||||
|
||||
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
|
||||
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 unpack_command
|
||||
cmd = %w(unpack) << @name
|
||||
cmd << "--version" << %("#{@requirement.to_s}") if @requirement
|
||||
cmd
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue