def default_options(opts)
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("--iteration ITERATION",
"(optional) Set the iteration value for this package ('release' for RPM).") do |iteration|
@settings.iteration = iteration
end
opts.on("--epoch EPOCH",
"(optional) Set epoch value for this package.") do |epoch|
@settings.epoch = epoch
end
opts.on("-d DEPENDENCY", "--depends DEPENDENCY") do |dep|
@settings.dependencies << dep
end
opts.on("--category SECTION_OR_GROUP") do |thing|
@settings.category = thing
end
opts.on("--provides PROVIDES") do |thing|
@settings.provides << thing
end
opts.on("--conflicts CONFLICTS") do |thing|
@settings.conflicts << thing
end
opts.on("--replaces REPLACES") do |thing|
@settings.replaces << thing
end
opts.on("--config-files PATH",
"(optional) Treat path as a configuration file. Uses conffiles in deb or %config in rpm. (/etc/package.conf)") do |thing|
@settings.config_files << thing
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 dependencies") 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
opts.on("--post-install SCRIPTPATH",
"Add a post-install action. This script will be included in the" \
" resulting package") do |path|
@settings.scripts["post-install"] = File.expand_path(path)
end
opts.on("--pre-install SCRIPTPATH",
"Add a pre-install action. This script will be included in the" \
" resulting package") do |path|
@settings.scripts["pre-install"] = File.expand_path(path)
end
opts.on("--pre-uninstall SCRIPTPATH",
"Add a pre-uninstall action. This script will be included in the" \
" resulting package") do |path|
@settings.scripts["pre-uninstall"] = File.expand_path(path)
end
opts.on("--post-uninstall SCRIPTPATH",
"Add a post-uninstall action. This script will be included in the" \
" resulting package") do |path|
@settings.scripts["post-uninstall"] = File.expand_path(path)
end
opts.on("--description DESCRIPTION",
"Add a description for this package.") do |description|
@settings.description = description
end
opts.on("--url URL",
"Add a url for this package.") do |url|
@settings.url = url
end
opts.on("--inputs FILEPATH",
"The path to a file containing a newline-separated list of " \
"files and dirs to package.") do |path|
settings.source[:inputs] = path
end
opts.separator "Pass - as the only argument to have the list of " \
"files and dirs read from STDIN " \
"(e.g. fpm -s dir -t deb - < FILELIST)"
end