Permalink
Browse files

Add --gem-package-prefix option

Allows the prefix of packages to change to a user specified value.

Useful if you do not want to conflict with other rubygem packages,
or want to install to a special ruby instance

Fixes #84
  • Loading branch information...
1 parent dda5a0e commit f284420c8ed6def82208de1b1e3714f71e66142f Corry Haines committed with Jul 28, 2011
Showing with 11 additions and 2 deletions.
  1. +11 −2 lib/fpm/source/gem.rb
View
13 lib/fpm/source/gem.rb
@@ -10,6 +10,10 @@ def self.flags(opts, settings)
"The directory to install gem executables") do |path|
settings.source[:bin_path] = path
end
+ opts.on("--package-prefix PREFIX",
+ "Prefix for gem packages") do |package_prefix|
+ settings.source[:package_prefix] = package_prefix
+ end
end # def flags
def get_source(params)
@@ -70,7 +74,12 @@ def get_metadata
self[field.to_sym] = spec.send(field) rescue "unknown"
end
- self[:name] = "rubygem#{self[:suffix]}-#{spec.name}"
+ if self[:settings][:package_prefix]
+ self[:package_prefix] = self[:settings][:package_prefix]
+ else
+ self[:package_prefix] = "rubygem"
+ end
+ self[:name] = "#{self[:package_prefix]}#{self[:suffix]}-#{spec.name}"
self[:maintainer] = spec.author
self[:url] = spec.homepage
@@ -96,7 +105,7 @@ def get_metadata
# Some reqs can be ">= a, < b" versions, let's handle that.
reqs.to_s.split(/, */).each do |req|
- self[:dependencies] << "rubygem#{self[:suffix]}-#{dep.name} #{req}"
+ self[:dependencies] << "#{self[:package_prefix]}#{self[:suffix]}-#{dep.name} #{req}"
end
end # runtime_dependencies
end # ::Gem::Package

0 comments on commit f284420

Please sign in to comment.