Rake, TestFirst, Error, Rspec Config Failed, Learn_Ruby - ruby

I have done an extensive search within the Q&As and have yet to find a solution, I hope you can guys can help.
I am currently attempting the TestFirst (Learn_Ruby TestFirst) and can't even get pass the the first test for 00_hello. When I type in rake before creating the hello.rb as requested I get a long error message- not the one liner error message mentioned in the task.
Input rake
(in /Users/yanique/Desktop/learn_ruby)
/Users/yanique/.rvm/rubies/ruby-2.1.1/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- spec_helper (LoadError)
from /Users/yanique/.rvm/rubies/ruby-2.1.1/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration.rb:1018:in `block in requires='
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration.rb:1018:in `each'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration.rb:1018:in `requires='
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration_options.rb:101:in `block in process_options_into'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration_options.rb:100:in `each'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration_options.rb:100:in `process_options_into'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/configuration_options.rb:22:in `configure'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:96:in `setup'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:85:in `run'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:70:in `run'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/lib/rspec/core/runner.rb:38:in `invoke'
from /Users/yanique/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.1/exe/rspec:4:in `<top (required)>'
from /Users/yanique/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `load'
from /Users/yanique/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `<main>'
/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/ruby -S rspec /Users/yanique/Desktop/learn_ruby/00_hello/hello_spec.rb -I/Users/yanique/Desktop/learn_ruby/00_hello -I/Users/yanique/Desktop/learn_ruby/00_hello/solution -f documentation -r ./rspec_config failed
Running gem list
*** LOCAL GEMS ***
bigdecimal (1.2.4)
bundler (1.6.1)
bundler-unload (1.0.2)
diff-lcs (1.2.5)
executable-hooks (1.3.1)
gem-wrappers (1.2.4)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.3)
rake (10.1.0)
rdoc (4.1.0)
rspec (3.0.0, 2.99.0)
rspec-core (3.0.1, 2.99.0)
rspec-expectations (3.0.1, 2.99.0)
rspec-mocks (3.0.1, 2.99.1)
rspec-support (3.0.0)
rubygems-bundler (1.4.3)
rvm (1.11.3.9)
test-unit (2.1.1.0)
rvm info
ruby-2.1.1:
system:
uname: "Darwin yaniques-air.home 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64"
system: "osx/10.9/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.25.27 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "9 days 2 hours 44 seconds ago"
path: "/Users/yanique/.rvm"
ruby:
interpreter: "ruby"
version: "2.1.1p76"
date: "2014-02-24"
platform: "x86_64-darwin12.0"
patchlevel: "2014-02-24 revision 45161"
full_version: "ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]"
homes:
gem: "/Users/yanique/.rvm/gems/ruby-2.1.1"
ruby: "/Users/yanique/.rvm/rubies/ruby-2.1.1"
binaries:
ruby: "/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/ruby"
irb: "/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/irb"
gem: "/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/gem"
rake: "/Users/yanique/.rvm/rubies/ruby-2.1.1/bin/rake"
environment:
PATH: "/Users/yanique/.rvm/gems/ruby-2.1.1/bin:/Users/yanique/.rvm/gems/ruby- 2.1.1#global/bin:/Users/yanique/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/Users/yanique/.rvm/bin"
GEM_HOME: "/Users/yanique/.rvm/gems/ruby-2.1.1"
GEM_PATH: "/Users/yanique/.rvm/gems/ruby-2.1.1:/Users/yanique/.rvm/gems/ruby-2.1.1#global"
MY_RUBY_HOME: "/Users/yanique/.rvm/rubies/ruby-2.1.1"
IRBRC: "/Users/yanique/.rvm/rubies/ruby-2.1.1/.irbrc"
RUBYOPT: ""
gemset: ""
rvm is a function
yaniques-air:~ yanique$ type rvm | head -n1
rvm is a function
yaniques-air:~ yanique$ rake --version
rake, version 10.1.0
Tried bundle install
yaniques-air:00_hello yanique$ bundle install
Using rake 10.1.0
Using diff-lcs 1.2.5
Using rspec-support 3.0.0
Using rspec-core 3.0.1
Using rspec-expectations 3.0.1
Using rspec-mocks 3.0.1
Using rspec 3.0.0
Using bundler 1.6.1
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
I am expecting a short error when inputting rake without the corresponding hello.rb but definitely not such an extensive error. Nothing seems to be working and I feel I am at an impasse. Sorry for the long post just trying to cover my bases.
Here's the rakefile that was included in the learn_ruby directory (I tried adding require 'ruby gems' to it but that did not help either)
gem 'rspec', '~>2'
require 'rspec/core/rake_task'
task :default => :spec
desc "run tests for this lab"
RSpec::Core::RakeTask.new do |task|
lab = Rake.application.original_dir
task.pattern = "#{lab}/*_spec.rb"
task.rspec_opts = [ "-I#{lab}", "-I#{lab}/solution", '-f documentation', '-r ./rspec_config']
task.verbose = false
end
Any help will be greatly appreciated! Thank you for your time.

Uninstall all the rspec related gems, all versions, then reinstall the last 2.x version
gem install -v '< 3.0.0' rspec
Try rake again from the root directory.

Related

RVM works, Ruby gems installed, but not accessible with require

Here’s my problem:
➜ ~ rvm current
ruby-2.2.1
➜ ~ rvm list
rvm rubies
ruby-2.0.0-p643 [ x86_64 ]
ruby-2.1.1 [ x86_64 ]
=* ruby-2.2.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
➜ ~ ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
➜ ~ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
bundler (1.10.6)
coderay (1.1.0)
domain_name (0.5.24)
http-cookie (1.0.2)
io-console (0.4.3)
json (1.8.1)
method_source (0.8.2)
mime-types (2.6.1)
netrc (0.10.3)
plaid-ruby (0.1.2)
plist (3.1.0)
pry (0.10.1)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rest-client (1.8.0)
slop (3.6.0)
unf (0.1.4)
unf_ext (0.0.7.1)
➜ ~ irb
irb(main):001:0> require 'plaid-ruby'
LoadError: cannot load such file -- plaid-ruby
from /Users/richardburton/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/richardburton/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from (irb):1
from /Users/richardburton/.rvm/rubies/ruby-2.2.1/bin/irb:11:in `<main>'
irb(main):002:0>
You need to require plaid, not plaid-ruby. The file you require doesn’t necessarily have the same name as the gem, although it’s often the case that it does.
In fact from the Rubygems page for plaid-ruby and the Github page it links to it looks like it is an old version of the Plaid client, and you should be using the plaid gem.

Ruby bundler installing unwanted version of puppet gem

I have the following script
PUPPET_VERSION=3.7.4
ruby='1.8.7-p374'
rvm use $ruby#$$ --create
gem install bundler
bundle install --gemfile=.gemfile
This has worked for several months but sadly now it has decided to stop working.
After this script rake is called to run some rspec tasks
On the centos 6.6 bamboo test runner the process fails.
On the centos 6.4 development machine it still works
On my development machine this script (+rake tasks ) works like so
Fetching gem metadata from http://rubygems.org/.........
Fetching version metadata from http://rubygems.org/..
Installing rake 10.4.2
Installing CFPropertyList 2.2.8
Installing builder 3.2.2
Installing diff-lcs 1.2.5
Installing facter 2.4.1
Installing json_pure 1.8.2
Installing hiera 1.3.4
Installing metaclass 0.0.4
Installing mocha 1.1.0
Installing puppet 3.7.4
Installing puppet-lint 1.1.0
Installing puppet-syntax 1.4.1
Installing rspec-core 2.99.2
Installing rspec-expectations 2.99.2
Installing rspec-mocks 2.99.3
Installing rspec 2.99.0
Installing rspec-puppet 2.0.0
Installing puppetlabs_spec_helper 0.8.2
Installing rspec_junit_formatter 0.2.0
Using bundler 1.9.4
Bundle complete! 3 Gemfile dependencies, 20 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
manifests found
~/gitf/puppetmaster_np/local_modules/iop_4store/spec/fixtures/modules ~/gitf/puppetmaster_np/local_modules/iop_4store
~/gitf/puppetmaster_np/local_modules/iop_4store
/home/jan/.rvm/rubies/ruby-1.9.3-p484/bin/ruby -S rspec ./spec/classes/iop_4store_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Removing gemset 16612......
However on the bamboo agent node it does this
The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Using rake 10.4.2
Using CFPropertyList 2.2.8
Using builder 3.2.2
Using diff-lcs 1.2.5
Using facter 2.4.3
Using json_pure 1.8.2
Using hiera 2.0.0
Using metaclass 0.0.4
Using mocha 1.1.0
Using puppet 4.0.0
Using puppet-lint 1.1.0
Using puppet-syntax 2.0.0
Using rspec-support 3.2.2
Using rspec-core 3.2.3
Using rspec-expectations 3.2.1
Using rspec-mocks 3.2.1
Using rspec 3.2.0
Using rspec-puppet 2.0.1
Using puppetlabs_spec_helper 0.10.2
Using rspec_junit_formatter 0.2.0
Using bundler 1.9.4
Bundle complete! 3 Gemfile dependencies, 21 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
manifests found
~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/fixtures/modules ~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store
~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-support-3.2.2/lib:/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/usr/local/rvm/gems/ruby-1.9.3-p484/gems/puppetlabs_spec_helper-0.10.2/lib/puppetlabs_spec_helper/module_spec_helper.rb:23:in `block in <top (required)>': undefined method `environmentpath=' for #<RSpec::Core::Configuration:0x000000025a4068> (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core.rb:101:in `configure'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/puppetlabs_spec_helper-0.10.2/lib/puppetlabs_spec_helper/module_spec_helper.rb:22:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
from /home/bamboo/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/spec_helper.rb:2:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/bamboo/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/classes/iop_4store_spec.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec:4:in `<main>'
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-support-3.2.2/lib:/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null failed
/usr/local/rvm/gems/ruby-1.9.3-p484#27314 did not previously exist. Ignoring.
The tests fail and I'm sure that having a wildly different version of puppet (and other gems) is not helping. Also, our systems aren't running puppet 4
Here is the gemfile that is being used
source :rubygems
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>=
2.7']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'rspec_junit_formatter'
So my problem is that the scripts shown previously loaded the correct gems into rvm and executed the tests "as if" puppet 3.7.0. Now they try and load puppet 4 and the tests fail.
Thanks
Here's what I did to "make it work" Not entirely sure why this fixed it
First, alter the gemfile to copy most of the versions of the gem dependencies from the other server where it still works
source 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>=
2.7', '< 4.0']
gem 'diff-lcs', '1.2.5'
gem 'facter'
gem 'hiera', '1.3.4'
gem 'json_pure', '1.8.2'
gem 'metaclass', '0.0.4'
gem 'mocha', '1.1.0'
gem 'puppet', puppetversion
gem 'puppet-lint', '1.1.0'
gem 'puppet-syntax', '1.4.1'
gem 'puppetlabs_spec_helper', '0.8.2'
gem 'rake'
gem 'rspec', '2.99.0'
gem 'rspec-core', '2.99.2'
gem 'rspec-expectations', '2.99.2'
gem 'rspec-mocks', '2.99.3'
gem 'rspec-puppet', '2.0.0'
gem 'rspec_junit_formatter', '0.2.0'
Next, add a couple of "bundle update" and a "bundlee clean --force" to the script.
PUPPET_VERSION=3.7.4
ruby='1.9.3-p484'
rvm use $ruby#$$ --create
gem install bundler
ln -s .gemfile Gemfile
bundle clean --force
bundle update rspec
bundle install --gemfile=.gemfile
bundle update rspec
(the eagle eyed will note that I'm running a different ruby too)

Unable to run ruby-debug on ruby1.9.3p0 under XP

How do I get ruby-debug to run under XP so that I can step through my Watir test scripts.
I am unable to "require" ruby-debug on Windows XP. All of the solutions I have seen refer to a Unix-based system running Rails. Here is my system profile:
H:\>ruby -v
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
Here are the gems I have installed to support my testing in Watir
H:\>gem list
*** LOCAL GEMS ***
archive-tar-minitar (0.5.2)
awesome_print (1.0.2)
bigdecimal (1.1.0)
childprocess (0.2.4)
columnize (0.3.6)
ffi (1.0.11)
io-console (0.3)
json (1.5.4)
linecache19 (0.5.13)
minitest (2.5.1)
mkrf (0.2.3)
multi_json (1.0.4)
net-ssh (2.2.1)
rake (0.9.2.2)
rdebug (0.1)
rdiscount (1.6.8)
rdoc (3.9.4)
ruby-debug-base19x (0.11.30.pre4)
ruby_core_source (0.1.5)
rubygems-update (1.8.13)
rubyzip (0.9.5)
selenium-webdriver (2.15.0)
watir-webdriver (0.4.1)
wirble (0.1.3)
This is the error that presents itself when I try to "require" ruby-debug.
Error:
irb(main):001:0> require 'ruby-debug'
LoadError: cannot load such file -- ruby-debug
from C:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):1
from C:/Ruby/bin/irb:12:in `<main>'
irb(main):002:0>
ruby-debug has been broken with recent ruby versions for a very long time. Try the debugger gem instead. I've no idea if it works on Windows though.
try this
gem install ruby-debug --pre

Rubygems Path Question

I am trying to run the following ruby code from IRB but am unable to require the gmail gem.
require 'rubygems'
require 'gmail'
gmail = Gmail.new("user", "pass")
Here's the IRB output:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ irb
>> require 'rubygems'
=> false
>> require 'gmail'
NameError: uninitialized constant Gmail
from ./gmail.rb:6
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from (irb):2
Here is Gem.path output:
>> Gem.path
=> ["/Users/johnnygoodman/.gem/ruby/1.8", "/Library/Ruby/Gems/1.8", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8"]
And environment output:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-10
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/johnnygoodman/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org/", "http://gems.github.com"]
- REMOTE SOURCES:
- http://rubygems.org/
- http://gems.github.com
And which ruby:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ which ruby
/usr/bin/ruby
And .gemrc:
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ cat .gemrc
---
:sources:
- http://rubygems.org/
- http://gems.github.com
:backtrace: false
:benchmark: false
:verbose: true
:update_sources: true
:bulk_threshold: 1000
Here's my gemlist:
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.8, 2.3.5, 2.2.2, 1.3.6)
actionpack (2.3.8, 2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.8, 2.3.5, 2.2.2, 1.15.6)
activeresource (2.3.8, 2.3.5, 2.2.2)
activesupport (2.3.8, 2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.4, 0.4.3)
Ascii85 (1.0.0)
autotest (4.2.10, 4.2.9)
autotest-fsevent (0.2.2, 0.1.1)
autotest-growl (0.2.4, 0.2.0)
autotest-rails (4.1.0)
bigdecimal-segfault-fix (1.0.1)
capistrano (2.5.18, 2.5.11, 2.5.2)
cgi_multipart_eof_fix (2.5.0)
cheat (1.2.1)
chronic (0.2.3)
configuration (1.1.0)
daemons (1.0.10)
dnssd (1.3.1, 0.6.0)
fastthread (1.0.7, 1.0.1)
fcgi (0.8.8, 0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
gemcutter (0.5.0, 0.4.1)
heroku (1.9.9, 1.8.5)
highline (1.5.2, 1.5.1, 1.5.0)
hoe (2.6.0, 2.5.0)
hpricot (0.8.2, 0.6.164)
json_pure (1.4.3, 1.2.3, 1.2.2)
launchy (0.3.5)
libxml-ruby (1.1.4, 1.1.3, 1.1.2)
mail (2.2.1)
mechanize (1.0.0, 0.9.3)
mime-types (1.16)
mongrel (1.1.5)
mysql (2.8.1)
needle (1.3.0)
net-scp (1.0.2, 1.0.1)
net-sftp (2.0.4, 2.0.1, 1.1.1)
net-ssh (2.0.22, 2.0.21, 2.0.17, 2.0.4, 1.1.4)
net-ssh-gateway (1.0.1, 1.0.0)
nokogiri (1.4.2, 1.4.1)
passenger (2.2.11, 2.2.9)
pdf-reader (0.8.5, 0.8.4, 0.8.3)
polyglot (0.3.1)
pony (1.0, 0.9, 0.6)
rack (1.1.0, 1.0.1)
rails (2.3.8, 2.3.5, 2.2.2, 1.2.6)
rake (0.8.7, 0.8.3)
RedCloth (4.2.3, 4.1.1)
rest-client (1.4.2, 1.3.1)
rspec (1.3.0)
rspec-rails (1.3.2)
ruby-gmail (0.2.1, 0.0.8)
ruby-openid (2.1.7, 2.1.2)
ruby-yadis (0.3.4)
rubyforge (2.0.4)
rubygems-update (1.3.7, 1.3.6, 1.3.5, 1.3.1)
rubynode (0.1.5)
scrapi (1.2.0)
shared-mime-info (0.1)
sqlite3-ruby (1.2.5, 1.2.4)
sys-uname (0.8.4)
termios (0.9.4)
tidy (1.1.2)
tmail (1.2.7.1)
treetop (1.4.5)
xmpp4r (0.5, 0.4)
ZenTest (4.3.1)
I've uninstalled mac ports and used hivelogic instructions to install a fresh ruby/rails version. However, notice that my which ruby doesn't match hivelogic's instructions until I run:
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ . ~/.profile
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ which ruby
/usr/local/bin/ruby
I think this is the problem but am not sure what to read to force the ruby path to always load to /usr/local/bin/ruby. It could also be a red herring as I simply don't know how the parts fit. As soon as sudo gem install doesn't work, I'm basically lost.
Note other gems do work:
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'mechanize'
=> true
Questions:
When sudo gem install doesn't allow you to create an object from the class, what are the next steps in sleuthing down the issue?
How do the parts of a gem fit together as applies to fixing these types of issues? I've read the FAQs and docs (http://docs.rubygems.org/read/book/3) but either missed it or was unable to pick out the relevant parts.
Looks like you have some misunderstanding how ruby loads files. There's an include path (check out the $: variable). When you require something, ruby will start at the first path in the array, and checks if the file is there. If it's, then it loads it, otherwise it moves on to the next directory in the include path.
When you require gmail, it looks like that it loads your own gmail.rb. Doing a require "gmail" in that file will find itself, instead of the gem's gmail.rb.
To fix it you should probably rename your gmail.rb to something else (my_gmail.rb, or anything, just make sure it doesn't match any system file).
(The require 'ruby-gmail' fails because the ruby-gmail gem doesn't contain such file. You should use simply require 'gmail', but before that rename your gmail.rb)
Your IRB output seems to be about as far as you needed to go:
>> require 'gmail'
NameError: uninitialized constant Gmail
from ./gmail.rb:6
When you require 'gmail' it's pulling in your local gmail.rb file - within which there's a reference to a Gmail class(?) which isn't defined.
It's unclear why you'd expect Gmail to be defined, though. Without seeing the code in gmail.rb, it's hard to say what's wrong.
I notice that in your gem list there isn't any gem called "gmail" or anything similar.
It's hard to tell, therefore, what you're trying to accomplish. Perhaps you're confusing gems with a basic library require, or are assuming that the Rails constant-lookup functionality is a Ruby feature.
Most useful would be if you could post the contents of gmail.rb.

Ruby Debug IDE error : ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb:109:in `debug_load'

I hope someone can assist me. I have RubyMine 2.0.2 installed on Windows 7 32 bit computer. Since a week ago (I presume it must have been after I have update some gems) I cant seem to debug form the IDE. I am trying to debug a rake task which I could before. Running the rake task normally works perfect, just debug doesnt. Its not just limited to the rake, I cant debug any ruby files. I've tried installing older versions of debug-ide and debug-base but to no success. I've tried it with ruby 1.8.7 and 1.8.6 on different computers but nothing. Trying to search the web gave some information, which I've tried, but also no success. Im desperate to get this working. Below are the full error and my current settings:
Error:
C:\InstantRails\ruby\bin\ruby.exe -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) C:\InstantRails\ruby\bin/rdebug-ide --port 57167 -- C:/InstantRails/rails_apps/paperserve/lib/tasks/poll_snmp.rake
Fast Debugger (ruby-debug-ide 0.4.9) listens on :57167
C:/InstantRails/rails_apps/paperserve/lib/tasks/poll_snmp.rake:5
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.9/lib/ruby-debug ide.rb:109:in `debug_load'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.9/lib/ruby-debug ide.rb:109:in `debug_program'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.9/bin/rdebug-ide:87
C:\InstantRails\ruby\bin/rdebug-ide:19:in `load'
C:\InstantRails\ruby\bin/rdebug-ide:19
-e:1:in `load'
-e:1
Uncaught exception: undefined method `namespace' for main:Object
Process finished with exit code 1
Code snippet (It fails at the start of namespace. If I remove this, it fails on the next line, etc, etc)
#This script should run every 15 minutes
require 'snmp'
require 'yaml'
namespace :cdeweb do
RubyGems Environment:
RUBYGEMS VERSION: 1.3.7 RUBY VERSION:
1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] INSTALLATION
DIRECTORY:
C:/InstantRails/ruby/lib/ruby/gems/1.8
RUBY EXECUTABLE:
C:/InstantRails/ruby/bin/ruby.exe
EXECUTABLE DIRECTORY:
C:/InstantRails/ruby/bin RUBYGEMS
PLATFORMS:
ruby
x86-mswin32-60
GEM PATHS:
C:/InstantRails/ruby/lib/ruby/gems/1.8
C:/Users/Paul.LPFSYSTEMS/.gem/ruby/1.8
GEM CONFIGURATION:
:update_sources => true
:verbose => true
:benchmark => false
:backtrace => false
:bulk_threshold => 1000
REMOTE SOURCES:
http://rubygems.org/
* LOCAL GEMS *
actionmailer (2.3.5, 2.0.2)
actionpack (2.3.5, 2.0.2)
activerecord (2.3.5, 2.0.2)
activeresource (2.3.5, 2.0.2)
activesupport (2.3.5, 2.0.2)
capistrano (2.5.18, 2.1.0)
cgi_multipart_eof_fix (2.5.0)
cmdparse (2.0.2) columnize (0.3.1)
fxri (0.3.7, 0.3.6) fxruby (1.6.12 mswin32)
gem_plugin (0.2.3)
highline(1.5.2, 1.4.0)
hpricot (0.8.2 x86-mswin32, 0.6 mswin32)
inaction_mailer (0.6)
json (1.4.2 x86-mswin32)
json_pure (1.4.2)
linecache (0.43 mswin32)
log4r (1.1.7, 1.0.5)
mongrel (1.1.5 x86-mswin32-60, 1.1.2 mswin32)
mysql(2.8.1 x86-mswin32, 2.7.3 mswin32)
needle (1.3.0)
net-scp (1.0.2)
net-sftp (2.0.4, 1.1.0)
net-ssh (2.0.22, 1.1.2)
net-ssh-gateway (1.0.1)
rack (1.0.1)
rails (2.3.5, 2.0.2)
rake (0.8.7, 0.8.1, 0.8.0, 0.7.3)
ruby-debug-base (0.10.3 mswin32)
ruby-debug-ide (0.4.9)
ruby-net-ldap (0.0.4)
rubygems-update (1.3.7, 1.3.6, 1.0.1)
snmp (1.0.2)
sources (0.0.1)
sqlite3-ruby (1.2.5 x86-mswin32, 1.2.1 mswin32)
win32-api (1.4.6 x86-mswin32-60, 1.0.4 mswin32)
win32-clipboard (0.5.2, 0.4.3)
win32-dir (0.3.6, 0.3.2)
win32-eventlog (0.5.2, 0.4.6)
win32-file (0.6.3, 0.5.4)
win32-file-stat (1.3.4, 1.2.7)
win32-process (0.6.2, 0.5.3)
win32-sapi (0.1.5, 0.1.4)
win32-sound (0.4.2, 0.4.1)
windows-api (0.4.0, 0.2.0)
at least ruby-mine 2.0.1 does not work with the latest ruby-debug-ide (0.4.9)
see http://pivotallabs.com/users/david/blog/articles/1167-make-the-rubymine-2-0-1-debugger-work-for-you-

Resources