bin/tap in tap-0.19.0 vs bin/tap in tap-1.3.0
- old
+ new
@@ -1,62 +1,16 @@
#!/usr/bin/env ruby
-# usage: tap <command> {options} [args]
#
-# Launches a tap command.
+# Runs tapexe, first setting the default ENV variables expected
+# by tap when installed by RubyGems. Splitting the work into
+# two files like this is a pattern allowing tapexe to be run
+# without RubyGems or the default ENV (ie 'ruby tapexe').
#
-# 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"
+ENV['TAP_GEMS'] ||= '.'
+ENV['TAP_PATH'] ||= '.'
+ENV['TAPENV'] ||= 'tapenv'
+ENV['TAPRC'] ||= '~/.taprc:taprc'
+ENV['TAPFILE'] ||= 'tapfile'
+ENV['TAP_CACHE'] ||= '~/.tap'
-#
-# setup the application
-#
-
-begin
- app = Tap::App.setup
-rescue(Tap::Env::ConfigError)
- # catch errors and exit gracefully
- # (errors usu from gem loading errors)
- puts $!.message
- exit(1)
-end
-
-#
-# launch the command
-#
-
-commands = app.env.manifest do |env|
- env.root.glob(:cmd, "**/*.rb")
-end
-
-case command = ARGV.shift.to_s
-when '', '--help'
- template = %Q{<% unless minimap.empty? || count <= 1 %>
-<%= env_key %>:
-<% end %>
-<% minimap.each do |key, path| %>
- <%= key.ljust(width) %>
-<% end %>}
-
- puts Lazydoc.usage(__FILE__)
- puts
- puts "available commands:"
- puts commands.summarize(template)
- puts
- puts "version #{Tap::VERSION} -- #{Tap::WEBSITE}"
-else
- if path = commands.seek(command)
- load path
- else
- puts "Unknown command: '#{command}'"
- puts "Type 'tap --help' for usage information."
- end
-end
-
-exit(0)
\ No newline at end of file
+load File.expand_path('../tapexe', __FILE__)