crafterm / sprinkle

Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to install a Rails, or Sinatra stack on a brand new slice directly after its been created

This URL has Read+Write access

plusplus (author)
Sun Jan 04 18:59:07 -0800 2009
crafterm (committer)
Fri Jul 24 00:04:37 -0700 2009
sprinkle / lib / sprinkle / installers / gem.rb
fcbbd93f » crafterm 2008-02-27 Initial Sprinkle source import 1 module Sprinkle
2 module Installers
33c10a3a » mitchellh 2008-07-19 I've started documenting al... 3 # = Ruby Gem Package Installer
4 #
5 # The gem package installer installs ruby gems.
6 #
7 # The installer has a single optional configuration: source.
8 # By changing source you can specify a given ruby gems
9 # repository from which to install.
10 #
11 # == Example Usage
12 #
13 # First, a simple installation of the magic_beans gem:
14 #
15 # package :magic_beans do
16 # description "Beans beans they're good for your heart..."
17 # gem 'magic_beans'
18 # end
19 #
20 # Second, install magic_beans gem from github:
21 #
22 # package :magic_beans do
23 # gem 'magic_beans_package' do
24 # source 'http://gems.github.com'
25 # end
26 # end
27 #
28 # As you can see, setting options is as simple as creating a
29 # block and calling the option as a method with the value as
30 # its parameter.
fcbbd93f » crafterm 2008-02-27 Initial Sprinkle source import 31 class Gem < Installer
33c10a3a » mitchellh 2008-07-19 I've started documenting al... 32 attr_accessor :gem #:nodoc:
c3461788 » crafterm 2008-05-20 Implemented gem installer s... 33
33c10a3a » mitchellh 2008-07-19 I've started documenting al... 34 def initialize(parent, gem, options = {}, &block) #:nodoc:
ec39d3a1 » crafterm 2008-05-22 Add support for a custom ge... 35 super parent, options, &block
fcbbd93f » crafterm 2008-02-27 Initial Sprinkle source import 36 @gem = gem
37 end
c3461788 » crafterm 2008-05-20 Implemented gem installer s... 38
33c10a3a » mitchellh 2008-07-19 I've started documenting al... 39 def source(location = nil) #:nodoc:
9701e6bd » crafterm 2008-05-25 Fix issue with installer op... 40 # package defines an installer called source so here we specify a method directly
41 # rather than rely on the automatic options processing since packages' method missing
42 # won't be run
43 return @options[:source] unless location
44 @options[:source] = location
45 end
46
fcbbd93f » crafterm 2008-02-27 Initial Sprinkle source import 47 protected
c3461788 » crafterm 2008-05-20 Implemented gem installer s... 48
fcbbd93f » crafterm 2008-02-27 Initial Sprinkle source import 49 # rubygems 0.9.5+ installs dependencies by default, and does platform selection
c3461788 » crafterm 2008-05-20 Implemented gem installer s... 50
33c10a3a » mitchellh 2008-07-19 I've started documenting al... 51 def install_commands #:nodoc:
ec39d3a1 » crafterm 2008-05-22 Add support for a custom ge... 52 cmd = "gem install #{gem}"
53 cmd << " --version '#{version}'" if version
54 cmd << " --source #{source}" if source
7b65e1a4 » Ari Lerner 2008-07-20 * Added option? to configur... 55 cmd << " --install-dir #{repository}" if option?(:repository)
42ede0e5 » jsierles 2008-11-25 build gems without docs by ... 56 cmd << " --no-rdoc --no-ri" unless option?(:build_docs)
3fd942d5 » plusplus 2009-01-04 Added http proxy options to... 57 cmd << " --http-proxy #{http_proxy}" if option?(:http_proxy)
52b95477 » plusplus 2008-12-18 Added build flags option to... 58 cmd << " -- #{build_flags}" if option?(:build_flags)
ec39d3a1 » crafterm 2008-05-22 Add support for a custom ge... 59 cmd
fcbbd93f » crafterm 2008-02-27 Initial Sprinkle source import 60 end
7b65e1a4 » Ari Lerner 2008-07-20 * Added option? to configur... 61
fcbbd93f » crafterm 2008-02-27 Initial Sprinkle source import 62 end
63 end
64 end