Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 111 lines (86 sloc) 2.905 kB
#!/usr/bin/env ruby
#
require "rubygems"
require "optparse"
require "ostruct"
require "erb"
$: << "#{File.dirname(__FILE__)}/../lib"
require "fpm"
def main(args)
settings = OpenStruct.new
settings.exclude = []
opts = OptionParser.new do |opts|
# TODO(sissel): Maybe this should be '-o OUTPUT' ?
opts.on("-p PACKAGEFILE", "--package PACKAGEFILE",
"The package file to manage") do |path|
if path =~ /^\//
settings.package_path = path
else
settings.package_path = "#{Dir.pwd}/#{path}"
end
end
opts.on("-n PACKAGENAME", "--name PACKAGENAME",
"What name to give to the package") do |name|
settings.package_name = name
end
opts.on("-v VERSION", "--version VERSION",
"version to give the package") do |version|
settings.version = version
end
opts.on("-d DEPENDENCY", "--depends DEPENDENCY") do |dep|
settings.dependencies ||= []
settings.dependencies << dep
end
opts.on("-a ARCHITECTURE", "--architecture ARCHITECTURE") do |arch|
settings.architecture = arch
end
opts.on("-m MAINTAINER", "--maintainer MAINTAINER") do |maintainer|
settings.maintainer = maintainer
end
opts.on("-C DIRECTORY", "Change directory before searching for files") do |dir|
settings.chdir = dir
end
opts.on("-t PACKAGE_TYPE", "the type of package you want to create") do |type|
settings.package_type = type
end
opts.on("-s SOURCE_TYPE", "what to build the package from") do |st|
settings.source_type = st
end
opts.on("-S PACKAGE_SUFFIX", "which suffix to append to package and dependances") do |sfx|
settings.suffix = sfx
end
opts.on("--prefix PREFIX",
"A path to prefix files with when building the target package. This may not be necessary for all source types. For example, the 'gem' type will prefix with your gem directory (gem env | grep -A1 PATHS:)") do |prefix|
settings.prefix = prefix
end
opts.on("-e", "--edit", "Edit the specfile before building") do
settings.edit = true
end
opts.on("-x PATTERN", "--exclude PATTERN",
"Exclude paths matching pattern (according to tar --exclude)") do |pattern|
settings.exclude << pattern
end # -x / --exclude
end # OptionParser
opts.parse!(args)
ok = true
if settings.package_type.nil?
$stderr.puts "Missing package target type (no -t flag?)"
ok = false
end
if settings.source_type.nil?
$stderr.puts "Missing package source type (no -s flag?)"
ok = false
end
if !ok
$stderr.puts "There were errors; see above."
$stderr.puts
$stderr.puts opts.help
return 1
end
builder = FPM::Builder.new(settings, args)
builder.assemble!
puts "Created #{builder.output}"
return 0
end # def main
ret = main(ARGV)
exit(ret != nil ? ret : 0)
Jump to Line
Something went wrong with that request. Please try again.