Recent Blog Entries

Capistrano says, "sh: bundle: not found"

Typically, you define your path in /etc/environment. Here's a simple example:

1
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"

That last bit tells the system where Ruby lives. If Ruby isn't in the path, you won't be able to run it or any gem scripts, like bundle.

Unfortunately, neither /etc/environment nor /etc/profile is respected under certain situations, like the way Capistrano works by default.

The solution for me was to edit /etc/bash.bashrc, adding this as the first line:

1
  source /etc/environment

Note: Adding it as the first line allows / encourages it to be overwritten as needed. If you're still having problems, here's one way to get started with troubleshooting:

edit /etc/bash.bashrc to include this
1
  export USES_BASHRC='bashrc'

edit /etc/profile to include this line:
1
   export USES_PROFILE = 'profile'

then see whether either of those environmental variables is around when capistrano connects. From your dev machine, run "cap shell" and you will end up with a "cap>" prompt. type "echo $USES_BASHRC && echo $USES_PROFILE. Here's what I got:

1
2
3
4
5
   cap> echo $USES_BASHRC && echo $USES_PROFILE
   [establishing connection(s) to www.verdacom.com] 
   Password:
    ** [out :: www.verdacom.com] bashrc
    ** [out :: www.verdacom.com]

Thanks to the SliceHost support team for pointing me in the right direction on this one.

REFERENCES
============
http://stefaanlippens.net/bashrc_and_others

[FIX] With Rails 2.3.x, undefined local variable or method `dep' for Gem:Module

I received this message when I ran cucumber tests but not when I used script/console. Kinda strange. Perhaps this is because I didn't configure cucumber for my dev environment?? Anyway, the fix:

1
2
gem uninstall rubygems-update
gem update --system 1.4.3

In the words of Yoda, "Unfortunate this is, and unexpected."

References
=======
Can not install redmine
Gist -- Undefined local variable dep
RubyGems Developers Mailing List
StackOverflow -- How do you downgrade RubyGems

Ask Cucumber with Capybara for inline HTML... now with CSS Selectors!

Two very useful cucumber steps:

1
2
3
4
5
6
7
Then 'display the page' do
  puts "\n\n\n#{page.body.to_s}\n\n\n"
end

Then /^display "([^"]*)"$/ do |selector|
  puts "\n\n\n#{find(selector).native.to_html}\n\n\n"
end

When you're remoting in to your dev machine, you can't use "Then show me the page" because there is no desktop in which to open the browser... so I created "Then display the page". It outputs the HTML to the screen for your examination. This becomes very tedious when pages get long... after some help on the capybara mailing list, I created the second entry, which accepts a CSS selector.