summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-06-30 12:43:15 -0700
committerelijah <elijah@riseup.net>2015-06-30 12:43:15 -0700
commit29c2826de6163ffe9a7ce34be29c74faa6f3c8c7 (patch)
tree4741795a2fad4de5e3c2a32e635c0deb64d35581
parentfe0eb1c0c3101bd2c5dd665a6c4d1f1dba2e3b08 (diff)
in `leap` command file, try the local libs first, then libs from gems.
-rwxr-xr-xbin/leap15
1 files changed, 3 insertions, 12 deletions
diff --git a/bin/leap b/bin/leap
index e42b8c2..8da9356 100755
--- a/bin/leap
+++ b/bin/leap
@@ -18,20 +18,11 @@ LEAP_CLI_BASE_DIR = File.expand_path('..', File.dirname(File.symlink?(__FILE__)
ORIGINAL_ARGV = ARGV.dup
begin
+ # First, try to load the leap_cli code that is local to this `leap` command.
+ # If that fails, then we try to load leap_cli as a gem.
+ require File.join(LEAP_CLI_BASE_DIR, 'lib','leap_cli','load_paths')
require 'leap_cli'
rescue LoadError
- #
- # When developing a gem with a command, you normally use `bundle exec bin/command-name`
- # to run your app. At install-time, RubyGems will make sure lib, etc. are in the load path,
- # so that you can run the command directly.
- #
- # However, I don't like using 'bundle exec'. It is slow, and limits which directory you can
- # run in. So, instead, we fall back to some path manipulation hackery.
- #
- # 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).
- #
- require File.join(LEAP_CLI_BASE_DIR, 'lib','leap_cli','load_paths')
require 'leap_cli'
end