xaphod xaphod - 5 months ago 15
Ruby Question

Why isn't gem found? Ruby + RVM + bundler on Mac w/ El Capitan

Why can't it find nest_thermostat?

Tim-rMBP:Nested Tim$ cat Gemfile
# frozen_string_literal: true
# A sample Gemfile
source "https://rubygems.org"

gem "oauth2"
gem "json"
gem "nest_thermostat", :git => 'https://github.com/ericboehs/nest_thermostat.git'

Tim-rMBP:Nested Tim$ bundle install

Fetching https://github.com/ericboehs/nest_thermostat.git
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies...
Installing multipart-post 2.0.0
Installing multi_json 1.12.1
Installing multi_xml 0.5.5
Using json 1.8.3
Installing jwt 1.5.1
Installing rack 1.6.4
Using bundler 1.12.5
Installing faraday 0.9.2
Installing httparty 0.8.3
Installing oauth2 1.1.0
Using nest_thermostat 0.0.5 from https://github.com/ericboehs/nest_thermostat.git (at master@f4303b0)
Bundle complete! 3 Gemfile dependencies, 11 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from httparty:
When you HTTParty, you must party hard!

Tim-rMBP:Nested Tim$ bundle show nest_thermostat
/Users/Tim/.rvm/gems/ruby-2.3.0/bundler/gems/nest_thermostat-f4303b0fa7d6

Tim-rMBP:Nested Tim$ ./nested.rb
/Users/Tim/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- nest_thermostat (LoadError)
from /Users/Tim/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./nested.rb:6:in `<main>'


Here's some environment stuff...

Tim-rMBP:Nested Tim$ which ruby
/Users/Tim/.rvm/rubies/ruby-2.3.0/bin/ruby

Tim-rMBP:Nested Tim$ which rvm
/Users/Tim/.rvm/bin/rvm

Tim-rMBP:Nested Tim$ which bundler
/Users/Tim/.rvm/gems/ruby-2.3.0/bin/bundler

Tim-rMBP:Nested Tim$ cat /Users/Tim/.profile

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

Tim-rMBP:Nested Tim$ cat /Users/Tim/.bashrc

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
Tim-rMBP:Nested Tim$

Tim-rMBP:.rvm Tim$ pwd
/Users/Tim/.rvm
Tim-rMBP:.rvm Tim$ find . -name *thermostat*
./gems/ruby-2.3.0/bundler/gems/nest_thermostat-f4303b0fa7d6
./gems/ruby-2.3.0/bundler/gems/nest_thermostat-f4303b0fa7d6/lib/nest_thermostat
./gems/ruby-2.3.0/bundler/gems/nest_thermostat-f4303b0fa7d6/lib/nest_thermostat.rb
./gems/ruby-2.3.0/bundler/gems/nest_thermostat-f4303b0fa7d6/nest_thermostat.gemspec
./gems/ruby-2.3.0/bundler/gems/nest_thermostat-f4303b0fa7d6/spec/nest_thermostat_spec.rb
./gems/ruby-2.3.0/cache/bundler/git/nest_thermostat-b51b882316a1edb768f6372e0de0b8b662ac23d5

Answer

You catted everything but your source code that's failing!

Did you do a:

require 'bundler/setup'

In your source? From there you should be able to use the objects in your dependencies.

Comments