Skip to content

Instantly share code, notes, and snippets.

@rsutphin
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsutphin/a7f35ad522f7fa8dc1e9 to your computer and use it in GitHub Desktop.
Save rsutphin/a7f35ad522f7fa8dc1e9 to your computer and use it in GitHub Desktop.
Reproduce an error on require that happens with roar-rails but not roar alone
#!/bin/sh -xe
echo "=== Build test app ==="
# Happens with Rails 3.2.19 also
RAILS_VERSION=4.1.5
rm -rf some_app
rails _"$RAILS_VERSION"_ new some_app --skip-bundle --skip-spring
cd some_app
echo 'gem "roar-rails"' >> Gemfile
bundle install
echo "=== Tests ==="
echo "With roar alone:"
ruby -r roar -e 'require("roar/representer/json/hal") && puts("Success!")'
echo "With roar-rails:"
rails runner 'require("roar/representer/json/hal") && puts("Success!")'
@rsutphin
Copy link
Author

rsutphin commented Sep 2, 2014

Output from the "tests" section for me with Rails 4.1.5:

+ echo '=== Tests ==='
=== Tests ===
+ echo 'With roar alone:'
With roar alone:
+ ruby -r roar -e 'require("roar/representer/json/hal") && puts("Success!")'
Success!
+ echo 'With roar-rails:'
With roar-rails:
+ rails runner 'require("roar/representer/json/hal") && puts("Success!")'
/Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/roar-rails-0.1.6/lib/roar/rails/hal.rb:3:in `<top (required)>': uninitialized constant Roar::Representer::JSON::HAL (NameError)
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/roar-0.12.9/lib/roar/representer/json/hal.rb:44:in `<module:JSON>'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/roar-0.12.9/lib/roar/representer/json/hal.rb:4:in `<module:Representer>'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/roar-0.12.9/lib/roar/representer/json/hal.rb:3:in `<top (required)>'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/runner.rb:62:in `<top (required)>'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/runner.rb:62:in `eval'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/runner.rb:62:in `<top (required)>'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:128:in `require'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:128:in `require_command!'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:95:in `runner'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Users/rsutphin/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment