| Class | RailsInstaller |
| In: |
lib/rails-installer/commands.rb
lib/rails-installer/databases.rb lib/rails-installer/web-servers.rb lib/rails-installer.rb |
| Parent: | Object |
An installer for Rails applications.
The Rails Application Installer is designed to make it easy for end-users to install open-source Rails apps with a minimum amount of effort. When built properly, all the user needs to do is run:
$ gem install my_app $ my_app install /some/path
To use this installer, you’ll need to create a small driver program (the ‘my_app’ program from above). Here’s a minimal example:
#!/usr/bin/env ruby
require 'rubygems'
require 'rails-installer'
class AppInstaller < RailsInstaller
application_name 'my_shiny_metal_app'
support_location 'our shiny website'
rails_version '1.1.4'
end
# Installer program
directory = ARGV[1]
app = AppInstaller.new(directory)
app.message_proc = Proc.new do |msg|
STDERR.puts " #{msg}"
end
app.execute_command(*ARGV)
Place this in your application’s gem/ directory, and then add it to your .gem using the ‘executables’ gemspec option. See the examples/ directory for more complex examples.
| config | [RW] | |
| install_directory | [RW] | |
| message_proc | [RW] | |
| source_directory | [RW] |
Compute the different between two hashes. Returns four hashes, one contains the keys that are in ‘b’ but not in ‘a’ (added entries), the next contains keys that are in ‘a’ and ‘b’, but have different values (changed). The third contains keys that are in ‘b’ but not ‘a’ (added). The final hash contains items that are the same in each.
The easy way to add steps to the installation process. install_pre_hook runs right after the DB is backed up and right before the first migration attempt.
Pre-migrate the database. This checks to see if we’re downgrading to an earlier version of our app, and runs ‘rake migrate VERSION=…’ to downgrade the database.
Run Rails tests. This helps verify that we have a clean install with all dependencies. This cuts down on a lot of bug reports.