Agile Web Development with Rails, Edition 4

Table of Contents Table of Contents

2 Instant Gratification

RuntimeError: Edit app/controllers/say_controller.rb failed at makedepot.rb:53

Traceback:
  

We start with a simple "hello world!" demo application and in the process verify that everything is installed correctly.

Create the application

bundle exec /home/rubys/git/rails/railties/bin/rails new demo1 --skip-bundle
Expected string default value for '--rc'; got false (boolean)
      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      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/views/layouts/application.html.erb
      create  app/assets/images/.keep
      create  app/mailers/.keep
      create  app/models/.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  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/session_store.rb
      create  config/initializers/to_time_preserves_timezone.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/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.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  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
bundle install --local
Resolving dependencies......
Your Gemfile has no gem server sources. If you need gems that are not already on
your machine, add a line like this to your Gemfile:
source 'https://rubygems.org'
Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          activesupport (= 5.0.0.1)
 
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          activesupport (= 5.0.0.1)
 
    jbuilder (~> 2.0) was resolved to 2.4.1, which depends on
      activesupport (< 5.1, >= 3.0.0)
 
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          rails-dom-testing (~> 2.0) was resolved to 2.0.2, which depends on
            activesupport (< 6.0, >= 4.2.0)
 
    jquery-rails was resolved to 2.2.2, which depends on
      railties (< 5.0, >= 3.0) was resolved to 4.0.13, which depends on
        activesupport (= 4.0.13)
 
    spring was resolved to 2.0.1, which depends on
      activesupport (>= 4.2)
 
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        activesupport (>= 4.0)

See what files were created

ls -p
app/  config/	 db/	  lib/	public/   README.rdoc  tmp/
bin/  config.ru  Gemfile  log/	Rakefile  test/        vendor/

Create a simple controller

rails generate controller Say hello goodbye
/home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/resolver.rb:209:in `rescue in start': Bundler could not find compatible versions for gem "activesupport": (Bundler::VersionConflict)
  In Gemfile:
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          activesupport (= 5.0.0.1)

    
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          activesupport (= 5.0.0.1)

    
    jbuilder (~> 2.0) was resolved to 2.4.1, which depends on
      activesupport (< 5.1, >= 3.0.0)

    
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          rails-dom-testing (~> 2.0) was resolved to 2.0.2, which depends on
            activesupport (< 6.0, >= 4.2.0)

    
    jquery-rails was resolved to 2.2.2, which depends on
      railties (< 5.0, >= 3.0) was resolved to 4.0.13, which depends on
        activesupport (= 4.0.13)

    
    spring was resolved to 2.0.1, which depends on
      activesupport (>= 4.2)

    
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        activesupport (>= 4.0)
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/resolver.rb:203:in `start'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/resolver.rb:182:in `resolve'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/definition.rb:252:in `resolve'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/definition.rb:176:in `specs'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/definition.rb:235:in `specs_for'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/definition.rb:224:in `requested_specs'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/runtime.rb:118:in `block in definition_method'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/runtime.rb:19:in `setup'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler.rb:100:in `setup'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/setup.rb:20:in `<top (required)>'
	from /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
edit app/controllers/say_controller.rb
#<IndexError: regexp not matched>
  /home/rubys/git/gorp/lib/gorp/edit.rb:107:in `dcl'
  makedepot.rb:53:in `block (2 levels) in <main>'
  /home/rubys/git/gorp/lib/gorp/edit.rb:173:in `instance_exec'
  /home/rubys/git/gorp/lib/gorp/edit.rb:173:in `edit'
  makedepot.rb:52:in `block in <main>'
  /home/rubys/git/gorp/lib/gorp/output.rb:59:in `call'
  /home/rubys/git/gorp/lib/gorp/output.rb:59:in `block (4 levels) in <top (required)>'
  /home/rubys/git/gorp/lib/gorp/output.rb:49:in `each'
  /home/rubys/git/gorp/lib/gorp/output.rb:49:in `block (3 levels) in <top (required)>'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `call'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `_nested_structures'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:68:in `tag!'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:93:in `method_missing'
  /home/rubys/git/gorp/lib/gorp/output.rb:22:in `block (2 levels) in <top (required)>'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `call'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `_nested_structures'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:68:in `tag!'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:93:in `method_missing'
  /home/rubys/git/gorp/lib/gorp/output.rb:11:in `block in <top (required)>'
    

Start the server.

Attempt to fetch the file - note that it is missing

get /say/hello
#<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 3000>
  /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/http.rb:879:in `initialize'
  /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/http.rb:879:in `open'
  /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/http.rb:879:in `block in connect'
  /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/timeout.rb:73:in `timeout'
  /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/http.rb:878:in `connect'
  /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
  /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/http.rb:852:in `start'
  /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/http.rb:583:in `start'
  /home/rubys/git/gorp/lib/gorp/net.rb:132:in `post'
  /home/rubys/git/gorp/lib/gorp/net.rb:118:in `get'
  makedepot.rb:59:in `block in <main>'
  /home/rubys/git/gorp/lib/gorp/output.rb:59:in `call'
  /home/rubys/git/gorp/lib/gorp/output.rb:59:in `block (4 levels) in <top (required)>'
  /home/rubys/git/gorp/lib/gorp/output.rb:49:in `each'
  /home/rubys/git/gorp/lib/gorp/output.rb:49:in `block (3 levels) in <top (required)>'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `call'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `_nested_structures'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:68:in `tag!'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:93:in `method_missing'
  /home/rubys/git/gorp/lib/gorp/output.rb:22:in `block (2 levels) in <top (required)>'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `call'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:175:in `_nested_structures'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:68:in `tag!'
  /home/rubys/.rvm/gems/ruby-2.2.5/gems/builder-3.2.3/lib/builder/xmlbase.rb:93:in `method_missing'
  /home/rubys/git/gorp/lib/gorp/output.rb:11:in `block in <top (required)>'
    

cleanup - precompile assets for inclusion in results

rake assets:precompile
/home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/resolver.rb:209:in `rescue in start': Bundler could not find compatible versions for gem "activesupport": (Bundler::VersionConflict)
  In Gemfile:
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          activesupport (= 5.0.0.1)

    
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          activesupport (= 5.0.0.1)

    
    jbuilder (~> 2.0) was resolved to 2.4.1, which depends on
      activesupport (< 5.1, >= 3.0.0)

    
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        actionpack (>= 4.0) was resolved to 5.0.0.1, which depends on
          rails-dom-testing (~> 2.0) was resolved to 2.0.2, which depends on
            activesupport (< 6.0, >= 4.2.0)

    
    jquery-rails was resolved to 2.2.2, which depends on
      railties (< 5.0, >= 3.0) was resolved to 4.0.13, which depends on
        activesupport (= 4.0.13)

    
    spring was resolved to 2.0.1, which depends on
      activesupport (>= 4.2)

    
    sass-rails (~> 5.0) was resolved to 5.0.6, which depends on
      sprockets-rails (< 4.0, >= 2.0) was resolved to 3.2.0, which depends on
        activesupport (>= 4.0)
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/resolver.rb:203:in `start'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/resolver.rb:182:in `resolve'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/definition.rb:252:in `resolve'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/definition.rb:176:in `specs'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/definition.rb:235:in `specs_for'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/definition.rb:224:in `requested_specs'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/runtime.rb:118:in `block in definition_method'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/runtime.rb:19:in `setup'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler.rb:100:in `setup'
	from /home/rubys/.rvm/gems/ruby-2.2.5/gems/bundler-1.14.4/lib/bundler/setup.rb:20:in `<top (required)>'
	from /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/rubys/.rvm/rubies/ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'

Table of Contents Table of Contents