Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Implementing AppFog

You're reading from   Implementing AppFog Getting to grips with the AppFog service is easily achieved with this hands-on guide, which walks you through creating and deploying applications to the cloud. You'll be developing your first application in minutes.

Arrow left icon
Product type Paperback
Published in Nov 2013
Publisher Packt
ISBN-13 9781849698184
Length 86 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Fixing the application for Ruby 1.8.7


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:

  • In Ruby 1.8.7, you have to explicitly indicate that you're using Gems. This is not necessary in later versions.

  • The set line is a workaround for a bug in the AppFog software. This bug has long since been fixed, but the set command does no harm in later versions of Ruby. However, it is syntactically incorrect in Ruby 1.8.7 so you should remove that line.

Edit the source code so it looks like this:

require 'rubygems'
require 'sinatra'

get '/' do
  erb :index
end

Note

Obviously, inconsistencies...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image