Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 78 lines (62 sloc) 2.019 kb
#!/usr/bin/env ruby
#
require "rubygems"
require "optparse"
require "ostruct"
require "erb"
require "fpm"
def main(args)
settings = OpenStruct.new
opts = OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options]"
# 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
end # OptionParser
opts.parse!(args)
if !settings.package_path
$stderr.puts "No package file given to manage. Give with -p PACKAGEFILE"
return 1
end
package = FPM::Deb.new
package.name = settings.package_name
package.version = settings.version
package.maintainer = settings.maintainer if settings.maintainer
package.architecture = (settings.architecture or %x{uname -m}.chomp)
package.dependencies = (settings.dependencies or [])
p settings
package.assemble({
"output" => settings.package_path,
"root" => settings.chdir,
"paths" => args, # Remainder of args are paths.
})
end # def main
ret = main(ARGV)
exit(ret != nil ? ret : 0)
Jump to Line
Something went wrong with that request. Please try again.