Sha256: b59ff6b72ae063378f7fd7572070ecd3da323b974a9fe4384d5d5ee3883ed72a

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

#!/usr/bin/env ruby

require 'getopt/long'
require 'devinstall'
require 'devinstall/settings'

begin
  opt =Getopt::Long.getopts(
      ['--version', '-v',],
      ['--package', '-p', Getopt::REQUIRED],
      ['--config', '-c', Getopt::REQUIRED],
      ['--type', '-t', Getopt::REQUIRED],
      ['--env', '-e', Getopt::REQUIRED],
      ['--build', '-b',],
      ['--upload', '-u',],
      ['--install', '-i',],
      ['--help', '-h',],
  )
rescue
  puts 'Invalid option in command line'
  help!
  exit!(1)
end

def help!
  puts 'Usage: pkg-install --config|-c <file> --package|-p <package> --type|-t <package_type> --env|-e <environment> --build|--upload|--install'
end

if opt['version']
  puts "devinstall version #{Devinstall::VERSION}"
  puts "pkg-tool version   #{Devinstall::VERSION}"
  exit(0)
end

if opt['help']
  help!
  exit!(0)
end

unless opt['package'] && opt['config'] && opt['type'] && opt['env'] && (opt['build'] || opt['upload'] || opt['install'])
  puts 'You must speciffy --config file, --package, --type and --env and one of the actions (--build, --install, --upload)'
  exit!(0)
end
Settings.load!(opt['config'])
package=Pkg.new(opt['package'])

if opt['build']
  package.build!(opt['type'].to_sym)
elsif opt['install']
  package.build!(opt['type'].to_sym)
  package.install!(opt['env'].to_sym)
elsif opt['upload']
  package.build!(opt['type'].to_sym)
  package.upload!(opt['env'].to_sym)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
devinstall-0.1.0 bin/pkg-tool
devinstall-0.0.6 bin/pkg-tool
devinstall-0.0.5 bin/pkg-tool