Sha256: d5d39e5ef76028daace6f91ee77a8016fb1f1c3bb4fa25e541d7dab7238986ef

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 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 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

5 entries across 5 versions & 2 rubygems

Version Path
bahuvrihi-tap-0.12.0 bin/tap
tap-0.12.3 bin/tap
tap-0.12.1 bin/tap
tap-0.12.0 bin/tap
tap-0.12.2 bin/tap