Agile Web Development with Rails, Edition 4

Agile Web Development with Rails, Edition 4

Table of Contents Table of Contents

2 Instant Gratification

Expected at least 1 element matching "h1", found 0.

Traceback:
  /home/rubys/svn/rails4/Book/util/checkdepot.rb:14:in `block in <class:DepotTest>'

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

Create the application

ruby -rubygems /home/rubys/git/rails/bin/rails demo1
      create  
      create  README
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/helpers/application_helper.rb
      create  app/views/layouts/application.html.erb
      create  app/controllers/application_controller.rb
      create  app/models
      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/test.rb
      create  config/environments/production.rb
      create  config/initializers
      create  config/initializers/mime_types.rb
      create  config/initializers/inflections.rb
      create  config/initializers/session_store.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/secret_token.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  log
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log
      create  public
      create  public/500.html
      create  public/robots.txt
      create  public/favicon.ico
      create  public/422.html
      create  public/404.html
      create  public/index.html
      create  public/images
      create  public/images/rails.png
      create  public/stylesheets
      create  public/stylesheets/.gitkeep
      create  public/javascripts
      create  public/javascripts/prototype.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/rails.js
      create  public/javascripts/effects.js
      create  public/javascripts/controls.js
      create  public/javascripts/application.js
      create  script
      create  script/rails
      create  test
      create  test/performance/browsing_test.rb
      create  test/test_helper.rb
      create  test/fixtures
      create  test/unit
      create  test/functional
      create  test/integration
      create  tmp
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
bundle install
Using rake (0.8.7) from system gems
Using abstract (1.0.0) from bundler gems
Using builder (2.1.2) from bundler gems
Using i18n (0.4.0.beta1) from bundler gems
Using memcache-client (1.8.3) from bundler gems
Using tzinfo (0.3.20) from bundler gems
Using activesupport (3.0.0.beta3) from source code at /home/rubys/git/rails
Using activemodel (3.0.0.beta3) from source code at /home/rubys/git/rails
Using erubis (2.6.5) from bundler gems
Using rack (1.1.0) from bundler gems
Using rack-mount (0.6.3) from bundler gems
Using rack-test (0.5.3) from bundler gems
Using actionpack (3.0.0.beta3) from source code at /home/rubys/git/rails
Using mime-types (1.16) from bundler gems
Using polyglot (0.3.1) from bundler gems
Using treetop (1.4.5) from bundler gems
Using mail (2.2.0) from bundler gems
Using text-hyphen (1.0.0) from bundler gems
Using text-format (1.0.0) from bundler gems
Using actionmailer (3.0.0.beta3) from source code at /home/rubys/git/rails
Using arel (0.3.3) from bundler gems
Using activerecord (3.0.0.beta3) from source code at /home/rubys/git/rails
Using activeresource (3.0.0.beta3) from source code at /home/rubys/git/rails
Using bundler (0.9.24) from bundler gems
Using thor (0.13.6) from bundler gems
Using railties (3.0.0.beta3) from source code at /home/rubys/git/rails
Using rails (3.0.0.beta3) from source code at /home/rubys/git/rails
Using sqlite3-ruby (1.2.5) from bundler gems
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

See what files were created

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

Create a simple controller

rails generate controller Say hello goodbye
      create  app/controllers/say_controller.rb
       route  get "say/goodbye"
       route  get "say/hello"
      invoke  erb
      create    app/views/say
      create    app/views/say/hello.html.erb
      create    app/views/say/goodbye.html.erb
      invoke  test_unit
      create    test/functional/say_controller_test.rb
      invoke  helper
      create    app/helpers/say_helper.rb
      invoke    test_unit
      create      test/unit/helpers/say_helper_test.rb
edit app/controllers/say_controller.rb
class SayController < ApplicationController
  def hello
  end
 
  def goodbye
  end
 
end

Start the server.

Attempt to fetch the file - note that it is missing

get /say/hello
#<EOFError: end of file reached>
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/protocol.rb:135:in `sysread'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/protocol.rb:135:in `block in rbuf_fill'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/timeout.rb:52:in `timeout'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/timeout.rb:82:in `timeout'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/protocol.rb:134:in `rbuf_fill'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/protocol.rb:126:in `readline'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/http.rb:2136:in `read_status_line'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/http.rb:2125:in `read_new'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/http.rb:1117:in `transport_request'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/http.rb:1103:in `request'
  /home/rubys/git/gorp/lib/gorp/net.rb:100:in `block in post'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/http.rb:564:in `start'
  /home/rubys/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/net/http.rb:453:in `start'
  /home/rubys/git/gorp/lib/gorp/net.rb:92:in `post'
  /home/rubys/git/gorp/lib/gorp/net.rb:79:in `get'
  makedepot.rb:34: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-1.9.1-p378/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `call'
  /home/rubys/.rvm/gems/ruby-1.9.1-p378/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `_nested_structures'
  /home/rubys/.rvm/gems/ruby-1.9.1-p378/gems/builder-2.1.2/lib/builder/xmlbase.rb:58:in `method_missing'
  /home/rubys/git/gorp/lib/gorp/output.rb:22:in `block (2 levels) in <top (required)>'
  /home/rubys/.rvm/gems/ruby-1.9.1-p378/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `call'
  /home/rubys/.rvm/gems/ruby-1.9.1-p378/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `_nested_structures'
  /home/rubys/.rvm/gems/ruby-1.9.1-p378/gems/builder-2.1.2/lib/builder/xmlbase.rb:58:in `method_missing'
  /home/rubys/git/gorp/lib/gorp/output.rb:11:in `block in <top (required)>'
    

Table of Contents Table of Contents