Skip to content
Browse files

In 9c4f003, gem installation quotes versions. Do the same for unpack …

…and update tests to reflect the change.
  • Loading branch information...
1 parent 14a65cd commit 185fe2e9cce737d69d3b47a656f3651ce152c0c1 @josh josh committed Jun 2, 2008
Showing with 16 additions and 16 deletions.
  1. +8 −8 railties/lib/rails/gem_dependency.rb
  2. +8 −8 railties/test/gem_dependency_test.rb
View
16 railties/lib/rails/gem_dependency.rb
@@ -39,15 +39,15 @@ def add_load_paths
@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)
end
all_dependencies += all_dependencies.map(&:dependencies).flatten
all_dependencies.uniq
end
-
+
def gem_dir(base_directory)
File.join(base_directory, specification.full_name)
end
@@ -78,13 +78,13 @@ def install
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
@@ -103,7 +103,7 @@ def ==(other)
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
@@ -114,11 +114,11 @@ def install_command
cmd << "--source" << @source if @source
cmd
end
-
+
def unpack_command
cmd = %w(unpack) << @name
- cmd << "--version" << "#{@requirement.to_s}" if @requirement
+ cmd << "--version" << %("#{@requirement.to_s}") if @requirement
cmd
end
@lmarlow
lmarlow added a note Jul 10, 2008

This shouldn’t be quoted since it’s run with Gem::GemRunner.new.run(unpack_command), whereas install_command is run through a shell command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
end
-end
+end
View
16 railties/test/gem_dependency_test.rb
@@ -10,13 +10,13 @@ def setup
@gem = Rails::GemDependency.new "hpricot"
@gem_with_source = Rails::GemDependency.new "hpricot", :source => "http://code.whytheluckystiff.net"
@gem_with_version = Rails::GemDependency.new "hpricot", :version => "= 0.6"
- @gem_with_lib = Rails::GemDependency.new "aws-s3", :lib => "aws/s3"
+ @gem_with_lib = Rails::GemDependency.new "aws-s3", :lib => "aws/s3"
end
def test_configuration_adds_gem_dependency
config = Rails::Configuration.new
config.gem "aws-s3", :lib => "aws/s3", :version => "0.4.0"
- assert_equal [["install", "aws-s3", "--version", "= 0.4.0"]], config.gems.collect(&:install_command)
+ assert_equal [["install", "aws-s3", "--version", '"= 0.4.0"']], config.gems.collect(&:install_command)
end
def test_gem_creates_install_command
@@ -28,39 +28,39 @@ def test_gem_with_source_creates_install_command
end
def test_gem_with_version_creates_install_command
- assert_equal ["install", "hpricot", "--version", "= 0.6"], @gem_with_version.install_command
+ assert_equal ["install", "hpricot", "--version", '"= 0.6"'], @gem_with_version.install_command
end
def test_gem_creates_unpack_command
assert_equal %w(unpack hpricot), @gem.unpack_command
end
def test_gem_with_version_unpack_install_command
- assert_equal ["unpack", "hpricot", "--version", "= 0.6"], @gem_with_version.unpack_command
+ assert_equal ["unpack", "hpricot", "--version", '"= 0.6"'], @gem_with_version.unpack_command
end
def test_gem_adds_load_paths
@gem.expects(:gem).with(@gem.name)
@gem.add_load_paths
end
-
+
def test_gem_with_version_adds_load_paths
@gem_with_version.expects(:gem).with(@gem_with_version.name, @gem_with_version.requirement.to_s)
@gem_with_version.add_load_paths
end
-
+
def test_gem_loading
@gem.expects(:gem).with(@gem.name)
@gem.expects(:require).with(@gem.name)
@gem.add_load_paths
@gem.load
end
-
+
def test_gem_with_lib_loading
@gem_with_lib.expects(:gem).with(@gem_with_lib.name)
@gem_with_lib.expects(:require).with(@gem_with_lib.lib)
@gem_with_lib.add_load_paths
@gem_with_lib.load
end
end
-end
+end

0 comments on commit 185fe2e

Please sign in to comment.
Something went wrong with that request. Please try again.