codebrew / backbone-rails

Easily use backbone.js with rails 3.1
MIT License
1.62k stars 255 forks source link

rails g backbone:install fails #128

Closed ktusznio closed 11 years ago

ktusznio commented 11 years ago

Running Ruby 1.9.3p0 and Rails 3.2.8.

Here's what happens when I run the backbone:install generator:

$ rails g backbone:install
insert  app/assets/javascripts/application.js
<path to gems>/thor-0.16.0/lib/thor/actions/inject_into_file.rb:99:in `binread': No such file or directory - <path to rails app>/app/assets/javascripts/application.js (Errno::ENOENT)
    from <path to gems>/thor-0.16.0/lib/thor/actions/inject_into_file.rb:99:in `replace!'
    from <path to gems>/thor-0.16.0/lib/thor/actions/inject_into_file.rb:60:in `invoke!'
    from <path to gems>/thor-0.16.0/lib/thor/actions.rb:95:in `action'
    from <path to gems>/thor-0.16.0/lib/thor/actions/inject_into_file.rb:31:in `insert_into_file'
    from <path to gems>/rails-backbone-0.8.0/lib/generators/backbone/install/install_generator.rb:16:in `inject_backbone'
    from <path to gems>/thor-0.16.0/lib/thor/task.rb:27:in `run'
    from <path to gems>/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
    from <path to gems>/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all'
    from <path to gems>/thor-0.16.0/lib/thor/invocation.rb:126:in `each'
    from <path to gems>/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
    from <path to gems>/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
    from <path to gems>/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
    from <path to gems>/thor-0.16.0/lib/thor/base.rb:425:in `start'
    from <path to gems>/railties-3.2.8/lib/rails/generators.rb:171:in `invoke'
    from <path to gems>/railties-3.2.8/lib/rails/commands/generate.rb:12:in `<top (required)>'
    from <path to gems>/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
    from <path to gems>/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
    from <path to gems>/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
    from <path to gems>/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
    from <path to gems>/railties-3.2.8/lib/rails/commands.rb:29:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
ccmcbeck commented 11 years ago

You can solve this by just placing an application.js file in that location. Don't just use an empty file, put a copy of your real manifest file then do a diff to figure out what got added. My app/assets/javascripts is split between /html and /mobile so I had the same issue

ktusznio commented 11 years ago

Thanks for the solution, that works.