NoMethodError on Rails Vulcanize with Rubber - ruby-on-rails

I am very new to rails and am trying to get my app setup via rubber. I was able to get a test app up without issue but am running into some sort of error when actually trying to vulcanize my built app. Tried to search high and low to no avail. Anyone have any idea what I need to do to get rid of the issue? Much appreciated.
localhost:thiswins markhayden$ rubber vulcanize complete_passenger_nginx_mysql
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rubber-2.2.4/lib/rubber/commands/vulcanize.rb:53:in `block in <class:Vulcanize>': undefined method `-' for "complete_passenger_nginx_mysql":String (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/attribute/declaration.rb:33:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/attribute/declaration.rb:33:in `block in define_writer_for'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:13:in `block (2 levels) in parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:12:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:12:in `block in parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:10:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:10:in `parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:55:in `parse'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:68:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/subcommand/execution.rb:11:in `execute'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:69:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:127:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rubber-2.2.4/bin/rubber:17:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/rubber:19:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/rubber:19:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'

We had this same problem with:
rubber vulcanize complete_passenger_postgresql
It seems to be an error in the gem at rubber/commands/vulcanize.rb on Line 53 because it tries to subtract an array from a string which is illegal. I changed it to (as sudo):
invalid = (arg.kind_of?(String) ? [arg] : arg) - VulcanizeThor.valid_templates
This allowed setup however I am not sure if the vulcanization did more than it was supposed to have because I am also new to Rubber. This was a drastic measure so be careful by trying it on a non-production environment first!

Related

rails console not working due to no remaing live threads

I made a ActiveJob class for a background work collecting some data from the server and storing the data to my DB.
To make the job working, I added some trigger code as
# in config/environment.rb
MyJob.perform_later
# the perform method
def perform(*args)
update_db
MyJob.set(wait: 1.minutes).perform_later
end
But, after that suddenly, bin/rails console stoped working.
My rails version is '7.0.4' and ruby version is '3.1.2'
The error log is following:
$ ./bin/rails console
.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.4/lib/active_record/base.rb:282:in `<module:ActiveRecord>': No live threads left. Deadlock? (fatal)
3 threads, 3 sleeps current:0x000000010b0e22b0 main thread:0x0000000139e04610
* #<Thread:0x0000000100fa4d48 sleep_forever>
rb_thread_t:0x0000000139e04610 native:0x000000010103c580 int:0
* #<Thread:0x0000000106403e48#DEBUGGER__::SESSION#server .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:154 sleep_forever>
rb_thread_t:0x000000010a6b9190 native:0x000000016f1b7000 int:0
* #<Thread:0x00000001065f1b60#worker-1 .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:332 sleep_forever>
rb_thread_t:0x000000010b0e22b0 native:0x000000016f3c3000 int:0
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.4/lib/active_record/base.rb:15:in `<main>'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb:35:in `require'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.4/lib/active_record/railtie.rb:62:in `block in <class:Railtie>'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/railtie.rb:273:in `block in run_console_blocks'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/railtie.rb:298:in `each'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/railtie.rb:298:in `each_registered_block'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/railtie.rb:273:in `run_console_blocks'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/application.rb:526:in `block in run_console_blocks'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine/railties.rb:15:in `each'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine/railties.rb:15:in `each'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/application.rb:526:in `run_console_blocks'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:449:in `load_console'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:35:in `initialize'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:19:in `new'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:19:in `start'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:102:in `perform'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from ./bin/rails:4:in `<main>'
I have searched any way to solve this problem but, I couldn't.
I just guess this problem is about the thread of ActiveJob or updating ActiveRecord(DB).
Please give me some help.
Thanks in advance!
The problem is caused by "MyJob.perform_later" in the "environment.rb" file. After I move the line to "config.after_initialize" block in "config/application.rb" file, I can use the console.

undefined local variable or method `count_notification' for #Spec::Runner::TeamcityFormatter

Upgraded to latest rubymine 6.3 and while trying to run all the specs using spec configuration coming across the issue. Looking at the logs looks like a rubymine issue. Any idea how to fix this issue?
/Applications/RubyMine.app/rb/testing/patch/bdd/teamcity/spec/runner/formatter/teamcity/rspec3_formatter.rb:250:in `dump_summary': undefined local variable or method `count_notification' for #<Spec::Runner::Formatter::TeamcityFormatter:0x007f8d338fd3e8> (NameError)
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:134:in `block in notify'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:133:in `each'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:133:in `notify'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:116:in `finish'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:55:in `ensure in report'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/reporter.rb:55:in `report'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:107:in `run_specs'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:85:in `run'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69:in `run'
from /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37:in `invoke'
from /Users/ac027466/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/exe/rspec:4:in `<main>'
/Users/xxxxx/.rvm/rubies/ruby-2.1.3/bin/ruby -I/Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/lib:/Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-support-3.1.2/lib /Users/xxxxx/.rvm/gems/ruby-2.1.3/gems/rspec-core-3.1.7/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
Updating to rubymine 6.3.3 fixed the issue for me.

Error: uninitialized constant Sprockets::Helpers when pushing to Heroku

I just installed carrierwave and have set my rails 4 app up to store images on Amazon s3 through fog. The app was working and deploying to Heroku with Carrierwave (but images were getting purged with dyno). After some initial issues I got it working on my localhost (as far as I could tell).
Now I am having trouble pushing the new version to Heroku. I have reset the DATABASE. Precompiled the assets and now trying to migrate the database. Below is the error I'm getting.
Running `rake db:migrate` attached to terminal... up, run.6517
rake aborted!
uninitialized constant Sprockets::Helpers
/app/app/uploaders/image_uploader.rb:12:in `<class:ImageUploader>'
/app/app/uploaders/image_uploader.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/app/config/environment.rb:5:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
I have tried to include and not include Sprockets in the Uploader file and get the same error either way. I understand that Sprockets is no longer included in the master for Rails 4. I have now installed the sprockets-rails and sprockets-helper gems. I have also tried to require them at the top of the file (I don't understand this completely, but following this suggestion https://github.com/petebrowne/sprockets-helpers). Nothing has worked. Any suggestions about how I can go about resolving this. How do I initialize Sprockets::Helpers. Thanks.
I was making a pretty silly mistake. I had corrected files in my app and as committing the changes to the master, but I kept running the heroku run rake db:migrate command and getting the same error, so I didn't think I have resolved it yet. I had forgotten to push the new version to heroku! Hence the reason for still getting the same error.
Also, in case anyone else has a similar issue. Make sure you have fixed this:
https://github.com/carrierwaveuploader/carrierwave/issues/1020

rails generate mailer psych.rb parse bug

I am new to ruby and rails and was working to setup my first mailer, and when I run the generate command my setup is blowing up. I am currently running ruby-1.9.3-p374 and have been searching for awhile now for a fix for this. My other generate commands work fine, just this one seems to be borked. Thoughts?
rails generate mailer UserMailer
/Users/chrishough/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 4 column 12 (Psych::SyntaxError)
from /Users/chrishough/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from /Users/chrishough/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:151:in `parse'
from /Users/chrishough/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:127:in `load'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/figaro-0.6.3/lib/figaro.rb:21:in `raw'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/figaro-0.6.3/lib/figaro.rb:17:in `env'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/figaro-0.6.3/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:34:in `call'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/railties-3.2.13/lib/rails/application.rb:67:in `inherited'
from /Users/chrishough/Huedio/Code/Profiles/config/application.rb:27:in `<module:Profiles>'
from /Users/chrishough/Huedio/Code/Profiles/config/application.rb:26:in `<top (required)>'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/railties-3.2.13/lib/rails/commands.rb:24:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/railties-3.2.13/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
If you are using the figaro gem and your generators start blowing up, here is what killed me. In my application.yml file I had removed a space between the environment variable name and what it was set to. Instead of this =>> MY_VARIABLE:"VARIABLE" I needed to have this ==> MY_VARIABLE: "VARIABLE"
Hopefully this will save others TIME!

uninitialized constant when migrating rails from ubuntu to osx

i'm trying to move my rails app from ubuntu to osx. when running rspec, i get the following obscure error:
/Users/josh/dev/myproject/spec/support/devise.rb:3:in `block in <top (required)>': uninitialized constant RequestHelpers (NameError)
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core.rb:92:in `configure'
from /Users/josh/dev/myproject/spec/support/devise.rb:1:in `<top (required)>'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `block (2 levels) in <top (required)>'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `each'
from /Users/josh/dev/myproject/spec/spec_helper.rb:21:in `block in <top (required)>'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/spork-0.9.2/lib/spork.rb:24:in `prefork'
from /Users/josh/dev/myproject/spec/spec_helper.rb:4:in `<top (required)>'
from /Users/josh/dev/myproject/spec/controllers/comments_controller_spec.rb:1:in `require'
from /Users/josh/dev/myproject/spec/controllers/comments_controller_spec.rb:1:in `<top (required)>'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:66:in `rescue in run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:62:in `run'
from /Users/josh/.rvm/gems/ruby-1.9.3-p286#myproject/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
everything works nicely in Ubuntu, so i guess it must be environmental. Any ideas where to start digging?
thanks
- Josh
EDIT: no idea why, but the file request_helpers.rb could not be found by rake. moving it elsewhere resolved the issue.
This hardly seems an operating system problem, much rather a matter of configuration. Make sure your environemnt is the same in terms of:
using rvm installed the same way
having all the needed gems in the Gemfile
using bundle to execute rspec
using the same version of everything.
By te way this is not an obscure message, it's in fact pretty clear:
uninitialized constant RequestHelpers (NameError)
so the spec/support/devise.rb file can't find the needed class.
Have you written that file? If not, how did you generate it? Repeat the procedure to generate it (probably rake something or rails generate something) and it will be OK.

Resources