RailsApps / rails-composer

Rails Composer. The Rails generator on steroids for starter apps.
http://www.railscomposer.com/
3.38k stars 486 forks source link

The template composer.rb could not be loaded. Error: cannot load such file -- haml/html #66

Closed tamvm closed 11 years ago

tamvm commented 11 years ago

Although I checked with Gemfile and gemset, there're gems: haml and hpricot, but whenever I initialize project, it still raise above exception. Any help?

Thanks,

DanielKehoe commented 11 years ago

Can you show me the entire console output when you try to generate the app? Either paste here or create a gist.

universal commented 11 years ago

Hello,

i'm running into the same problem. I'm using an rvm managed ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.0] and Rails 3.2.10 :-) Hope that info helps you :-)

rails new statviewer -O -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
      create  
      create  README.rdoc
      * more creates *
      create  vendor/plugins/.gitkeep
       apply  https://raw.github.com/RailsApps/rails-composer/master/composer.rb
 initializer    generators.rb
    composer  WOOT! The recipes you've selected are known to work together.
    composer  Using rails_apps_composer recipes to generate an application.
      insert    config/application.rb
      recipe  Running core recipe...
        core  selected all core recipes
      recipe  Running git recipe...
         git  initialize git
      remove    .gitignore
      create    .gitignore
         run    git init from "."
Initialized empty Git repository in ......./statviewer/.git/
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: initial commit" from "."
      recipe  Running railsapps recipe...
    question  Install an example application?
          1)  I want to build my own application
          2)  membership/subscription/saas
          3)  rails-prelaunch-signup
          4)  rails3-bootstrap-devise-cancan
          5)  rails3-devise-rspec-cucumber
          6)  rails3-mongoid-devise
          7)  rails3-mongoid-omniauth
          8)  rails3-subdomains
   railsapps  Enter your selection: 6
      recipe  Running setup recipe...
       setup  Your operating system is darwin12.2.0.
       setup  You are using Ruby version 1.9.3.
       setup  You are using Rails version 3.2.10.
    question  Web server for development?
          1)  WEBrick (default)
          2)  Thin
          3)  Unicorn
          4)  Puma
       setup  Enter your selection: 4
    question  Web server for production?
          1)  Same as development
          2)  Thin
          3)  Unicorn
          4)  Puma
       setup  Enter your selection: 4
    question  Template engine?
          1)  ERB
          2)  Haml
          3)  Slim (experimental)
       setup  Enter your selection: 2
      create    README
      append    README
      recipe  Running readme recipe...
      recipe  Running gems recipe...
     gemfile    puma (>= 1.6.3)
        gsub    Gemfile
     gemfile    mongoid (>= 3.0.15)
     gemfile    haml (>= 3.1.7)
     gemfile    haml-rails (>= 0.3.5)
     gemfile    hpricot (>= 0.8.6)
     gemfile    ruby_parser (>= 3.1.1)
     gemfile    rspec-rails (>= 2.11.4)
     gemfile    database_cleaner (>= 0.9.1)
     gemfile    mongoid-rspec (>= 1.5.5)
     gemfile    email_spec (>= 1.4.0)
     gemfile    cucumber-rails (>= 1.3.0)
     gemfile    launchy (>= 2.1.2)
     gemfile    capybara (>= 2.0.1)
     gemfile    factory_girl_rails (>= 4.1.0)
     gemfile    devise (>= 2.1.2)
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: Gemfile" from "."
      recipe  Running testing recipe...
      recipe  Running email recipe...
      recipe  Running models recipe...
      recipe  Running controllers recipe...
      recipe  Running views recipe...
      recipe  Running routes recipe...
      recipe  Running frontend recipe...
      recipe  Running init recipe...
      recipe  Running prelaunch recipe...
      recipe  Running prelaunch recipe...
      recipe  Running extras recipe...
      extras  Set a robots.txt file to ban spiders? (y/n) y
      extras  Create a project-specific rvm gemset and .rvmrc? (y/n) n
      extras  Create a GitHub repository? (y/n) n
      extras  recipe setting quiet_assets for reduced asset pipeline logging
     gemfile    quiet_assets (>= 1.0.1)
      extras  recipe creating application.yml file for environment variables
     gemfile    figaro (>= 0.5.0)
      extras  recipe adding better_errors gem
     gemfile    better_errors (>= 0.3.2)
     gemfile    binding_of_caller (>= 0.6.8)
      extras  recipe banning spiders by modifying 'public/robots.txt'
    composer  Installing gems. This will take a while.
         run    bundle install --without production from "."
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.0.3) 
*loads more gems used*
Using uglifier (1.3.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
    composer  Running 'after bundler' callbacks.
    composer  importing html2haml conversion tool
The template [https://raw.github.com/RailsApps/rails-composer/master/composer.rb] could not be loaded. Error: cannot load such file -- haml/html
universal commented 11 years ago

i manually moved the require 'bundler/setup' call after the haml require statements at the bottom of composer.rb, with that i get a new error:

https://raw.github.com/universal/rails-composer/patch-1/composer.rb:136:in `rescue in html_to_haml': uninitialized constant Rails::Generators::AppGenerator::RubyParser (NameError)
    from https://raw.github.com/universal/rails-composer/patch-1/composer.rb:133:in `html_to_haml'
    from https://raw.github.com/universal/rails-composer/patch-1/composer.rb:121:in `copy_from_repo'
    from https://raw.github.com/universal/rails-composer/patch-1/composer.rb:1479:in `block in apply'
    from https://raw.github.com/universal/rails-composer/patch-1/composer.rb:2307:in `call'
    from https://raw.github.com/universal/rails-composer/patch-1/composer.rb:2307:in `block in apply'
    from https://raw.github.com/universal/rails-composer/patch-1/composer.rb:2307:in `each'
    from https://raw.github.com/universal/rails-composer/patch-1/composer.rb:2307:in `apply'
    from /Users/jhedtrich/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/actions.rb:221:in `instance_eval'
    from /Users/jhedtrich/.rvm/gems/ruby-1.9.3-p327/gems/thor-0.16.0/lib/thor/actions.rb:221:in `apply'
    from /Users/jhedtrich/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.10/lib/rails/generators/app_base.rb:109:in `apply_rails_template'
    from (eval):1:in `apply_rails_template'
universal commented 11 years ago

with explicitly requiring 'haml' it errors out with:

The template [https://raw.github.com/universal/rails-composer/patch-1/composer.rb] could not be loaded. Error: cannot load such file -- haml

Hopefully some of the information helps you in finding the issue :-)

jessmartin commented 11 years ago

Getting a similar issue except mine says "Error: cannot load such file -- bundler/setup"

Here's my full output:

      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  lib/assets
      create  lib/assets/.gitkeep
      create  log
      create  log/.gitkeep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.gitkeep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
       apply  /Users/jessmartin/Documents/code/rails-composer/composer.rb
 initializer    generators.rb
    composer  WOOT! The recipes you've selected are known to work together.
    composer  Using rails_apps_composer recipes to generate an application.
      insert    config/application.rb
      recipe  Running core recipe...
        core  selected all core recipes
      recipe  Running git recipe...
         git  initialize git
      remove    .gitignore
      create    .gitignore
         run    git init from "."
Initialized empty Git repository in /Users/jessmartin/Documents/code/rerecipe/.git/
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: initial commit" from "."
      recipe  Running railsapps recipe...
    question  Install an example application?
          1)  I want to build my own application
          2)  membership/subscription/saas
          3)  rails-prelaunch-signup
          4)  rails3-bootstrap-devise-cancan
          5)  rails3-devise-rspec-cucumber
          6)  rails3-mongoid-devise
          7)  rails3-mongoid-omniauth
          8)  rails3-subdomains
   railsapps  Enter your selection: 1
      recipe  Running setup recipe...
       setup  Your operating system is darwin11.4.2.
       setup  You are using Ruby version 1.9.3.
       setup  You are using Rails version 3.2.9.
    question  Web server for development?
          1)  WEBrick (default)
          2)  Thin
          3)  Unicorn
          4)  Puma
       setup  Enter your selection: 2
    question  Web server for production?
          1)  Same as development
          2)  Thin
          3)  Unicorn
          4)  Puma
       setup  Enter your selection: 2
    question  Database used in development?
          1)  SQLite
          2)  PostgreSQL
          3)  MySQL
          4)  MongoDB
       setup  Enter your selection: 2
    question  Template engine?
          1)  ERB
          2)  Haml
          3)  Slim (experimental)
       setup  Enter your selection: 3
    question  Unit testing?
          1)  Test::Unit
          2)  RSpec
          3)  MiniTest
       setup  Enter your selection: 2
    question  Integration testing?
          1)  None
          2)  RSpec with Capybara
          3)  Cucumber with Capybara
          4)  Turnip with Capybara
          5)  MiniTest with Capybara
       setup  Enter your selection: 4
    question  Fixture replacement?
          1)  None
          2)  Factory Girl
          3)  Machinist
          4)  Fabrication
       setup  Enter your selection: 2
    question  Front-end framework?
          1)  None
          2)  Twitter Bootstrap
          3)  Zurb Foundation
          4)  Skeleton
          5)  Just normalize CSS for consistent styling
       setup  Enter your selection: 5
    question  Add support for sending email?
          1)  None
          2)  Gmail
          3)  SMTP
          4)  SendGrid
          5)  Mandrill
       setup  Enter your selection: 1
    question  Authentication?
          1)  None
          2)  Devise
          3)  OmniAuth
       setup  Enter your selection: 2
    question  Devise modules?
          1)  Devise with default modules
          2)  Devise with Confirmable module
          3)  Devise with Confirmable and Invitable modules
       setup  Enter your selection: 3
    question  Authorization?
          1)  None
          2)  CanCan with Rolify
       setup  Enter your selection: 1
    question  Use a form builder gem?
          1)  None
          2)  SimpleForm
       setup  Enter your selection: 1
    question  Install a starter app?
          1)  None
          2)  Home Page
          3)  Home Page, User Accounts
       setup  Enter your selection: 1
      create    README
      append    README
      recipe  Running readme recipe...
      recipe  Running gems recipe...
     gemfile    thin (>= 1.5.0)
        gsub    Gemfile
     gemfile    pg (>= 0.14.1)
     gemfile    slim (>= 1.3.5)
     gemfile    haml2slim (>= 0.4.6)
     gemfile    haml (>= 3.1.6)
     gemfile    haml-rails (>= 0.3.5)
     gemfile    hpricot (>= 0.8.6)
     gemfile    ruby_parser (>= 3.1.1)
     gemfile    rspec-rails (>= 2.11.4)
     gemfile    database_cleaner (>= 0.9.1)
     gemfile    email_spec (>= 1.4.0)
     gemfile    turnip (>= 1.1.0)
     gemfile    factory_girl_rails (>= 4.1.0)
     gemfile    devise (>= 2.1.2)
     gemfile    devise_invitable (>= 1.1.4)
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: Gemfile" from "."
      recipe  Running testing recipe...
      recipe  Running email recipe...
      recipe  Running models recipe...
      recipe  Running controllers recipe...
      recipe  Running views recipe...
      recipe  Running routes recipe...
      recipe  Running frontend recipe...
      recipe  Running init recipe...
      recipe  Running prelaunch recipe...
      recipe  Running prelaunch recipe...
      recipe  Running extras recipe...
      extras  Reduce assets logger noise during development? (y/n) y
      extras  Use application.yml file for environment variables? (y/n) y
      extras  Improve error reporting with 'better_errors' during development? (y/n) y
      extras  Set a robots.txt file to ban spiders? (y/n) y
      extras  Create a project-specific rvm gemset and .rvmrc? (y/n) y
      extras  Create a GitHub repository? (y/n) y
      extras  recipe setting quiet_assets for reduced asset pipeline logging
     gemfile    quiet_assets (>= 1.0.1)
      extras  recipe creating application.yml file for environment variables
     gemfile    figaro (>= 0.5.0)
      extras  recipe adding better_errors gem
     gemfile    better_errors (>= 0.3.2)
     gemfile    binding_of_caller (>= 0.6.8)
      extras  recipe banning spiders by modifying 'public/robots.txt'
      extras  recipe creating project-specific rvm gemset and .rvmrc
      extras  creating RVM gemset 'rerecipe'
      extras  switching to gemset 'rerecipe'
         run    rvm gemset list from "."

gemsets for ruby-1.9.3-p327 (found in /Users/jessmartin/.rvm/gems/ruby-1.9.3-p327)
   (default)
   cloudfactory_kpis
   corkbordr
   data_scientist
   global
   jessmartdotin
   kpi_dashboard
   myapp
   new_world_order
   ranger
=> rerecipe
   speakinterface

      remove    .rvmrc
      create    .rvmrc
        gsub    .rvmrc
     gemfile    hub (>= 1.10.2)
    composer  Installing gems. This will take a while.
         run    bundle install --without production from "."
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Installing rake (10.0.3) 
Installing i18n (0.6.1) 
Installing multi_json (1.5.0) 
Installing activesupport (3.2.9) 
Installing builder (3.0.4) 
Installing activemodel (3.2.9) 
Installing erubis (2.7.0) 
Installing journey (1.0.4) 
Installing rack (1.4.3) 
Installing rack-cache (1.2) 
Installing rack-test (0.6.2) 
Installing hike (1.2.1) 
Installing tilt (1.3.3) 
Installing sprockets (2.2.2) 
Installing actionpack (3.2.9) 
Installing mime-types (1.19) 
Installing polyglot (0.3.3) 
Installing treetop (1.4.12) 
Installing mail (2.4.4) 
Installing actionmailer (3.2.9) 
Installing arel (3.0.2) 
Installing tzinfo (0.3.35) 
Installing activerecord (3.2.9) 
Installing activeresource (3.2.9) 
Installing addressable (2.3.2) 
Installing bcrypt-ruby (3.0.1) with native extensions 
Installing coderay (1.0.8) 
Installing better_errors (0.3.2) 
Installing binding_of_caller (0.6.8) with native extensions 
Using bundler (1.2.2) 
Installing coffee-script-source (1.4.0) 
Installing execjs (1.4.0) 
Installing coffee-script (2.2.0) 
Installing rack-ssl (1.3.2) 
Installing json (1.7.6) with native extensions 
Installing rdoc (3.12) 
Installing thor (0.16.0) 
Installing railties (3.2.9) 
Installing coffee-rails (3.2.2) 
Installing daemons (1.1.9) 
Installing database_cleaner (0.9.1) 
Installing orm_adapter (0.4.0) 
Installing warden (1.2.1) 
Installing devise (2.2.0) 
Installing devise_invitable (1.1.4) 
Installing diff-lcs (1.1.3) 
Installing launchy (2.1.2) 
Installing email_spec (1.4.0) 
Installing eventmachine (1.0.0) with native extensions 
Installing factory_girl (4.1.0) 
Installing factory_girl_rails (4.1.0) 
Installing rails (3.2.9) 
Installing figaro (0.5.2) 
Installing gherkin (2.11.5) with native extensions 
Installing haml (3.1.7) 
Installing haml-rails (0.3.5) 
Installing nokogiri (1.5.6) with native extensions 
Installing sexp_processor (4.1.3) 
Installing ruby_parser (3.1.1) 
Installing haml2slim (0.4.6) 
Installing hpricot (0.8.6) with native extensions 
Installing hub (1.10.4) 
Installing jquery-rails (2.1.4) 
Installing pg (0.14.1) with native extensions 
Installing quiet_assets (1.0.1) 
Installing rspec-core (2.12.2) 
Installing rspec-expectations (2.12.1) 
Installing rspec-mocks (2.12.1) 
Installing rspec (2.12.0) 
Installing rspec-rails (2.12.1) 
Installing sass (3.2.5) 
Installing sass-rails (3.2.5) 
Installing temple (0.5.5) 
Installing slim (1.3.6) 
Installing thin (1.5.0) with native extensions 
Installing turnip (1.1.0) 
Installing uglifier (1.3.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

Post-install message from hub:

------------------------------------------------------------

                  You there! Wait, I say!
                  =======================

       If you are a heavy user of `git` on the command
       line  you  may  want  to  install `hub` the old
       fashioned way.  Faster  startup  time,  you see.

       Check  out  the  installation  instructions  at
       https://github.com/defunkt/hub#readme  under the
       "Standalone" section.

       Cheers,
       defunkt

------------------------------------------------------------

    composer  Running 'after bundler' callbacks.
The template [/Users/jessmartin/Documents/code/rails-composer/composer.rb] could not be loaded. Error: cannot load such file -- bundler/setup
tamvm commented 11 years ago

I don't know how to reproduce this issue, but sometimes everything works well. Before, I just think that you are missing some required gems like haml, hpricot, ruby_parser, but after installing those gems, the problem isn't resolved. But now, it works well with basic gemset. Maybe it is conflicted with some existing gems.

Anw, we can close this issue now and thanks for your consideration.

jessmartin commented 11 years ago

I got it working:

rvm gemset empty global
rvm use global
gem install bundler
gem install rake
gem install rubygems-bundler
gem install rails
gem install rvm

I think in my case it was a conflict with bundler 1.2.2, which was installed in my global gemset.

bergonom commented 11 years ago

I was running into the exact issue as @jessmartin and based on his recommended solution I ran only the line: gem install bundler

The installation worked after that.

Not sure what that means, but I thought I would share.

bothaus commented 7 years ago

gem install bundler worked for me also!