From c7d5c2798f47ed0a06f0ef57908c556580f72f9c Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 2 Feb 2015 16:41:12 -0800 Subject: more verbose --version (closes #4428) --- bin/leap | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'bin/leap') diff --git a/bin/leap b/bin/leap index 47dfdf9..59e4ee8 100755 --- a/bin/leap +++ b/bin/leap @@ -10,6 +10,8 @@ else DEBUG=false end +LEAP_CLI_BASE_DIR = File.expand_path('..', File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)) + begin require 'leap_cli' rescue LoadError @@ -24,8 +26,7 @@ rescue LoadError # This allows you to run the command directly while developing the gem, and also lets you # run from anywhere (I like to link 'bin/leap' to /usr/local/bin/leap). # - base_dir = File.expand_path('..', File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)) - require File.join(base_dir, 'lib','leap_cli','load_paths') + require File.join(LEAP_CLI_BASE_DIR, 'lib','leap_cli','load_paths') require 'leap_cli' end @@ -77,9 +78,16 @@ module LeapCli::Commands program_desc LeapCli::SUMMARY program_long_desc LeapCli::DESCRIPTION - # handle --version ourselves + # handle --version ourselves (and not GLI) if ARGV.grep(/--version/).any? puts "leap #{LeapCli::VERSION}, ruby #{RUBY_VERSION}" + begin + commands_from('leap_cli/commands') + initialize_leap_cli(false, {:verbose => 2}) + rescue StandardError => exc + puts exc.to_s + raise exc if DEBUG + end exit(0) end @@ -88,8 +96,10 @@ module LeapCli::Commands def error_message(msg) end - # load commands and run + # load commands commands_from('leap_cli/commands') + + # run command ORIGINAL_ARGV = ARGV.dup begin exit_status = run(ARGV) -- cgit v1.2.3 From 885e44ec43c17a595fff8d10f24d0724fb2c37ce Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 3 Feb 2015 10:14:14 -0800 Subject: fixed missing ORIGINAL_ARGV when running with --version --- bin/leap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/leap') diff --git a/bin/leap b/bin/leap index 59e4ee8..dbdd312 100755 --- a/bin/leap +++ b/bin/leap @@ -11,6 +11,7 @@ else end LEAP_CLI_BASE_DIR = File.expand_path('..', File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)) +ORIGINAL_ARGV = ARGV.dup begin require 'leap_cli' @@ -100,7 +101,6 @@ module LeapCli::Commands commands_from('leap_cli/commands') # run command - ORIGINAL_ARGV = ARGV.dup begin exit_status = run(ARGV) exit(LeapCli::Util.exit_status || exit_status) -- cgit v1.2.3 From c0770e0c5a914a7c7f25349e51b41a16a1154373 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 25 Feb 2015 09:39:35 -0800 Subject: allow use of byebug --- bin/leap | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bin/leap') diff --git a/bin/leap b/bin/leap index dbdd312..e42b8c2 100755 --- a/bin/leap +++ b/bin/leap @@ -3,7 +3,11 @@ if ARGV.include?('--debug') || ARGV.include?('-d') DEBUG=true begin - require 'debugger' + if RUBY_VERSION =~ /^2/ + require 'byebug' + else + require 'debugger' + end rescue LoadError end else -- cgit v1.2.3