Difference between revisions of "Ruby on Rails"

From Tmplab
(New page: = Fast commands = * Help yourself, use BORT for application baseline = Troubleshooting = == Gems == * gem install <gemname> ** if it breaks, try to do: gem install ** if it still break...)
 
(Gems)
Line 13: Line 13:
 
  gem 'myproblemgem', '1.2.1'
 
  gem 'myproblemgem', '1.2.1'
 
     e.g. gem 'capistrano-ext', '1.2.1'
 
     e.g. gem 'capistrano-ext', '1.2.1'
** then look at the problem, for example this session shows that the "echoe" gem is not installed:
+
 
When running script/server:
+
** then look at the problem, for example this session shows that the "echoe" gem is not installed. When running script/server:
 +
 
 
  /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
 
  /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
 
  script/server:3
 
  script/server:3
Line 26: Line 27:
 
  Run `rake gems:install` to install the missing gems.
 
  Run `rake gems:install` to install the missing gems.
 
   
 
   
well... indeed Captistrano-ext IS installed:
+
well... indeed Captistrano-ext IS installed:
 +
 
 
  $ ls -ald /usr/local/lib/ruby/gems/1.8/gems/cap*
 
  $ ls -ald /usr/local/lib/ruby/gems/1.8/gems/cap*
 
  drwxr-xr-x  12 root  wheel  408 Jan 20 12:11 /usr/local/lib/ruby/gems/1.8/gems/capistrano-2.5.3
 
  drwxr-xr-x  12 root  wheel  408 Jan 20 12:11 /usr/local/lib/ruby/gems/1.8/gems/capistrano-2.5.3
Line 32: Line 34:
 
   
 
   
 
   
 
   
but running the code with irb gives more details:
+
but running the code with irb gives more details:
  irb
+
 
 +
$ irb
 
  >> require 'rubygems'
 
  >> require 'rubygems'
 
  => false
 
  => false
Line 53: Line 56:
 
         from (irb):2
 
         from (irb):2
 
   
 
   
So a simple:
+
So a simple:
 +
 
 
  # gem install echoe
 
  # gem install echoe
 
  Successfully installed echoe-3.0.2
 
  Successfully installed echoe-3.0.2
Line 60: Line 64:
 
  Installing RDoc documentation for echoe-3.0.2...
 
  Installing RDoc documentation for echoe-3.0.2...
 
   
 
   
fixed the problem... well... you get the idea: there's a broken dependency in captistrano-ext for echoe....
+
fixed the problem... well... you get the idea: there's a broken dependency in captistrano-ext for echoe....

Revision as of 15:50, 20 January 2009

Fast commands

  • Help yourself, use BORT for application baseline

Troubleshooting

Gems

  • gem install <gemname>
    • if it breaks, try to do:
gem install
    • if it still breaks, try to do:
irb
require 'rubygems'
gem 'myproblemgem', '1.2.1'
   e.g. gem 'capistrano-ext', '1.2.1'
    • then look at the problem, for example this session shows that the "echoe" gem is not installed. When running script/server:
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3
Missing these required gems:
  capistrano-ext  = 1.2.1

You're running:
  ruby 1.8.7.22 at /usr/local/bin/ruby
  rubygems 1.2.0 at /usr/local/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.

well... indeed Captistrano-ext IS installed:

$ ls -ald /usr/local/lib/ruby/gems/1.8/gems/cap*
drwxr-xr-x   12 root  wheel  408 Jan 20 12:11 /usr/local/lib/ruby/gems/1.8/gems/capistrano-2.5.3
drwxr-xr-x    9 root  wheel  306 Jan 20 13:00 /usr/local/lib/ruby/gems/1.8/gems/capistrano-ext-1.2.1


but running the code with irb gives more details:

$ irb
>> require 'rubygems'
=> false
>> gem 'capistrano-ext', '1.2.1'
Gem::LoadError: Could not find RubyGem echoe (>= 0)

        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:578:in `report_activate_error'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:134:in `activate'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:158:in `activate'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:157:in `each'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:157:in `activate'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:158:in `activate'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:157:in `each'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:157:in `activate'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:158:in `activate'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:157:in `each'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:157:in `activate'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
        from (irb):2

So a simple:

# gem install echoe
Successfully installed echoe-3.0.2
1 gem installed
Installing ri documentation for echoe-3.0.2...
Installing RDoc documentation for echoe-3.0.2...

fixed the problem... well... you get the idea: there's a broken dependency in captistrano-ext for echoe....