Sha256: c8d9943952ebbf1a4cba981bd7e2f65227a3af7e17060e83d68beb928fa58e96

Contents?: true

Size: 1.28 KB

Versions: 8

Compression:

Stored size: 1.28 KB

Contents

#!/usr/bin/env ruby
# usage: tap <command> {options} [args]
#
# examples:
#   tap generate root .                  # generates a root dir
#   tap run taskname --option input      # runs the 'taskname' task
#
# help:
#   tap --help                           # prints this help
#   tap command --help                   # prints help for 'command'
#

require "#{File.dirname(__FILE__)}/../lib/tap.rb"

# setup the environment
begin
  
  # handle super options
  $DEBUG = true if ARGV.delete('-d-')
  env = Tap::Exe.instantiate
  
rescue(Tap::Env::ConfigError)
  # catch errors and exit gracefully
  # (errors usu from gem loading errors)
  puts $!.message
  exit(1)
end

#
# setup after script
#

at_exit do
  begin
    eval(env.after) if env.after != nil
  rescue(Exception)
    puts "Error in after script."
    env.handle_error($!)
    exit(1)
  end
end

#
# run before script
#

begin
  eval(env.before) if env.before != nil
rescue(Exception)
  puts "Error in before script."
  env.handle_error($!)
  exit(1)
end 

#
# run tap
#

begin
  env.activate
  env.execute(ARGV) do
    puts Tap::Support::Lazydoc.usage(__FILE__)
    puts
    puts "available commands:"
    puts env.summarize(:commands)
    puts
    puts "version #{Tap::VERSION} -- #{Tap::WEBSITE}"
  end
rescue
  env.handle_error($!)
end

exit(0)

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
bahuvrihi-tap-0.10.6 bin/tap
bahuvrihi-tap-0.10.7 bin/tap
bahuvrihi-tap-0.10.8 bin/tap
bahuvrihi-tap-0.11.0 bin/tap
bahuvrihi-tap-0.11.1 bin/tap
bahuvrihi-tap-0.11.2 bin/tap
tap-0.11.0 bin/tap
tap-0.11.1 bin/tap