Skip to content

Commit

Permalink
- Make 'gem' source obey --prefix (issues/21)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed Apr 26, 2011
1 parent eac451b commit 4094afd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/fpm/source/gem.rb
Expand Up @@ -91,13 +91,20 @@ def get_metadata

def make_tarball!(tar_path, builddir)
tmpdir = "#{tar_path}.dir"
installdir = "#{tmpdir}/#{::Gem::dir}"
gem = @paths.first
if self[:prefix]
installdir = "#{tmpdir}/#{self[:prefix]}"
# TODO(sissel): Overwriting @paths is bad mojo and confusing...
@paths = self[:prefix]
else
installdir = "#{tmpdir}/#{::Gem::dir}"
@paths = [ ::Gem::dir ]
end
::FileUtils.mkdir_p(installdir)
args = ["gem", "install", "--quiet", "--no-ri", "--no-rdoc",
"--install-dir", installdir, "--ignore-dependencies", @paths.first]
"--install-dir", installdir, "--ignore-dependencies", gem]
system(*args)

@paths = [ ::Gem::dir ]
tar(tar_path, ".#{@paths.first}", tmpdir)
FileUtils.rm_r(tmpdir)

Expand Down

0 comments on commit 4094afd

Please sign in to comment.