Sha256: f3ed67f593444465e7de53b5ec5cf401537065b67da4176beb5bd7d5dff218fc

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env ruby
# == Synopsis
#
# tester: test script for syscmd
#
# == Usage
#
# tester [OPTION]
#
# COMMANDS:
#  list:
#    list all available project. No option required.
#  show:
#    show a project. You must provide a PROJECTNAME and a SCOPE. Valid SCOPEs
#    are: [env]ironment, [ver]sion
#  deploy:
#    deploys a given build to an environment. You must provide PROJECTNAME,
#    BUILD and ENVRIONMENT.
#
# OPTIONS:
#   --help, -h
#   --stdout, -s
#   --stderr, -e
#   --exitcode, -x
#   --debug

require "getoptlong"
require "rdoc/usage"

opts = GetoptLong.new(
  [ '--help',     '-h', GetoptLong::NO_ARGUMENT ],
  [ '--stdout',   '-s', GetoptLong::REQUIRED_ARGUMENT ],
  [ '--stderr',   '-e', GetoptLong::REQUIRED_ARGUMENT ],
  [ '--exitcode', '-x', GetoptLong::REQUIRED_ARGUMENT ],
  [ '--debug',          GetoptLong::OPTIONAL_ARGUMENT ]
)

options = {}
exitcode = 0

opts.each do |opt, arg|
  case opt
    when '--help'
      RDoc::usage
    when '--stdout'
      $stdout.print arg
    when '--stderr'
      $stderr.print arg
    when '--exitcode'
      exitcode = arg.to_i
    when '--debug'
      # not yet implemented
  end
end

exit exitcode

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tsalzer-syscmd-0.0.1 spec/tester.rb