If you're using Ruby 1.9.2 or later, you can run the application unchanged; you can skip this section. To check which version of Ruby you are using, you can type:
$ ruby -v
If you're using Ruby 1.8.7, you'll have to modify the program. The problem is the main application source file app.rb
. Here's the program as AppFog provides it:
require 'sinatra' set :protection, except: :ip_spoofing get '/' do erb :index end
There are two problems with this code. They are as follows:
Edit the source code so it looks like this:
require 'rubygems' require 'sinatra' get '/' do erb :index end
Obviously, inconsistencies such as these between Ruby on your local system and Ruby on the AppFog infrastructures are unacceptable for serious application development. Since this book is using only Ruby to illustrate the development cycle, we don't deal with this issue. See Appendix A for more information.
3.137.41.205