Skip to content

Instantly share code, notes, and snippets.

@tamouse
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamouse/9822711 to your computer and use it in GitHub Desktop.
Save tamouse/9822711 to your computer and use it in GitHub Desktop.
**SOLVED** Why does globally installed gem/script fail when run in a directory with a Gemfile?
tamara@pontiki:~/a/b/c/d/e/f:2014-03-27@07:55:24
$ mkdir test_dir
tamara@pontiki:~/a/b/c/d/e/f:2014-03-27@07:55:31
$ pushd test_dir/
~/a/b/c/d/e/f/test_dir ~/a/b/c/d/e/f ~
tamara@pontiki:~/a/b/c/d/e/f/test_dir:2014-03-27@07:55:43
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
- RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-darwin13.0.0]
- INSTALLATION DIRECTORY: /Users/tamara/.gem/ruby/2.0.0
- RUBY EXECUTABLE: /opt/rubies/ruby-2.0.0-p353/bin/ruby
- EXECUTABLE DIRECTORY: /Users/tamara/.gem/ruby/2.0.0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /Users/tamara/.gem/ruby/2.0.0
- /opt/rubies/ruby-2.0.0-p353/lib/ruby/gems/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-wrappers --no-document"
- REMOTE SOURCES:
- https://rubygems.org/
tamara@pontiki:~/a/b/c/d/e/f/test_dir:2014-03-27@07:55:52
$ which rubytapas
/opt/rubies/ruby-2.0.0-p353/bin/rubytapas
tamara@pontiki:~/a/b/c/d/e/f/test_dir:2014-03-27@07:55:56
$ rubytapas
Commands:
rubytapas all # Download all rubytapas episodes
rubytapas download # Downloads the listed episode's files into a new directory with the episode tag in the given directory
rubytapas help [COMMAND] # Describe available commands or one specific command
tamara@pontiki:~/a/b/c/d/e/f/test_dir:2014-03-27@07:56:04
$ touch Gemfile
tamara@pontiki:~/a/b/c/d/e/f/test_dir:2014-03-27@07:56:08
$ rubytapas
/opt/rubies/ruby-2.0.0-p353/bin/rubytapas:4:in `require': cannot load such file -- thor (LoadError)
from /opt/rubies/ruby-2.0.0-p353/bin/rubytapas:4:in `<main>'
tamara@pontiki:~/a/b/c/d/e/f/test_dir:2014-03-27@07:56:12
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
- RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-darwin13.0.0]
- INSTALLATION DIRECTORY: /Users/tamara/.gem/ruby/2.0.0
- RUBY EXECUTABLE: /opt/rubies/ruby-2.0.0-p353/bin/ruby
- EXECUTABLE DIRECTORY: /Users/tamara/.gem/ruby/2.0.0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /Users/tamara/.gem/ruby/2.0.0
- /opt/rubies/ruby-2.0.0-p353/lib/ruby/gems/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-wrappers --no-document"
- REMOTE SOURCES:
- https://rubygems.org/
tamara@pontiki:~/a/b/c/d/e/f/test_dir:2014-03-27@07:57:34
$
@tamouse
Copy link
Author

tamouse commented Mar 28, 2014

Because at the top of the executable scripts I had:

require 'rubygems'
require 'bundler/setup'

so it was doing exactly what I told it to. Just not what I wanted it to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment