Ruby syntax in chef recipe - ruby

Guys I have no clue in ruby but forced to play around with a chef recipe. Can someone help me with a syntax issue ?
These line is causing problems when I run the recipe
old_configs = node["monitoring"]["configs"] || []
And the exception is :
NoMethodError: undefined method `[]' for nil:NilClass /var/chef/cache/cookbooks/collectd/recipes/default.rb:100:in `from_file'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/mixin/from_file.rb:30:in `from_file'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/cookbook_version.rb:237:in `load_recipe'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/run_context.rb:151:in `load_recipe'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/run_context/cookbook_compiler.rb:139:in `block in compile_recipe
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/run_context/cookbook_compiler.rb:137:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/run_context/cookbook_compiler.rb:137:in `compile_recipes'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/run_context/cookbook_compiler.rb:74:in `compile'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/run_context.rb:86:in `load'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:249:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:492:in `do_run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:199:in `block in run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:193:in `fork'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/client.rb:193:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application.rb:183:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application/client.rb:302:in `block in run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application/client.rb:294:in `loop'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application/client.rb:294:in `run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/application.rb:66:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/bin/chef-client:26:in `<top (required)>'

This is probably caused by the fact that the node "monitoring" attribute does not exist, you should first check that node["monitoring"] exists, before trying to lookup node["monitoring"]["configs"]
The simple way to do it would be:
if node["monitoring"]
old_configs = node["monitoring"]["configs"] || []
end

Related

Homestead vagrant up error

/Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:169:in `+': no implicit conversion of nil into String (TypeError)
from /Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:169:in `block (2 levels) in configure'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/kernel_v2/config/vm_provisioner.rb:72:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/kernel_v2/config/vm_provisioner.rb:72:in `add_config'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/kernel_v2/config/vm.rb:324:in `provision'
from /Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:168:in `block in configure'
from /Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:157:in `each'
from /Users/shaddeler/Developer/run/Homestead/scripts/homestead.rb:157:in `configure'
from /Users/shaddeler/Developer/run/Homestead/Vagrantfile:30:in `block in <top (required)>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/v2/loader.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/v2/loader.rb:37:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:107:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:107:in `block in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:104:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/config/loader.rb:104:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/vagrantfile.rb:28:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:746:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:746:in `vagrantfile'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:492:in `host'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:214:in `block in action_runner'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:33:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:33:in `run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:479:in `hook'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:728:in `unload'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/bin/vagrant:177:in `ensure in <main>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/bin/vagrant:177:in `<main>'
I enfaced this error while vagrant up
I had this problem too. Instead of a wrong indentation, I accidentally added another dash ( - ) to my Homestead.yaml file.
For example, this is the incorrect one:
- map: testing.khc.my
- to: /home/vagrant/code/testing/public
The correct one is this:
- map: testing.khc.my
to: /home/vagrant/code/testing/public
Hope this help everyone in the future.
I got this error too and it's a real pain. The source of the problem is a wrong indentation in the Homestead.yaml file. Check if you're using spaces or tabs.

vagrant undefined local variable or method in synce folders

my vagrantfile work perfectly but when i uncomment synce folder and set it to real path and make vagrant reload it return a exception:
/Users/pedrammarandi/pedram/Vagrantfile:41:in `block in <top (required)>': undefined local variable or method `“' for main:Object (NameError)
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/loader.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/v2/loader.rb:37:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/loader.rb:103:in `block (2 levels) in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/loader.rb:97:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/loader.rb:97:in `block in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/loader.rb:94:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/config/loader.rb:94:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/vagrantfile.rb:28:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:689:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:689:in `vagrantfile'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:441:in `host'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:207:in `block in action_runner'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:33:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/action/runner.rb:33:in `run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:428:in `hook'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:671:in `unload'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/bin/vagrant:177:in `ensure in <main>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/bin/vagrant:177:in `<main>'
line 41:
config.vm.synced_folder “/”, “/var/www/pedram.dev”
you have something wrong with the funky character `“' and vagrant is telling your about it
undefined local variable or method `“'
maybe some copy/paste from ms word or something just put simple "
config.vm.synced_folder "/", "/var/www/pedram.dev"
it will run smoothly

NoMethodError (undefined method `slice!' for nil:NilClass) from Redis call

I'm randomly getting the following error message. Does anyone have any ideas what could be causing this?
NoMethodError (undefined method `slice!' for nil:NilClass):
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:274:in `read'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:248:in `block in read'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:236:in `io'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:247:in `read'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `block in call'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:217:in `block (2 levels) in process'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:353:in `ensure_connected'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:207:in `block in process'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:292:in `logging'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:206:in `process'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `call'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:789:in `block in get'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:37:in `block in synchronize'
/usr/local/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:37:in `synchronize'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:788:in `get'
vendor/bundle/ruby/2.1.0/gems/redis-store-1.1.4/lib/redis/store/interface.rb:5:in `get'
vendor/bundle/ruby/2.1.0/gems/redis-store-1.1.4/lib/redis/store/marshalling.rb:17:in `get'
vendor/bundle/ruby/2.1.0/gems/redis-activesupport-4.0.0/lib/active_support/cache/redis_store.rb:169:in `read_entry'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:312:in `block in read'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:548:in `instrument'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:311:in `read'
/var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/store.rb:34:in `get'
/var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/scoped_store.rb:13:in `fetch'
/var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/preferable_class_methods.rb:13:in `block in preference'
/var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/preferable.rb:43:in `get_preference'
vendor/bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/lib/spree/core/controller_helpers/ssl.rb:8:in `block (2 levels) in <module:SSL>'
The last place Spree is hit before calling redis-rb:
unless (val = #cache.read(key)).nil?
return val
end
where #cache = Rails.cache
UPDATE
I am using this gem with this SSL plugin, so the error may be related to the plugin.
The error happens when line = #sock.gets is nil. Here's the locals right after that is determined to be true.
[1] pry(#<Redis::Connection::Ruby>)> line
=> nil
[2] pry(#<Redis::Connection::Ruby>)> #sock
=> #<OpenSSL::SSL::SSLSocket:0x007fdab2688730
#callback_state=nil,
#context=
#<OpenSSL::SSL::SSLContext:0x007fdab2688758
#ca_file=nil,
#ca_path=nil,
#cert=nil,
#cert_store=nil,
#client_ca=nil,
#client_cert_cb=nil,
#extra_chain_cert=nil,
#key=nil,
#npn_protocols=nil,
#npn_select_cb=nil,
#options=nil,
#renegotiation_cb=nil,
#servername_cb=nil,
#session_get_cb=nil,
#session_id_context=nil,
#session_new_cb=nil,
#session_remove_cb=nil,
#timeout=nil,
#tmp_dh_callback=nil,
#verify_callback=nil,
#verify_depth=nil,
#verify_mode=nil>,
#eof=true,
#hostname=nil,
#io=#<Redis::Connection::TCPSocket:fd 11>,
#rbuffer="",
#sync=true,
#sync_close=false,
#wbuffer="">
[3] pry(#<Redis::Connection::Ruby>)> #sock.closed?
=> false
This looks like this could be an issue with the ruby redis client.
You could try downgrading a version and/or filing an issue for the redis team in the Github repository.

Neoid error when starting Rails server

Having looked into it, and as a relative newbie to graph databases, I've decided that Neoid may be the best way to benefit from Neo4j at this stage. I've come across a problem straight after installing it, on starting up the server. I've installed the gem, added the 01_neo4j.rb file as stated on the github page, added the relevant columns to the models and get the following error:
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:35:in `initialize': No such file or directory - /dev/null (Errno::ENOENT)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/logger.rb:599:in `create_logfile'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/logger.rb:594:in `open_logfile'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/logger.rb:549:in `initialize'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/logger.rb:314:in `new'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/logger.rb:314:in `initialize'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/neoid-0.1.2/lib/neoid.rb:73:in `new'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/neoid-0.1.2/lib/neoid.rb:73:in `logger'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/neoid-0.1.2/lib/neoid.rb:52:in `initialize_all'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/neoid-0.1.2/lib/neoid/railtie.rb:7:in `block (2 levels) in <class:Railtie>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:180:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from C:/Sites/Knock4/config/environment.rb:5:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from C:/Sites/Knock4/config.ru:3:in `block in <main>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from C:/Sites/Knock4/config.ru:in `new'
from C:/Sites/Knock4/config.ru:in `<main>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
If anyone has any idea what the problem might be here, I would appreciate it. I'm using Rails 4.0.2 (as you can probably see), so not sure if this is an issue.
The error reference shows the following code:
def open(name, *rest, &block) # :doc:
if name.respond_to?(:open)
name.open(*rest, &block)
elsif name.respond_to?(:to_str) &&
%r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ name &&
(uri = URI.parse(name)).respond_to?(:open)
uri.open(*rest, &block)
else
open_uri_original_open(name, *rest, &block)
end
end
With
open_uri_original_open(name, *rest, &block)
being line 35. I have no idea what this means though!
This is caused, on windows, by neoid 0.1.2 which assumes you are on unix and so the standard logger redirects to dev/null. So you must define
ENV['NEOID_LOG'] ||= 'true'
ENV['NEOID_LOG_FILE'] ||= 'log/neoid.log'
and the log will be in the log folders.

Undefined method 'strip' when deploying Sinatra Application using capistrano

I'm getting a strange error when running cap deploy:setup:
cap deploy:setup
Using ActiveModel validations.
Validations included SimpleRecord::Base
New Aws::SdbInterface using per_thread-connection mode
New Aws::S3Interface using per_thread-connection mode
/Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/command.rb:24:in `initialize': undefined method `strip' for Sinatra::Application:Class (NoMethodError)
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/command.rb:109:in `new'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/command.rb:109:in `else'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/actions/invocation.rb:144:in `block in run'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/command.rb:101:in `initialize'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/actions/invocation.rb:144:in `new'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/actions/invocation.rb:144:in `run'
from Capfile:9:in `load'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/loading.rb:93:in `load'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/cli/execute.rb:65:in `each'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/cli/execute.rb:31:in `execute!'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/gems/capistrano-2.5.21/bin/cap:4:in `<top (required)>'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/bin/cap:19:in `load'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136#sinatra/bin/cap:19:in `<main>'
Any ideas on how to troubleshoot this?
It turns out the MyApp.rb did not actually define class MyApp. I added this:
class MyApp < Sinatra::Base
that error is now cleared.

Resources