Permalink
Browse files

Sometimes gemspecs have absolute paths in them that are too long

Rubygems can't handle building a gem if the path is too long, so we
make the absolute paths in the gemspec relative and then it works
  • Loading branch information...
1 parent ec33758 commit 8c170299a23e77ecd2c833aa400c1959d04a2b40 @indirect indirect committed Apr 22, 2010
Showing with 13 additions and 17 deletions.
  1. +13 −1 lib/bundler/source.rb
  2. +0 −16 spec/install/git_spec.rb
View
@@ -254,7 +254,19 @@ def install(spec)
private
def generate_bin(spec)
- gem_dir = spec.full_gem_path
+ gem_dir = Pathname.new(spec.full_gem_path)
+
+ # Some gem authors put absolute paths in their gemspec
+ # and we have to save them from themselves
+ spec.files = spec.files.map do |p|
+ next if File.directory?(p)
+ begin
+ Pathname.new(p).relative_path_from(gem_dir).to_s
+ rescue ArgumentError
+ p
+ end
+ end.compact
+
gem_file = Dir.chdir(gem_dir){ Gem::Builder.new(spec).build }
installer = Gem::Installer.new File.join(gem_dir, gem_file),
View
@@ -307,20 +307,4 @@
should_be_installed "forced 1.0"
end
- it "handles long gem names and full shas with C extensions" do
- build_git "some_gem_with_a_really_stupidly_long_name_argh" do |s|
- s.executables = "stupid"
- s.add_c_extension
- end
- sha = revision_for(lib_path("some_gem_with_a_really_stupidly_long_name_argh-1.0"))
- install_gemfile <<-G
- gem "some_gem_with_a_really_stupidly_long_name_argh",
- :git => "#{lib_path("some_gem_with_a_really_stupidly_long_name_argh-1.0")}",
- :ref => "#{sha}"
- G
- should_be_installed "some_gem_with_a_really_stupidly_long_name_argh 1.0"
-
- bundle "exec stupid"
- out.should == "1.0"
- end
end

0 comments on commit 8c17029

Please sign in to comment.