ruby-on-railsrubyrubygemscloud9-ideengineyard

Engineyard Gem Failing to Run; find_active_stub_by_path Reports Undefined Method 'this'


I cannot get the Engine Yard gem to work on my Rails application. I have built it on top of basic pieces I put together following the first ten chapters of Michael Hartl's Ruby on Rails Tutorial (third edition). While it deploys fine to Heroku, I want to switch to Engine Yard.

Here is the error I get any time I call ey:

~/workspace (development) $ ey --help
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:2158:in `method_missing': undefined method `this' for #<Gem::Specification:0x52e978 engineyard-3.2.1> (NoMethodError)
        from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:1057:in `find_active_stub_by_path'
        from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:64:in `require'
        from /usr/local/rvm/gems/ruby-2.3.0/gems/engineyard-3.2.1/bin/ey:3:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.3.0/bin/ey:23:in `load'
        from /usr/local/rvm/gems/ruby-2.3.0/bin/ey:23:in `<main>'
        from /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
        from /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

Ruby documentation seems to indicate that the engineyard gem cannot be found, but I have not come to understand why.

The Engine Yard gem works fine when I start a new project locally, when I start a new project on Cloud 9, or when I push a new project to a repo then clone it to a seperate Cloud 9 account. However, I get identical errors on the other three apps I built following Hartl's tutorial, including the hello world app from Chapter 1.

I have tried to identify what is creating this problem by going through Chapter 1 again with a new project. Unfortunately, my recreation of Hartl's hello world app runs the engineyard gem perfectly fine. (The walkthrough of that recreation is below.)

'gem pristine --all' has no effect on this error.

I have been in touch with the Engine Yard support team for a week and the problem does not seem to belong to the gem. As I can run the Engine Yard gem without problem on other Cloud 9 work spaces, it is not a problem with Cloud 9.

What is causing this error, and how can I fix it?


My bug replication effort

NOTE: As noted in the engineyard gem documentation, the gem is not to be included in the Gemfile.

On C9, create a public workspace on Ruby framework (referred to a A), then set up git and push to BitBucket from A without running "$ bundle install"

Now create a second workspace on a seperate account on C9 (referred to as B) on the Ruby framework and clone it from the repo.

B$ gem install engineyard
B$ ey --help  [this was SUCCESSFUL]
B$ bundle install
B$ ey --help  [this was SUCCESSFUL]

Now install the engineyard gem on A and test it.

A$ bundle install
A$ gem install engineyard
A$ ey --help [this was SUCCESSFUL]

Now test the Gemfile in Listing 1.5, which is used by my hello world application that is currently failing. Replace the content of Gemfile in workspace A with that in Listing 1.5:

gem 'rails', '4.2.0'
gem 'sass-rails', '5.0.1'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3', '1.3.9'
  gem 'byebug', '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring', '1.1.3'
end

Now run this:

A$ bundle install
A$ ey --help [this was SUCCESSFUL]
A$ git add -A
A$ git commit -m "Make Gemfile equal to Hartl's Listing 1.5"
A$ git push
B$ git pull
B$ bundle install
B$ ey --help [this was SUCCESSFUL]

So this version of the Gemfile in Listing 1.5 is not problematic.

Step 1.3.2 tells us to run a rails server, which fails with sass-rails 5.0.1. I replaced 5.0.1 with 5.0.2 in my existing/completed hello world application (as I've done in my real project). Now perform the same update on A and B (via the repository)...

On A, update Gemfile to this:

gem 'rails', '4.2.0'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3', '1.3.9'
  gem 'byebug', '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring', '1.1.3'
end

Now run this:

A$ bundle install
A$ ey --help [this was SUCCESSFUL]
A$ git add -A
A$ git commit -m "Upgrade sass-rails to 5.0.2"
A$ git push
B$ git pull
B$ ey --help [this was SUCCESSFUL]

Now on workspace A, run the rails server as in Listing 1.7, edit application_controller as in Listing 1.8, change routes as in Listing 1.10, and test it. Works as expected. Now push and test on B...

A$ ey --help [this was SUCCESSFUL]
A$ git add -A
A$ git commit -m "Listings 1.7, 1.8, and 1.10"
A$ git push
B$ git pull
B$ ey --help [this was SUCCESSFUL]

Solution

  • There is a fix to the ruby-gems issue listed here. https://github.com/rubygems/rubygems/issues/1420#issuecomment-169178431

    It has not been merged into master as of yet. You can either downgrade ruby-gems or apply the patch.