0
+ # A package defines one or more things to provision onto the server.
0
+ # There is a lot of flexibility in a way a package is defined but
0
+ # let me give you a basic example:
0
+ # description 'Ruby MRI'
0
+ # verify { has_executable 'ruby' }
0
+ # The above would define a package named 'ruby' and give it a description
0
+ # and explicitly say its version. It is installed via apt and to verify
0
+ # the installation was successful sprinkle will check for the executable
0
+ # 'ruby' being availble. Pretty simple, right?
0
+ # <b>Note:</b> Defining a package does not INSTALL it. To install a
0
+ # package, you must require it in a Sprinkle::Policy block.
0
+ # Most packages have some sort of pre-requisites in order to be installed.
0
+ # Sprinkle allows you to define the requirements of the package, which
0
+ # will be installed before the package itself. An example below:
0
+ # package :rubygems do
0
+ # source 'http://rubyforge.org/rubygems.tgz'
0
+ # In this case, when rubygems is being installed, Sprinkle will first
0
+ # provision the server with Ruby to make sure the requirements are met.
0
+ # In turn, if ruby has requirements, it installs those first, and so on.
0
+ # Most of the time its important to know whether the software you're
0
+ # attempting to install was installed successfully or not. For this,
0
+ # Sprinkle provides verifications. Verifications are one or more blocks
0
+ # which define rules with which Sprinkle can check if it installed
0
+ # the package successfully. If these verification blocks fail, then
0
+ # Sprinkle will gracefully stop the entire process. An example below:
0
+ # package :rubygems do
0
+ # source 'http://rubyforge.org/rubygems.tgz'
0
+ # verify { has_executable 'gem' }
0
+ # In addition to verifying an installation was successfully, by default
0
+ # Sprinkle runs these verifications <em>before</em> the installation to
0
+ # check if the package is already installed. If the verifications pass
0
+ # before installing the package, it skips the package. To override this
0
+ # behavior, set the -f flag on the sprinkle script or set the
0
+ # :force option to true in Sprinkle::OPTIONS
0
+ # For more information on verifications and to see all the available
0
+ # verifications, see Sprinkle::Verify
0
+ # Sometimes, there are multiple packages available for a single task. An
0
+ # example is a database package. It can contain mySQL, postgres, or sqlite!
0
+ # This is where virtual packages come in handy. They are defined as follows:
0
+ # package :sqlite3, :provides => :database do
0
+ # The :provides option allows you to reference this package either by :sqlite3
0
+ # or by :database. But whereas the package name is unique, multiple packages may
0
+ # share the same provision. If this is the case, when running Sprinkle, the
0
+ # script will ask you which provision you want to install. At this time, you
0
+ # can only install one.
0
+ # A package doesn't require an installer. If you want to define a package which
0
+ # merely encompasses other packages, that is fine too. Example:
0
+ # requires :magic_beans
0
+ # requires :magic_sauce
0
+ # FIXME: Should probably document recommendations.
0
@@ -13,7 +105,7 @@ module Sprinkle
0
+ class Package
#:nodoc:0
include ArbitraryOptions
0
attr_accessor :name, :provides, :installer, :dependencies, :recommends, :verifications
Comments
No one has commented yet.