Sha256: 8a16d1800a07fd2ee7c823ec7e3e40c99021c777f2eb068438dacfeaf6d47bdf

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

#!/usr/local/bin/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"
require 'tap/exe'

# setup the environment
begin
  
  $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.launch(ARGV) do
    # give some help
    require 'tap/support/command_line'
    
    puts Tap::Support::CommandLine.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

2 entries across 2 versions & 1 rubygems

Version Path
bahuvrihi-tap-0.10.2 bin/tap
bahuvrihi-tap-0.10.3 bin/tap