Sha256: cc65fb3b51b5eb71ef15477ccfcb76a42bf81a1e8de0f85b03e047785ce958d6

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby

begin
  require 'ruic'
rescue LoadError
  require 'rubygems'
  require 'ruic'
end

USAGE = <<ENDUSAGE
Usage:
   ruic [-h] [-v] [-m /path/to/MetaData.xml] myscript.ruic
ENDUSAGE

HELP = <<ENDHELP
   -h, --help       Show this help.
   -v, --version    Show the version number (#{RUIC::VERSION}).
   -m, --metadata   The path to use for MetaData.xml
                    Default: #{RUIC::DEFAULTMETADATA}
                    Will be overridden by any `metadata` call in your script.
ENDHELP

ARGS = {}
UNFLAGGED_ARGS = [ :script ]
next_arg = UNFLAGGED_ARGS.first
ARGV.each do |arg|
	case arg
		when '-h','--help'      then ARGS[:help]    = true
		when '-v','--version'   then ARGS[:version] = true
		when '-m','--metadata'  then next_arg = :meta
		else
			if next_arg
				ARGS[next_arg] = arg
				UNFLAGGED_ARGS.delete( next_arg )
			end
			next_arg = UNFLAGGED_ARGS.first
	end
end

puts "RUIC v#{RUIC::VERSION}" if ARGS[:version]

if ARGS[:help] || !ARGS[:script]
	puts USAGE unless ARGS[:version]
	puts HELP if ARGS[:help]
	exit ARGS[:help] ? 0 : 1
end

if ARGS[:meta]
	RUIC::DEFAULTMETADATA.replace File.expand_path(ARGS[:meta])
end

RUIC(ARGS[:script])

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
RUIC-0.0.1 bin/ruic