class Tara::Cli

@private

Public Class Methods

new(argv=ARGV, io=$stderr) click to toggle source
# File lib/tara/cli.rb, line 9
def initialize(argv=ARGV, io=$stderr)
  @argv = argv
  @io = io
end

Public Instance Methods

run() click to toggle source
# File lib/tara/cli.rb, line 14
def run
  Archive.new(parse_argv).create
  0
rescue => e
  @io.puts(%(Error during packaging: #{e.message} (#{e.class})))
  1
end

Private Instance Methods

parse_argv(options={}) click to toggle source
# File lib/tara/cli.rb, line 24
def parse_argv(options={})
  parser = OptionParser.new do |opts|
    opts.on('--app-name NAME', 'Name of the app') do |app_name|
      options[:app_name] = app_name
    end

    opts.on('--app-dir APP_DIR', 'Root directory of the app') do |app_dir|
      options[:app_dir] = app_dir
    end

    opts.on('--download-dir DOWNLOAD_DIR', 'Where to store Traveling Ruby archives') do |download_dir|
      options[:download_dir] = download_dir
    end

    opts.on('--target TARGET', 'Target platform for archive') do |target|
      options[:target] = target
    end

    opts.on('--traveling-ruby-version VERSION', 'Release of Traveling Ruby that should be used') do |traveling_ruby_version|
      options[:traveling_ruby_version] = traveling_ruby_version
    end
  end
  parser.parse(@argv)
  options
end