Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@rsutphin 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
You can’t perform that action at this time.