Currently we're using ruby 2.2.3 but I've used rbenv to test different versions and for all of them when I attempt to run rails server, it gives me similar logs:
/Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `require': /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/meta_request-0.7.3/lib/meta_request/railtie.rb:20: syntax error, unexpected '.' (SyntaxError)
Rails.logger&.extend(LogInterceptor)
^
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/meta_request-0.7.3/lib/meta_request.rb:29:in `<top (required)>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.3/lib/bundler.rb:114:in `require'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config/application.rb:16:in `<top (required)>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:79:in `require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Here's /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/meta_request-0.7.3/lib/meta_request/railtie.rb before removing the '.' on line 20:
1. # frozen_string_literal: true
2.
3. require 'rails/railtie'
4.
5. module MetaRequest
6. class Railtie < ::Rails::Railtie
7. initializer 'meta_request.inject_middlewares' do |app|
8. app.middleware.use Middlewares::MetaRequestHandler
9.
10. if defined? ActionDispatch::DebugExceptions
11. app.middleware.insert_before ActionDispatch::DebugExceptions, Middlewares::Headers, app.config
12. else
13. app.middleware.use Middlewares::Headers, app.config
14. end
15.
16. app.middleware.use Middlewares::AppRequestHandler
17. end
18.
19. initializer 'meta_request.log_interceptor' do
20. Rails.logger&.extend(LogInterceptor)
21. end
22.
23. initializer 'meta_request.subscribe_to_notifications' do
24. AppNotifications.subscribe
25. end
26. end
27. end
Then I removed the '.' from line 20 and got the following log:
=> Booting Thin
=> Rails 4.1.14.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/meta_request-0.7.3/lib/meta_request/railtie.rb:20:in `block in <class:Railtie>': undefined method `&' for #<ActiveSupport::Logger:0x007fdbe355c460> (NoMethodError)
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:30:in `run'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/application.rb:300:in `initialize!'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/railtie.rb:194:in `public_send'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/railtie.rb:194:in `method_missing'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config/environment.rb:5:in `<top (required)>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `require'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config.ru:3:in `block in <main>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:55:in `instance_eval'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:55:in `initialize'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config.ru:in `new'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config.ru:in `<main>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:49:in `eval'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:49:in `new_from_string'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:40:in `parse_file'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/server.rb:199:in `app'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/server.rb:50:in `app'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/server.rb:314:in `wrapped_app'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/server.rb:130:in `log_to_stdout'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/server.rb:67:in `start'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Then I removed the '&' and added the '.' back and got this log:
=> Booting Thin
=> Rails 4.1.14.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/airbrake-ruby-2.8.3/lib/airbrake-ruby/notifier.rb:32:in `initialize': :project_id is required (Airbrake::Error)
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/airbrake-ruby-2.8.3/lib/airbrake-ruby.rb:136:in `new'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/airbrake-ruby-2.8.3/lib/airbrake-ruby.rb:136:in `configure'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config/initializers/airbrake.rb:1:in `<top (required)>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:241:in `load'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:241:in `load'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/engine.rb:648:in `block in load_config_initializer'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/notifications.rb:161:in `instrument'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/engine.rb:647:in `load_config_initializer'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/engine.rb:611:in `each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/engine.rb:611:in `block in <class:Engine>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:30:in `run'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:419:in `block in each_strongly_connected_component_from'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:44:in `each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:44:in `tsort_each_child'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:413:in `call'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:413:in `each_strongly_connected_component_from'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/application.rb:300:in `initialize!'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/railtie.rb:194:in `public_send'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/railtie.rb:194:in `method_missing'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config/environment.rb:5:in `<top (required)>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.1.14.2/lib/active_support/dependencies.rb:247:in `require'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config.ru:3:in `block in <main>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:55:in `instance_eval'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:55:in `initialize'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config.ru:in `new'
from /Users/leon.shimizu/Desktop/Spectrio/apps/engage-ds-cms/app/config.ru:in `<main>'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:49:in `eval'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:49:in `new_from_string'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/builder.rb:40:in `parse_file'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/server.rb:199:in `app'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/server.rb:50:in `app'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-1.5.4/lib/rack/server.rb:314:in `wrapped_app'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/server.rb:130:in `log_to_stdout'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/server.rb:67:in `start'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/leon.shimizu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.1.14.2/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I tried to add the log from when I attempted it with ruby 2.4.6, 2.6.10, and 2.7.2 but I ran out of characters.
Also, I wanted to say that I'm currently debugging and researching these errors but I just wanted to ask to see if anyone has seen similar errors.
Also, if you need any more information about what version of certain gems or anything like that, please let me know and I'll add it.
Gemfile:
source 'https://api.rubygems.org'
##############################
# Rails and DB
##############################
gem 'rails', '4.1.14.2'
gem 'rack', '1.5.4'
gem 'rack-cors', '1.0.2', require: 'rack/cors'
gem "rake", '0.9.2.2'
gem 'mysql2', '0.3.20'
gem 'test-unit', '3.1.5'
gem 'rails-erd'
##############################
# Assets (formerly assets group)
##############################
gem 'coffee-rails', '4.0.0'
gem 'uglifier', '>= 1.0.3'
gem "therubyracer", '0.12.2'
gem 'libv8', '3.16.14.13'
gem "less-rails", "3.0.0"
gem "railsstrap", "3.3.4"
gem "font-awesome-rails", "4.4.0.0"
##############################
# Environment
##############################
gem 'dotenv-rails', :groups => [:development, :test, :production]
##############################
# I18n
##############################
gem 'http_accept_language', '2.0.0'
gem 'i18n-js', '3.0.2'
##############################
# Authentication
##############################
# devise is currently at version 4.3.0, but we can't
# upgrade to anything 4.0+ without upgrading to rails 4.
gem 'devise', '3.5.10'
# token authentication for API.
# current version is 1.0.0. we won't be able to upgrade
# until we can upgrade devise to 4.0.
gem 'devise-token_authenticatable', '0.4.10'
# used for password_regex in devise config.
# could this be moved to a validation callback on the user model
# since we are only using the regex capability?
# also, seems unmaintained. currently only supports up to rails 4.0.
gem 'devise_security_extension', '0.10.0'
gem 'cancan', '1.6.3'
gem 'omniauth', '1.4.2'
gem 'omniauth-facebook', '4.0.0'
gem 'omniauth-twitter', '1.2.1'
gem 'omniauth-google-oauth2', '0.4.1'
gem 'omniauth-auth0'
gem 'doorkeeper', '3.1.0'
##############################
# API and Formatting
##############################
gem 'will_paginate', '~> 3.0'
gem 'wicked_pdf', '0.9.8'
gem 'wkhtmltopdf-binary-edge', '~> 0.12.3.0'
gem 'speechmatics', '0.2.1'
##############################
# Model Behavior
##############################
gem 'actionpack-xml_parser', '1.0.2' # XML parameter parsing
gem 'activerecord-session_store', '1.0.0'
gem 'protected_attributes', '1.0.5'
gem 'rails-observers', '0.1.5'
gem 'sidekiq', '5.0.5'
gem 'sidetiq', '0.7.2'
gem 'ancestry', '2.0.0'
gem 'acts-as-taggable-on', '4.0.0'
gem "audited-activerecord", '4.0.0'
gem 'geocoder', '1.6.1'
gem "rails_config", '0.2.5'
gem 'nokogiri', '1.6.0'
gem 'xml-simple', '1.1.5', :require => 'xmlsimple'
gem "rubyzip", "0.9.9"
gem 'google_timezone', '0.0.5'
# Included in Rails 4
#gem 'strong_parameters', '0.2.3'
gem 'acts_as_commentable', '4.0.2'
gem 'acts_as_list', '0.7.2'
gem 'ransack', '1.8.4'
gem 'ice_cube', '0.14.0'
gem 'simple_enum', '1.6.9' # can switch to active record enum when upgrade to rails 4
##############################
# Uploads
##############################
gem 'aws-sdk', '2.1.20'
gem 'carrierwave', '1.3.2'
gem 'carrierwave-aws', '1.2.0'
gem "mini_magick", "4.9.4"
gem 's3_direct_upload', git: 'https://github.com/waynehoover/s3_direct_upload'
gem 'transloadit', '2.0.1'
##############################
# Caching
##############################
gem 'actionpack-page_caching', '~> 1.2.1'
gem 'redis-rails'
gem 'redis-store', '1.6.0'
gem 'redis-namespace', '1.6.0'
gem 'redmon', '0.0.8', :require => false
##############################
# Cron
##############################
gem 'whenever', "0.8.2", :require => false
##############################
# Monitoring
##############################
gem "airbrake", "7.2.1"
gem "airbrake-ruby", "2.8.3"
gem 'newrelic_rpm', '~> 3.6'
gem "oink", '0.10.1'
##############################
# Logging
##############################
gem 'apachelogregex', '0.1.0'
gem 'log4r', '1.1.9'
##############################
# UI
##############################
gem 'jquery-rails', "2.2.1"
gem "swfobject-rails", "2.0"
gem 'will_paginate-bootstrap', "1.0.1"
gem "browser", "0.8.0"
gem "mobile-fu", "1.3.1"
gem "slim", "1.3.6"
gem "sinatra"
##############################
# EMAIL
##############################
gem "roadie", "3.0.3"
gem "roadie-rails", "1.0.4"
##############################
# Development/Linting
##############################
gem 'rubocop', '0.32.0', require: false
##############################
# Social
##############################
gem 'koala', '2.3.0' # Facebook
gem 'twitter', git: 'https://github.com/sferik/twitter', branch: 'master', ref: '60eb256'
gem 'google-api-client', '0.9'
##############################
# Util
##############################
gem 'json-compare'
gem 'chartkick', '3.0.2'
group :production do
end
group :test do
gem 'factory_bot_rails', require: false
gem 'rspec-rails', '~> 3.5'
gem 'shoulda', '~> 3.5', require: false
gem "fakeredis", :require => "fakeredis/rspec"
gem 'database_cleaner'
gem 'faker'
gem 'timecop'
gem 'test_after_commit', '1.1.0'
gem "rspec_junit_formatter", "~> 0.4.1"
end
group :development do
#gem 'rails4_upgrade', github: 'alindeman/rails4_upgrade'
gem "query_reviewer"
gem "capistrano", "2.15.6"
gem "capistrano-ec2group"
gem "capistrano-sidekiq"
gem "net-ssh", "~> 2.7.0"
gem 'quiet_assets', '~> 1.1.0'
# enables use of rails panel extension https://github.com/dejan/rails_panel
gem 'meta_request'
# allows interactive debugging
gem 'pry-remote'
# file monitoring for tests
gem 'ruby_dep', '~> 1.3.1'
gem 'guard-rspec', '~> 4.7'
gem 'brakeman', require: false
gem 'bullet'
gem "ruby-debug-ide", "~> 0.6.1"
gem "debase", "~> 0.2.2"
end
gem "jwt", "~> 1.5"
gem "httparty", "~> 0.16.2"
gem "puma", "3.12.4"
gem "blazer", "~> 1.9"
gem 'actionpack', '4.1.14.2'
gem 'ffi', '1.9.24'
gem 'activerecord', '4.1.14.2'
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
I ran into the error when I tried to run SQL through ruby script. Can someone help me figure out what could be the cause? I already looked for some similar posts but couldn't find the right solution yet.
/Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require': Could not load 'active_record/connection_adapters/redshift_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/pg-0.17.1/lib/pg.rb:4:in `<top (required)>'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activerecord4-redshift-adapter-0.2.1/lib/active_record/connection_adapters/redshift_adapter.rb:17:in `<top (required)>'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection_specification.rb:175:in `spec'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activerecord-4.2.10/lib/active_record/connection_handling.rb:50:in `establish_connection'
from /Users/User/Desktop/github/tracker/app/workers/appsflyer_importer_worker_aggregate.rb:100:in `fetch_data'
from /Users/User/Desktop/github/tracker/app/workers/appsflyer_importer_worker_aggregate.rb:120:in `perform'
from -:30:in `<main>'
Here is my settings:
Gemfile
ruby '2.4.3'
gem 'activerecord4-redshift-adapter', '~> 0.2'
gem 'pg'
Ruby version
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
Gem list
activerecord (4.2.10, 4.2.8)
activerecord4-redshift-adapter (0.2.1)
pg (1.0.0, 0.17.1)
Script
require 'active_record'
conn = {
adapter: 'redshift',
database: '#database',
host: '#host',
port: 5439,
username: '#username',
password: '#password'
}
ActiveRecord::Base.establish_connection(conn)
sql = 'select count(*) from table'
ActiveRecord::Base.connection.execute(sql)
You're using the pg gem version 1.0.0 and it is not compatible with the version of active_record and activerecord4-redshift-adapter that you're using:
The PGconn, PGresult, and PGError constants are deprecated, and will be removed as of version 1.0.
This can be seen in the history of the pg gem.
The activerecord4-redshift-adapter uses both the PGconn and PGError constants:
def connection_active?
#connection.status == PGconn::CONNECTION_OK
rescue PGError
false
end
Although I was unable to exactly duplicate the error message that you saw, by modifying the Gemfile to use an older version of the pg gem I was able to get farther along:
gem 'pg', '~> 0.21'
My exact steps were:
create the Gemfile
create a file test.rb containing your Ruby code
run bundle install
run bundle exec ruby test.rb
This produces the following error:
/Users/test/.rvm/gems/ruby-2.4.3/gems/activerecord4-redshift-adapter-0.2.1/lib/active_record/connection_adapters/redshift_adapter.rb:568:in `initialize': could not translate host name "#host" to address: nodename nor servname provided, or not known (PG::ConnectionBad)
This is almost certainly in the right direction for the problem you're having, and should put you on the path to accomplishing your goal.
I was trying to setup facebook app locally, using ruby and sinatra, in Kubuntu 12.04.
I have included following gems in my gemfile. I have postgresql installed in my system and I am able to run the postgresql command line and run basic commands as createdb, create table etc.
gem "sinatra"
gem "koala"
gem "json", "1.5.5"
gem "httparty"
gem "thin"
gem "rack", "1.3.10"
gem "pg"
gem "activerecord"
gem "sinatra-activerecord"
And in my app.rb file added these files,
require "rubygems"
require "sinatra"
require "sinatra/activerecord"
require "koala"
require "./config/environment" #database configuration
Running
rake -T
in my terminal gives me the following error.
rake aborted!
(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:39:in `database_file='
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1033:in `set'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:50:in `registered'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1317:in `block in register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `each'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1648:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1688:in `register'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:76:in `<module:Sinatra>'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:6:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/app.rb:3:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/Rakefile:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Could any one please help. Thank you.
As #iain mentioned, this is due to a parse error in your config/database.yml file.
Check that it is valid syntax, and replace any tabs with spaces.
I'm working on a CentOS 6.3 Linux server with the Ruby version: 1.8.7 and the Gem version: 1.8.25
I'm trying to run the command: ruby script/rails server webrick -e production
It spits out this error:
=> Booting WEBrick
=> Rails 3.2.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib64/ruby/gems/1.8/gems/bundler-1.2.3/lib/bundler/rubygems_integration.rb:157:in `gem': Please install the mysql adapter: `gem install activerecord-mysql-adapter` (can't activate mysql (~> 2.8.1), already activated mysql-2.9.0. Make sure all dependencies are added to Gemfile.) (LoadError)
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql_adapter.rb:5
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/railtie.rb:82
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/base.rb:721
from /var/www/redmine/lib/plugins/acts_as_activity_provider/init.rb:2
from /var/www/redmine/config/initializers/00-core_plugins.rb:12
from /var/www/redmine/config/initializers/00-core_plugins.rb:2:in `each'
from /var/www/redmine/config/initializers/00-core_plugins.rb:2
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:588
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /var/www/redmine/config/environment.rb:14
from /var/www/redmine/config.ru:4:in `require'
from /var/www/redmine/config.ru:4
from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize'
from /var/www/redmine/config.ru:1:in `new'
from /var/www/redmine/config.ru:1
This is my Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"
gem "coderay", "~> 1.0.6"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
gem "rake", "0.8.7"
gem "rack", "1.4.0"
gem "rubytree", "0.5.2", :require => "tree"
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay
gem "mysql", "2.9.0"
# Optional gem for LDAP authentication
group :ldap do
gem "net-ldap", "~> 0.3.1"
end
# Optional gem for OpenID authentication
group :openid do
gem "ruby-openid", "~> 2.1.4", :require => "openid"
gem "rack-openid"
end
# Optional gem for exporting the gantt to a PNG file, not supported with jruby
platforms :mri, :mingw do
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end
end
# Database gems
platforms :mri, :mingw do
group :postgresql do
gem "pg", ">= 0.11.0"
end
group :sqlite do
gem "sqlite3"
end
end
platforms :mri_18, :mingw_18 do
group :mysql do
gem "mysql", "2.9.0"
end
end
platforms :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "~> 0.3.11"
end
end
platforms :jruby do
gem "jruby-openssl"
group :mysql do
gem "activerecord-jdbcmysql-adapter"
end
group :postgresql do
gem "activerecord-jdbcpostgresql-adapter"
end
group :sqlite do
gem "activerecord-jdbcsqlite3-adapter"
end
end
group :development do
gem "rdoc", ">= 2.4.2"
gem "yard"
end
group :test do
gem "shoulda", "~> 2.11"
# Shoulda does not work nice on Ruby 1.9.3 and seems to need test-unit explicitely.
gem "test-unit", :platforms => [:mri_19]
gem "mocha", "0.12.3"
end
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
if File.exists?(local_gemfile)
puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(local_gemfile)
end
# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(file)
end
I've installed activerecord-mysql-adapter -- it had no errors...
I've tried to change the Gemfile to match the error it's spitting out, the (~> 2.8.1) version but that did not work either...
Any help would really be appreciated...
UPDATE!!
I uninstalled MySQL 2.9.0 and installed MySQL 2.8.1 and changed my Gemfile to reflect the proper version, but now I'm getting this error:
=> Booting WEBrick
=> Rails 3.2.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query': Mysql::Error: Table 'redmine.users' doesn't exist: SHOW FULL FIELDS FROM `users` (ActiveRecord::StatementInvalid)
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql_adapter.rb:324:in `execute_and_free'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:426:in `columns'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/schema_cache.rb:12:in `initialize'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `call'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `default'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `[]'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `columns'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:237:in `columns_hash'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/inheritance.rb:19:in `descends_from_active_record?'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/inheritance.rb:25:in `finder_needs_type_condition?'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/base.rb:455:in `relation'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/scoping/named.rb:37:in `scoped'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/querying.rb:9:in `order'
from /var/www/redmine/app/models/group.rb:32
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_load'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:313:in `depend_on'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:225:in `require_dependency'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:439:in `eager_load!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:438:in `eager_load!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application/finisher.rb:53
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /var/www/redmine/config/environment.rb:14
from /var/www/redmine/config.ru:4:in `require'
from /var/www/redmine/config.ru:4
from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize'
from /var/www/redmine/config.ru:1:in `new'
from /var/www/redmine/config.ru:1
EDIT: I figured it out... I needed to run the command: RAILS_ENV=production bundle exec rake db:migrate
DOH!
Try
bundle exec ruby script/rails server webrick -e production
Also, why are you using script/rails? This should work:
bundle exec rails server webrick -e production
HTH
I have a Jenkins CI server and when I run following build script I get errors:
rdoc spec
Here is the errors:
/usr/bin/ruby1.9.1 -S rspec spec/requests/home_spec.rb
/home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find json-1.6.5 in any of the sources (Bundler::GemNotFound)
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `map!'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `materialize'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler.rb:117:in `setup'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /var/lib/jenkins/jobs/App1/workspace/config/boot.rb:10:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /var/lib/jenkins/jobs/App1/workspace/spec/spec_helper.rb:11:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /var/lib/jenkins/jobs/App1/workspace/spec/requests/home_spec.rb:1:in `<top (required)>'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!
Here is the my Rakefile:
require 'rdoc/task'
require 'rspec/core/rake_task'
desc 'Generate test result'
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*/*_spec.rb'
end
And here is the my Gemfile:
source :rubygems
# Required gems
gem 'sinatra', '>= 1.3.2'
gem 'rdoc', '>= 3.12'
gem 'rake'
gem 'json', '>= 1.6.5'
group :test do
gem 'rspec', '>= 2.9.0'
gem 'rack-test'
gem 'simplecov', '>= 0.6.1', require: false
end
I don't have any idea. Please help me. I'm using Ruby 1.9.3 with RVM.
Thank you for every advise. Sorry for poor English :)
Probably the reason is that environment where Jenkins is running your build is different than the environment where you run the build.
Usually the difference is caused by an environment variable which is set for you but not for Jenkins
You can check your environment variables by running the command env. You can check Jenkins' environment at Manage Jenkins -> System Information.
If you need to set some environment variables, you can do it at Manage Jenkins -> Configure System.