Assets precompile not working - ruby-on-rails-3

Precompiling assests with RAILS_ENV=production rake assets:precompile gave error such as:
rake aborted!
undefined method `empty?' for #<File:0xc1339e8>
Stack trace :
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionView::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ThemesForRails::AssetsController instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rvm/rubies/ruby-1.9.3-p125-perf/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionView::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ThemesForRails::AssetsController instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionView::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ThemesForRails::AssetsController instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionMailer::Base instead. (called from require at /usr/local/rvm/gems/ruby-1.9.3-p125-perf#global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68)
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
** Invoke assets:environment (first_time)
** Execute assets:environment
Using: Directory Search of /home/roo/Documents/RubyApplications/REALVOLVE/Realvolve-28-Feb/public/assets
Uploading: assets/application-08d5bf8b6880620e6c8aad0f7ffbe7c2.css.gz
rake aborted!
undefined method `empty?' for #<File:0xc1339e8>
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/excon-0.10.0/lib/excon/connection.rb:211:in `request_kernel'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/excon-0.10.0/lib/excon/connection.rb:92:in `request'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/fog-0.7.2/lib/fog/core/connection.rb:20:in `request'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/fog-0.7.2/lib/fog/storage/aws.rb:323:in `request'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/fog-0.7.2/lib/fog/storage/requests/aws/put_object.rb:43:in `put_object'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/fog-0.7.2/lib/fog/storage/models/aws/file.rb:119:in `save'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/fog-0.7.2/lib/fog/core/collection.rb:50:in `create'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/asset_sync-0.2.10/lib/asset_sync/storage.rb:117:in `upload_file'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/asset_sync-0.2.10/lib/asset_sync/storage.rb:129:in `block in upload_files'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/asset_sync-0.2.10/lib/asset_sync/storage.rb:127:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/asset_sync-0.2.10/lib/asset_sync/storage.rb:127:in `upload_files'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/asset_sync-0.2.10/lib/asset_sync/storage.rb:135:in `sync'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/asset_sync-0.2.10/lib/asset_sync/asset_sync.rb:29:in `sync'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/asset_sync-0.2.10/lib/tasks/asset_sync.rake:14:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p125-perf/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p125-perf#realvolve/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile

Just a try ...
For newer Rails versions, you don't have to include the environment any more. Try to use
bundle exec rake assets:clean assets:precompile
Ensures that the correct version of rake is used.
Ensures that the assets were cleaned before compiling them again.

This looks to be an issue with asset_sync not Heroku or the rake assets:precompile task.
We develop asset_sync so maybe I can help. I would suggest you try the following:
Ensure your configuration for asset_sync is correct
Update asset_sync to the latest copy. Version 0.3.0
Empty your S3 assets bucket
If none of that works, please post an issue on Github and we will look into the problem further for you. We've not had any reports like this, so we may need to look at an anonymised version of your app to try and replicate the issue.
You could also ask Heroku support for help on issues like this.

Thanks to all.
I tried "bundle exec rake assets:clean assets:precompile" but still same issue.
Also asset_sync is not a problem.
I figured out that axcon gem version "0.10.0" was causing the problem. So I restricted the version to "0.9.5". It worked for me.

Related

Trying to import Issues from JIRA to Redmine

Following this: https://www.redmine.org/issues/1385#note-43
I have been trying to run the following query: rake jira_migration:test_all_migrations RAILS_ENV=production
And below mentioned is the trace:
rake jira_migration:test_all_migrations RAILS_ENV=production --trace
rake aborted!
LoadError: cannot load such file -- config/environment
C:/xampp/htdocs/redmine-4.1.1/lib/tasks/migrate_jira.rake:4:in require' C:/xampp/htdocs/redmine-4.1.1/lib/tasks/migrate_jira.rake:4:in <top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.2.4.2/lib/rails/engine.rb:656:in load' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.2.4.2/lib/rails/engine.rb:656:in block in run_tasks_blocks'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.2.4.2/lib/rails/engine.rb:656:in each' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.2.4.2/lib/rails/engine.rb:656:in run_tasks_blocks'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.2.4.2/lib/rails/application.rb:515:in run_tasks_blocks' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.2.4.2/lib/rails/engine.rb:459:in load_tasks'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.2.4.2/lib/rails/railtie.rb:190:in public_send' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.2.4.2/lib/rails/railtie.rb:190:in method_missing'
C:/xampp/htdocs/redmine-4.1.1/Rakefile:7:in <top (required)>' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in load'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in load_rakefile' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:703:in raw_load_rakefile'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:104:in block in load_rakefile' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:186:in standard_exception_handling'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:103:in load_rakefile' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:82:in block in run'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:186:in standard_exception_handling' C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/lib/rake/application.rb:80:in run'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-13.0.3/exe/rake:27:in <top (required)>' C:/RailsInstaller/Ruby2.3.3/bin/rake:22:in load'
C:/RailsInstaller/Ruby2.3.3/bin/rake:22:in `'
Followed these steps through the link posted in the question:
Go to Jira Administration -> Import & Export -> Backup Data to XML (*) * It's possible you have to configure a Backup Dir In the file:
/usr/local/jira/atlassian-jira-enterprise-4.1.2-standalone/atlassian-jira/WEB-INF/classes/jira-application.properties
For example adding this line: jira.paths.safe.backup.path=/tmp
Save the backup with the name: backup_jira.xml
Put this file in the main dir of redmine. In my case: /usr/local/lib/redmine-1.2
Download the script "migrate_jira.rake" developed by Luciano Pacheco: http://www.redmine.org/attachments/download/6106/migrate_jira.rake
Put the script in the [redmine dir]/lib/tasks/. In my case: /usr/local/lib/redmine-1.2/lib/tasks/
Now: cd /usr/local/lib/redmine-1.2
And: rake jira_migration:test_all_migrations RAILS_ENV="production"
Before this command we are getting a file called "map_jira_to_redmine.yml"
Edit this file with the editor you want (vi, pico, nano...). For instance: pico map_jira_to_redmine.yml
This file contains the priorities, types and status of your Jira Projects. On the left side Jira Features, On the right side Redmine Features. You can adjust your Redmine, for example the trackers in the Administration web section to link exactly with the features of your Jira Projects. You can do it the same process with the states and priorities.
Once you set this file. You only have to run this: rake jira_migration:do_all_migrations RAILS_ENV="production"

Resolution for undefined method `get' for nil:NilClass

We need some help in figuring out what we're missing from our tests. We are attempting to run headless phantomjs testing and are getting the error:
undefined method get' for nil:NilClass
Did you mean? gets
get_key
gem (NoMethodError)
features/welcome_login.feature:4:inGiven I navigate to "http://www.web.com"'
env.rb =
env file

Ruby on Rails TDD Error with 'Bundle Exec Rspec'

I am working through Hartl's Ruby on Rails tutorial and am stuck on Section 3.2 where I am required to run a TDD using the command:
$bundle exec rspec/requests/static_pages_spec.rb
and I get this in return:
/home/Kelvin_Yu/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `require': /home/Kelvin_Yu/rails_projects/sample_app/spec/spec_helper.rb:2: syntax error, unexpected '.' (SyntaxError)
/home/Kelvin_Yu/rails_projects/sample_app/spec/spec_helper.rb:6: syntax error, unexpected '.'
from /home/Kelvin_Yu/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
So I check in my "static_pages_spec.rb" file and see that it is the same as in Listing 3.9 in the tutorial (http://ruby.railstutorial.org/chapters/static-pages#sec-first_tests):
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
expect(page).to have_content('Sample App')
end
end
end
So that makes me believe that this is not the cause of the error (please let me know if this assumption is incorrect) and I proceed to check my "spec_helper.rb" file:
# This file is copied to spec/ when you run 'rails generate rspec:install'
.
.
.
RSpec.configure do |config|
.
.
.
config.include Capybara::DSL
end
This is the same as shown in the tutorial (Listing 3.10 # http://ruby.railstutorial.org/chapters/static-pages#sec-first_tests).
Since the error is an "unexpected '.' (SyntaxError)", I remove the period from line 2 and rerun the Rspec command. I get the same error, so I remove all periods from that file so it is now:
# This file is copied to spec/ when you run 'rails generate rspec:install'
RSpec.configure do |config|
config.include Capybara::DSL
end
and get a different error:
/home/Kelvin_Yu/rails_projects/sample_app/spec/spec_helper.rb:3:in `block in <top (required)>': uninitialized constant Capybara (NameError)
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core.rb:92:in `configure'
from /home/Kelvin_Yu/rails_projects/sample_app/spec/spec_helper.rb:2:in `<top (required)>'
from /home/Kelvin_Yu/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `require'
from /home/Kelvin_Yu/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
Not sure what this error "uninitialized constant Capybara (NameError)" means. Can anyone help advise what would be the next best steps?
Those dots in the author's examples are meant to serve as ellipses, indicating that there's text there that's not being shown (to keep the reader's focus on the relevant bits).
This is closer to what a your spec_helper.rb file should look like:
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
#def logger
# Rails::logger
#end
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
end
If you haven't made any commits since you removed the extra lines, grab the previous (complete) version of this file from your github repo.

Heroku run rake db:reset error

I am trying to reset my Heroku database. I am getting the following error:
** Invoke environment
** Execute db:abort_if_pending_migrations
rake aborted!
uninitialized constant Object::State
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/app/db/seeds.rb:9:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/engine.rb:520:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/engine.rb:520:in `load_seed'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.2/lib
Line 9 of seed.rb is State.create(name: 'Alaska', abbrev: 'AK' );
The model is defined.
Any help?
The rake db:reset task is not supported. Heroku apps do not have permission to drop and create databases. Use the heroku pg:reset command instead.

rake db:migrate aborted! on US-ASCII using rake 0.9.2.2 and rails 3.0.10

Recently I upgraded my gems and started adding new stuff to my app like authentication by third party social websites using omniauth gem. On development environment everything is fine and works like a charm.
I am deploying to staging and production servers using capistrano. Basic deployment is fine and working so far, but I have got really strange problems when I want to do migrations when deploying.
I get the following error messages from capistrano:
[my.server.com] executing command
*** [err :: my.server.com] rake aborted!
*** [err :: my.server.com] "\xC5" on US-ASCII
*** [err :: my.server.com]
*** [err :: my.server.com] (See full trace by running task with --trace)
command finished in 2472ms
I was googling all around and couldn't find any relevant solution. I also tried to downgrade rake gem back to 0.8.7 but with no success on the end - the same errors.
After hours of googling and digging in I found the solution that (I hope) may by helpful for someone with a similar or the same problem.
I did bundle exec rake --trace db:migrate on the staging server and got the following error messages:
rake aborted!
"\xC5" on US-ASCII
/var/www/myapp/test.myapp.com/releases/20111230233802/config/application.rb:5:in `read'
/var/www/myapp/test.myapp.com/releases/20111230233802/config/application.rb:5:in `<top (required)>'
/var/www/myapp/test.myapp.com/releases/20111230233802/Rakefile:4:in `require'
/var/www/myapp/test.myapp.com/releases/20111230233802/Rakefile:4:in `<top (required)>'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/bin/rake:19:in `load'
/var/www/myapp/test.myapp.com/shared/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
So I jumped in to the config/application.rb file to find out what could rise the error. Line 5 of that file loads an external config file:
require 'yaml'
APP_CONFIG = YAML.load(File.read(File.expand_path('../app_config.yml', __FILE__)))
and that external file contains UTF-8 chars, not US-ASCII. So I tried a couple of different solutions to solve that problem.
The only one which worked for me was to add an extra few lines of code on top of config/application.rb file:
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
just to tell rake to load external files using utf-8 encoding. After that change everything went smooth and exactly as expected. Problem solved!
PS.
I really don't know why developers of rake 0.9 have changed previous behavior of rake 0.8 which worked fine for me and probably for you as well for a long time. Maybe you have an idea why? I am very curious.