ruby-on-railsrubyrailsapps

Why is Rails composer only creating a basic app without features? `open_http': 404 Not Found (OpenURI::HTTPError)


I have just completed the detailed and well-explained Rails tutorial by Daniel Kehoe and am at the end trying to experiment with Rails Composer. I am having a problem creating the app on both Cloud 9 and Windows 10 with the same error. The app creates but only a basic rails app and not the Rails composer app with all the extra features.

First I tried to create the new project with the following command:

rails new rails-devise-roles -m https://raw.github.com/RailsApps/rails-composer/master/composer

and got the following error:

C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:358:in `open_http': 404 Not Found (OpenURI::HTTPError)

I have tried to find line 358 in this file but in the directory C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0 there appears to be no "open-uri.rb" file to inspect.

Below is the full app creation command with result:

C:\>rails new rails-devise-roles -m https://raw.github.com/RailsApps/rails-composer/master/composer
      create
      create  README.md
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in C:/rails-devise-roles/.git/
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/javascripts/application.js
      create  app/assets/javascripts/cable.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images/.keep
      create  app/assets/javascripts/channels
      create  app/assets/javascripts/channels/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/update
      create  bin/yarn
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/cable.yml
      create  config/puma.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/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults_5_1.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  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  tmp
      create  tmp/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  vendor/.keep
      create  package.json
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_5_1.rb
       apply  https://raw.github.com/RailsApps/rails-composer/master/composer
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:358:in `open_http': 404 Not Found (OpenURI::HTTPError)
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:736:in `buffer_open'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:211:in `block in open_loop'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:209:in `catch'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:209:in `open_loop'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:150:in `open_uri'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:716:in `open'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/open-uri.rb:34:in `open'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/actions.rb:220:in `apply'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/generators/app_base.rb:162:in `apply_rails_template'
        from (eval):1:in `apply_rails_template'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/commands/application/application_command.rb:24:in `perform'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/command/base.rb:63:in `perform'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/command.rb:44:in `invoke'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/lib/rails/cli.rb:16:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.1.5/exe/rails:9:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.2.0/bin/rails:23:in `load'
        from C:/RailsInstaller/Ruby2.2.0/bin/rails:23:in `<main>'

Solution

  • Your endpoint is not reachable, try:

    rails new rails-devise-roles -m https://raw.githubusercontent.com/RailsApps/rails-composer/master/composer.rb
    

    But if that doesn't work, just download the ruby code locally from the raw file and just point to the local rb file.

    in your terminal:

    curl -O https://raw.githubusercontent.com/RailsApps/rails-composer/master/composer.rb
    
    rails new rails-devise-roles -m composer.rb