Sha256: 9a66eb219fddf50228e282dc06012e193dc176b979222038606980ac5095b8f9
Contents?: true
Size: 1.74 KB
Versions: 8
Compression:
Stored size: 1.74 KB
Contents
#!/usr/bin/env ruby # What does this do? If you invoke this binary directly (e.g. from the RightDevelop git repository), # this ensures that RightDevelop will be loaded from your local disk, and not from any installed # RubyGems. The binary can therefore be used to play with in-development commands. # # Note that this trick depends on RubyGems NOT being activated at the moment the binary is parsed, # i.e. it will not work correctly if you "bundle exec bin/right_develop". # # Usage: # bin/right_develop <whatever> # note no 'bundle exec' ! if !defined?(Gem) && File.directory?(File.expand_path('../../.git', __FILE__)) $: << File.expand_path('../../lib', __FILE__) require 'rubygems' end unless Gem.respond_to?(:latest_spec_for) fail 'right_develop command line tools require rubygems v1.8+' end require 'trollop' require 'right_develop' gemspec = Gem.latest_spec_for("right_develop") commands = {} RightDevelop::Commands.constants.each do |konst| name = konst.to_s.downcase commands[name] = RightDevelop::Commands.const_get(konst.to_sym) end # Use a Trollop parser for help/banner display, but do not actually parse anything # just yet. command_list = commands.keys.map { |c| " * #{c}" }.join("\n") p = Trollop::Parser.new do version "right_develop #{gemspec.version} (c) 2013-2014 RightScale, Inc." banner <<-EOS A command-line interface to various tools offered by the right_develop gem. Usage: right_develop <command> [options] Where <command> is one of: #{command_list} To get help on a command: right_develop <command> --help EOS stop_on commands.keys end opts = Trollop::with_standard_exception_handling p do raise Trollop::HelpNeeded if ARGV.empty? p.parse ARGV cmd = ARGV.shift commands[cmd].create.run end
Version data entries
8 entries across 8 versions & 1 rubygems