On my OSX system, I'm trying to use Guard-Haml to auto compile my HAML down to HTML. However, when guard is running, and tries to compile, I get the error below, in fig.1. I've installed Bunder and Guard. Due to the NameError: uninitialized constant Guard::Haml::Bundler, I tried, installing guard-bundler as well. But that's hasn't fixed the problem. Any insights on what needs to be done here?
Thanks Tim
...
14:33:05 - ERROR - Guard::Haml failed to achieve its <run_all>, exception was:
> [#0D0BB9E910E9] NameError: uninitialized constant Guard::Haml::Bundler
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-haml-0.5/lib/guard/haml.rb:44:in `run_on_changes'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-haml-0.5/lib/guard/haml.rb:36:in `each'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-haml-0.5/lib/guard/haml.rb:36:in `run_on_changes'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-haml-0.5/lib/guard/haml.rb:32:in `run_all'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:99:in `send'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:99:in `run_supervised_task'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:97:in `catch'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:97:in `run_supervised_task'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:54:in `run'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:175:in `scoped_guards'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:173:in `each'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:173:in `scoped_guards'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:172:in `catch'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:172:in `scoped_guards'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:170:in `each'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:170:in `scoped_guards'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/guard-1.8.0/lib/guard/runner.rb:53:in `run'
> [#0D0BB9E910E9] /Library/Ruby/Gems/1.8/gems/lumberjack-1.0.3/lib/lumberjack.rb:27:in `unit_of_work'
...
fig.1: error output
source 'https://rubygems.org'
group :development do
gem 'execjs'
gem 'therubyracer', :platforms => :ruby
gem 'guard-bundler'
gem 'guard'
gem 'guard-haml'
gem 'guard-livereload'
gem 'libnotify'
gem 'rb-inotify', :require => false
gem 'rb-fsevent', :require => false
gem 'rb-fchange', :require => false
gem 'compass'
gem 'ceaser-easing'
gem 'html5-boilerplate'
end
fig.2: Gemfile
It looks like guard-haml depends on Bundler, but only adds it as development dependency.
I did a quick test with the content in a test.rb
file
::Bundler.root.to_s
Running it with Ruby fails
$ ruby test
test:1:in `<main>': uninitialized constant Bundler (NameError)
But running it with bundle exec
work fine:
$ bundle exec test
So to make guard-haml work you need to run it with Bundler:
$ bundle exec guard