Fixing iphone4r

There’s a very nice looking plugin for Rails to make it easier to develop iPhone versions of web sites and applications, called iphone4r. It is the work Nicholas Schlueter of, and built on top of work done by (no surprise!) Joe Hewitt.

The only problem I’ve had with it so far is that it doesn’t work! Okay, the problem is quite small, and fairly easily fixed if you have even the slightest understanding of Rails plugins. Since the plugin fails to copy the iui directory to your /public directory, just add a line to install.rb to copy that over. When you’re done, install.rb should look like this:

require 'fileutils'
RAILS_ROOT = File.dirname(__FILE__) + "/../../../" unless defined? RAILS_ROOT
# Install hook code here
def copy_files(source_path, destination_path, directory)
  source, destination = File.join(directory, source_path), File.join(RAILS_ROOT, destination_path)
  FileUtils.mkdir(destination) unless File.exist?(destination)
  FileUtils.cp(Dir.glob(source+'/*'), destination)
directory = File.join(File.dirname(__FILE__), "copy_on_install")
copy_files("/script", "/script", directory)
FileUtils.chmod 0755, File.join(RAILS_ROOT, "script", "ibug"), :verbose => true
copy_files("/public/ibug", "/public/ibug", directory)
copy_files("/public/iui", "/public/iui", directory)

Explore posts in the same categories: Rails, Ruby, Web Development

Tags: , ,

You can comment below, or link to this permanent URL from your own site.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: