Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Guardfile - how should I debug? #1

Closed
jonallured opened this issue Sep 1, 2011 · 4 comments
Closed

Invalid Guardfile - how should I debug? #1

jonallured opened this issue Sep 1, 2011 · 4 comments

Comments

@jonallured
Copy link

I'm new to Guard and I'm having a hard time getting this gem working. I was able to get other guards working, but not this one. When I try to use it, I get this error:

ERROR: Invalid Guardfile, original error is:
undefined method `keys' for nil:NilClass

Here's what's in my Guardfile:

opts = {
:hostname => "somehost",
:user => "someuser",
:remote => "somepath",
:debug => true,
:growl => true
}

group 'flopbox' do
guard 'flopbox', opts do
watch(/.*/)
end
end

Basically the default from the README. I just don't know how to debug this error message, seems like it could be anything...

Thanks!
Jon

@sgtpep
Copy link

sgtpep commented Sep 26, 2011

The same for me. Trying to investigate (but sadly I don't know Ruby well).

@vincentchu
Copy link
Owner

Can you guys provide a backtrace? Cheers.

@jonallured
Copy link
Author

Hi Vincent,

There's no backtrace, here's my complete terminal output:

$ guard
ERROR: Invalid Guardfile, original error is:
undefined method `keys' for nil:NilClass

But then it occurred to me that since the Guardfile is just Ruby, I could wrap the blocks in a before/rescue and then get a backtrace that way, so I altered the Guardfile like this:

begin
  group 'flopbox' do
    guard 'flopbox', opts do
      watch(/.*/)
    end
  end
rescue Exception => e
  puts e.inspect
  puts e.backtrace
end

And then this is the terminal output I get:

$ guard
#<NoMethodError: undefined method `keys' for nil:NilClass>
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/net-ssh-2.2.1/lib/net/ssh.rb:160:in `start'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/net-sftp-2.0.5/lib/net/sftp.rb:31:in `start'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-flopbox-1.4/lib/guard/flopbox.rb:12:in `initialize'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard.rb:89:in `new'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard.rb:89:in `add_guard'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard/dsl.rb:130:in `guard'
/Users/jon/Desktop/guard_test/Guardfile:16:in `block in instance_eval_guardfile'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard/dsl.rb:121:in `call'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard/dsl.rb:121:in `group'
/Users/jon/Desktop/guard_test/Guardfile:15:in `instance_eval_guardfile'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard/dsl.rb:27:in `instance_eval'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard/dsl.rb:27:in `instance_eval_guardfile'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard/dsl.rb:11:in `evaluate_guardfile'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard.rb:34:in `start'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/lib/guard/cli.rb:17:in `start'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.6.3/bin/guard:6:in `<top (required)>'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/bin/guard:19:in `load'
/Users/jon/.rvm/gems/ruby-1.9.2-p180/bin/guard:19:in `<main>'

Does that help?

Thanks!
Jon

@vincentchu
Copy link
Owner

jonallurd --

Your options need to include a key called :sftp_options which should be a additional options hash to the box you're trying to SFTP to. If you don't want to pass any additional options, just leave it blank. For example:

opts = {
  # other options
  :sftp_opts => {}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants