Test-First Learn_Ruby 00_hello Rake aborted - ruby

Your help would be MUCH appreciated. I am new to programming and want am trying to start alexch's Learn_Ruby, but am stuck on the very first lesson: 00_hello.
I am running "rake" test am am getting weird errors:
Justins-MacBook-Pro:00_hello Justin$ rake
(in /Users/Justin/Desktop/learn_ruby-master)
rake aborted!
undefined method `gem' for main:Object
/Users/Justin/Desktop/learn_ruby-master/Rakefile:2
(See full trace by running task with --trace)
I'm just following the instructions from the course: https://github.com/alexch/learn_ruby/blob/master/index.html
here are my specs:
ruby 1.8.7
rspec 2.12
gem 1.8.25
anything thing else i'm missing??
Your Help is MUCH appreciate.
here is the gem list:
Justins-MacBook-Pro:00_hello Justin$ gem list
*** LOCAL GEMS ***
activemodel (3.2.11)
activerecord (3.2.11)
activesupport (3.2.11)
arel (3.0.2)
builder (3.1.4, 3.0.4)
diff-lcs (1.2.0, 1.1.3)
i18n (0.6.1)
multi_json (1.5.0)
rspec (2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
rspec-mocks (2.12.2)
rubygems-update (1.8.25)
tzinfo (0.3.35)
uuidtools (2.1.3)

First update rubygems by following command:
gem update --system
That should solve it.
If not then try removing the following line from the rakefile
gem 'rspec', '~>2'

Related

test-first- ruby 00_hello parse error: OptionParser::InvalidOption

I am having a hard time figure out the first lesson on Test-First Ruby (Alex Chaffee), I am running "rake" test and am getting errors that I am not supposed to receive.
I already tried doing the gem update --system and removing spaces as suggested in previous posts. None of this solved the problem.
Bellow are my specs and errors received.
I will appreciate any help.
ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
C:\Users\Greice>gem list
*** LOCAL GEMS ***
activemodel (4.1.4)
activerecord (4.1.4)
activesupport (4.1.4)
arel (5.0.1.20140414130214)
bigdecimal (1.2.5, 1.1.0)
builder (3.2.2)
bundler (1.6.5)
diff-lcs (1.2.5)
feedtools (0.2.29)
hpricot (0.8.6)
i18n (0.6.11)
io-console (0.4.2, 0.3)
json (1.8.1, 1.5.5)
minitest (5.4.0, 2.5.1)
rake (10.3.2, 0.9.2.2)
rdoc (4.1.1, 3.9.5)
RedCloth (4.2.9 x86-mingw32)
rspec (3.0.0, 2.0.1)
rspec-core (3.0.3, 2.0.1)
rspec-expectations (3.0.3, 2.0.1)
rspec-mocks (3.0.3, 2.0.1)
rspec-support (3.0.3)
rubygems-update (2.4.1)
sunlight-congress (1.1.0)
thread_safe (0.3.4)
tzinfo (1.2.1)
uuidtools (2.1.4)
C:\Users\Greice\Desktop\test-first-ruby-master>cd 00_hello
C:\Users\Greice\Desktop\test-first-ruby-master\00_hello>rake
(in C:/Users/Greice/Desktop/test-first-ruby-master)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/option_parse
r.rb:18:in `parse!': invalid option: --warnings (OptionParser::InvalidOption)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/option_parser.rb:4:in `parse!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/configuration_options.rb:78:in `parse_options_file'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/configuration_options.rb:74:in `parse_global_options'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/configuration_options.rb:48:in `parse_options'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/runner.rb:41:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/runner.rb:10:in `block in autorun'
rake aborted!
ruby -S bundle exec rspec -IC:/Users/Greice/Desktop/test-first-ruby-master/00_he
llo -IC:/Users/Greice/Desktop/test-first-ruby-master/00_hello/solution -f docume
ntation -r ./rspec_config "C:/Users/Greice/Desktop/test-first-ruby-master/00_hel
lo/hello_spec.rb" failed
Tasks: TOP => default => spec
(See full trace by running task with --trace)
Rakefile
# This Rakefile has all the right settings to run the tests inside each lab
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.gsub(' ', '\ ')
task.pattern = "#{lab}/*_spec.rb"
task.rspec_opts = [ "-I#{lab}", "-I#{lab}/solution", '-f documentation', '-r ./rspec_config']
task.verbose = false
end
rspec_config.rb
RSpec.configure do |c|
c.fail_fast = true
c.color = true
end
I've seen this before when --warnings was an option in the .rspec file.
Try removing the --warnings line from your .rspec or rspec_config file.

Failed DataMapper Gem install on Win7

I'm learning to use Sinatra + Datamapper to build a lightweight webapp.
I ran gem install sqlite3 datamapper dm-sqlite-adapter and it seemed to have successfully installed...
I then tried to execute my .rb file which starts with:
require 'sinatra'
require 'datamapper'
and I got an error that it could not find the datamapper file.
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- datamapper (LoadError)
I also tried with require 'data_mapper' since there is conflicting information on the internetz as to the correct spelling of that gem, but same result.
I then listed all my installed gems (see below) and realilsed that there is no such gem as datamapper or data_mapper. I read so,ewhere that it is a meta-gem, I guess that means it doesn't actually install that one gem but rather all the gems starting with dm- ?
As a last resort I tried gem install data_mapper
and I got the ill fated:
C:\Users\Manu\Sinatra>gem install data_mapper
Building native extensions. This could take a while...
ERROR: Error installing data_mapper:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
creating Makefile
make
'make' is not recognized as an internal or external command,operable program or batch file.
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.4 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.4/ext/json/ext/parser/gem_make.out
I searched all over and just couldn't find anything to help me troubleshoot this, so hopefully there's someone roaming this forum with a magic wand and a pointy hat!
Many thanks
PS: I'm running ruby 1.9.2p0 installed with the installer
* LOCAL GEMS *
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (3.0.3)
activemodel (3.0.3)
activerecord (3.0.3)
activeresource (3.0.3)
activesupport (3.0.3)
addressable (2.2.6)
arel (2.0.6)
backports (2.3.0)
builder (2.1.2)
bundler (1.0.7)
cgi_multipart_eof_fix (2.5.0)
data_objects (0.10.7)
diff-lcs (1.1.3)
dm-aggregates (1.2.0)
dm-constraints (1.2.0)
dm-core (1.2.0)
dm-do-adapter (1.2.0)
dm-migrations (1.2.0)
dm-sqlite-adapter (1.2.0)
dm-transactions (1.2.0)
do_sqlite3 (0.10.7 x86-mingw32)
erubis (2.6.6)
fastercsv (1.5.4)
gem_plugin (0.2.3)
growl (1.0.3)
i18n (0.5.0)
json_pure (1.6.4)
mail (2.2.12)
mime-types (1.16)
minitest (1.6.0)
mongrel (1.1.5 x86-mingw32)
multi_json (1.0.4)
polyglot (0.3.1)
rack (1.4.0, 1.2.1)
rack-mount (0.6.13)
rack-protection (1.2.0)
rack-test (0.5.6)
rails (3.0.3)
railties (3.0.3)
rake (0.8.7)
rdoc (2.5.8)
rspec (2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
rspec-mocks (2.8.0)
rubygems-update (1.8.15)
sinatra (1.3.2)
sqlite3 (1.3.5 x86-mingw32)
sqlite3-ruby (1.3.3, 1.3.2 x86-mingw32)
sys-uname (0.9.0 x86-mingw32)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.9)
trollop (1.16.2)
tzinfo (0.3.23)
yard (0.7.4)
It seems the RubyInstaller Development Kit is missing:
http://rubyinstaller.org/add-ons/devkit/
The devkit installs a C-compiler (and some other stuff like make) to compile C-written parts.
Install it and try again to install the gem - perhaps with option --platform=ruby.
Details can be found at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

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

Ruby on Rails - New to Ruby help with rake db:migrate

I am a new user to Ruby on Rails and am having an issue with: rake db:migrate.
After I bundle install, the following comes up:
$ bundle install
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using bundler (1.0.18)
Using rdoc (3.9.4)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using sqlite3-ruby (1.2.5)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Then, when I try and rake db:migrate, i get the following:
$ rake db:migrate
Could not find polyglot-0.3.2 in any of the sources
Run `bundle install` to install missing gems.
Anyone have any advice? Thanks.
I am on ruby 1.8.7 and rails 3.0.9
Check where it's installed:
gem list -d polyglot
Run bundle exec to make sure rake uses what's specified in your gemfile:
bundle exec rake db:migrate
Ya..apparently the polyglot gem is not included in your gem file.
Also try doing gem install polyglot...
Hope it helps !
bundle exec rake db:migrate might help too..

Ruby undefined method error using Deprecate.skip_during

I am trying to install Gitorious in my local computer. However I get this error when I execute the console application:
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:194:in
block in stub_source_index170':
undefined methodskip_during' for
Bundler::RubygemsIntegration::Deprecate:Class
(NoMethodError)
The ruby code that is executing in /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb is:
def stub_source_index170(specs)
Gem::SourceIndex.send(:define_method, :initialize) do |*args|
#gems = {}
# You're looking at this thinking: Oh! This is how I make those
# rubygems deprecations go away!
#
# You'd be correct BUT using of this method in production code
# must be approved by the rubygems team itself!
#
# This is your warning. If you use this and don't have approval
# we can't protect you.
#
Deprecate.skip_during do
self.spec_dirs = *args
add_specs(*specs)
end
end
end
I guess the error occurs because the deprecate module is not loaded or something like that... I don't know ruby... but how can I try to correct it?
I have ruby 1.9.1p431 (2011-02-18 revision 30908) with gem 1.8.5
List of gems:
* LOCAL GEMS *
actionmailer (2.3.5) actionpack
(2.3.5) activerecord (2.3.8, 2.3.5)
activeresource (2.3.5) activesupport
(2.3.8, 2.3.5) acts-as-taggable-on
(2.0.6) builder (3.0.0) bundler
(1.0.15) chronic (0.3.0)
daemon_controller (0.2.6) daemons
(1.1.0) diff-lcs (1.1.2) echoe (4.3.1)
eventmachine (0.12.10)
exception_notification (1.0.20090728)
factory_girl (1.3.3) fastthread
(1.0.7) gemcutter (0.6.1) geoip
(0.8.9) hoe (2.8.0) json_pure (1.5.0)
mime-types (1.16) mocha (0.9.10) mysql
(2.8.1) oauth (0.4.4) paperclip
(2.2.9.2) passenger (3.0.7)
proxymachine (1.2.4) rack (1.0.1)
rails (2.3.5) rake (0.8.7) rdiscount
(1.3.1.1) revo-ssl_requirement (1.1.0)
riddle (1.2.2) rmagick (2.13.1)
ruby-hmac (0.4.0) ruby-openid (2.1.8)
ruby-yadis (0.3.4) rubyforge (2.0.4)
shoulda (2.9.2) state_machine (0.9.4)
stomp (1.1) stompserver (0.9.9) tuxml
(0.0.1) validates_url_format_of
(0.1.1) will_paginate (2.3.15)
Many thanks in advance.
Carlos.
Newer versions of Rubygems are deprecating some old internal methods. You can downgrade Rubygems with gem update --system 1.x.y (e.g. 1.5.2) to see if that solves your problem.
Deprecate was namespaced to Gem::Deprecate. You can temporary patch it:
Gem::Deprecate.skip_during do
self.spec_dirs = *args
add_specs(*specs)
end

Resources