dhill-sprinkle 0.3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/.gitignore +3 -0
  2. data/CREDITS +33 -0
  3. data/Gemfile +4 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.markdown +242 -0
  6. data/Rakefile +2 -0
  7. data/VERSION +1 -0
  8. data/bin/sprinkle +95 -0
  9. data/examples/packages/build_essential.rb +9 -0
  10. data/examples/packages/databases/mysql.rb +13 -0
  11. data/examples/packages/databases/sqlite3.rb +16 -0
  12. data/examples/packages/phusion.rb +55 -0
  13. data/examples/packages/ruby/rails.rb +9 -0
  14. data/examples/packages/ruby/ruby.rb +17 -0
  15. data/examples/packages/ruby/rubygems.rb +17 -0
  16. data/examples/packages/scm/git.rb +11 -0
  17. data/examples/packages/scm/subversion.rb +4 -0
  18. data/examples/packages/servers/apache.rb +15 -0
  19. data/examples/rails/README +15 -0
  20. data/examples/rails/deploy.rb +2 -0
  21. data/examples/rails/packages/database.rb +9 -0
  22. data/examples/rails/packages/essential.rb +9 -0
  23. data/examples/rails/packages/rails.rb +29 -0
  24. data/examples/rails/packages/scm.rb +11 -0
  25. data/examples/rails/packages/search.rb +11 -0
  26. data/examples/rails/packages/server.rb +28 -0
  27. data/examples/rails/rails.rb +73 -0
  28. data/examples/sprinkle/sprinkle.rb +38 -0
  29. data/lib/sprinkle.rb +3 -0
  30. data/lib/sprinkle/actors/actors.rb +17 -0
  31. data/lib/sprinkle/actors/capistrano.rb +146 -0
  32. data/lib/sprinkle/actors/local.rb +37 -0
  33. data/lib/sprinkle/actors/ssh.rb +177 -0
  34. data/lib/sprinkle/actors/vlad.rb +83 -0
  35. data/lib/sprinkle/configurable.rb +31 -0
  36. data/lib/sprinkle/deployment.rb +73 -0
  37. data/lib/sprinkle/extensions/arbitrary_options.rb +10 -0
  38. data/lib/sprinkle/extensions/array.rb +5 -0
  39. data/lib/sprinkle/extensions/blank_slate.rb +5 -0
  40. data/lib/sprinkle/extensions/dsl_accessor.rb +15 -0
  41. data/lib/sprinkle/extensions/string.rb +10 -0
  42. data/lib/sprinkle/extensions/symbol.rb +7 -0
  43. data/lib/sprinkle/installers/apt.rb +52 -0
  44. data/lib/sprinkle/installers/binary.rb +46 -0
  45. data/lib/sprinkle/installers/bsd_port.rb +33 -0
  46. data/lib/sprinkle/installers/deb.rb +41 -0
  47. data/lib/sprinkle/installers/freebsd_pkg.rb +37 -0
  48. data/lib/sprinkle/installers/freebsd_portinstall.rb +36 -0
  49. data/lib/sprinkle/installers/gem.rb +64 -0
  50. data/lib/sprinkle/installers/install_package.rb +79 -0
  51. data/lib/sprinkle/installers/installer.rb +123 -0
  52. data/lib/sprinkle/installers/mac_port.rb +38 -0
  53. data/lib/sprinkle/installers/noop.rb +20 -0
  54. data/lib/sprinkle/installers/openbsd_pkg.rb +47 -0
  55. data/lib/sprinkle/installers/opensolaris_pkg.rb +43 -0
  56. data/lib/sprinkle/installers/push_text.rb +45 -0
  57. data/lib/sprinkle/installers/rake.rb +37 -0
  58. data/lib/sprinkle/installers/replace_text.rb +45 -0
  59. data/lib/sprinkle/installers/rpm.rb +37 -0
  60. data/lib/sprinkle/installers/runner.rb +18 -0
  61. data/lib/sprinkle/installers/smart.rb +29 -0
  62. data/lib/sprinkle/installers/source.rb +201 -0
  63. data/lib/sprinkle/installers/transfer.rb +178 -0
  64. data/lib/sprinkle/installers/user.rb +15 -0
  65. data/lib/sprinkle/installers/yum.rb +37 -0
  66. data/lib/sprinkle/installers/zypper.rb +43 -0
  67. data/lib/sprinkle/package.rb +326 -0
  68. data/lib/sprinkle/policy.rb +125 -0
  69. data/lib/sprinkle/script.rb +23 -0
  70. data/lib/sprinkle/verifiers/apt.rb +21 -0
  71. data/lib/sprinkle/verifiers/directory.rb +16 -0
  72. data/lib/sprinkle/verifiers/executable.rb +53 -0
  73. data/lib/sprinkle/verifiers/file.rb +34 -0
  74. data/lib/sprinkle/verifiers/package.rb +26 -0
  75. data/lib/sprinkle/verifiers/process.rb +21 -0
  76. data/lib/sprinkle/verifiers/rpm.rb +21 -0
  77. data/lib/sprinkle/verifiers/ruby.rb +25 -0
  78. data/lib/sprinkle/verifiers/symlink.rb +30 -0
  79. data/lib/sprinkle/verify.rb +114 -0
  80. data/lib/sprinkle/version.rb +3 -0
  81. data/script/console +8 -0
  82. data/script/destroy +14 -0
  83. data/script/generate +14 -0
  84. data/spec/spec.opts +1 -0
  85. data/spec/spec_helper.rb +17 -0
  86. data/spec/sprinkle/actors/capistrano_spec.rb +265 -0
  87. data/spec/sprinkle/actors/local_spec.rb +29 -0
  88. data/spec/sprinkle/configurable_spec.rb +46 -0
  89. data/spec/sprinkle/deployment_spec.rb +80 -0
  90. data/spec/sprinkle/extensions/array_spec.rb +19 -0
  91. data/spec/sprinkle/extensions/string_spec.rb +21 -0
  92. data/spec/sprinkle/installers/apt_spec.rb +70 -0
  93. data/spec/sprinkle/installers/bsd_port_spec.rb +42 -0
  94. data/spec/sprinkle/installers/freebsd_pkg_spec.rb +49 -0
  95. data/spec/sprinkle/installers/freebsd_portinstall_spec.rb +42 -0
  96. data/spec/sprinkle/installers/gem_spec.rb +107 -0
  97. data/spec/sprinkle/installers/installer_spec.rb +151 -0
  98. data/spec/sprinkle/installers/mac_port_spec.rb +42 -0
  99. data/spec/sprinkle/installers/noop_spec.rb +23 -0
  100. data/spec/sprinkle/installers/openbsd_pkg_spec.rb +49 -0
  101. data/spec/sprinkle/installers/opensolaris_pkg_spec.rb +49 -0
  102. data/spec/sprinkle/installers/push_text_spec.rb +66 -0
  103. data/spec/sprinkle/installers/rake_spec.rb +29 -0
  104. data/spec/sprinkle/installers/replace_text_spec.rb +45 -0
  105. data/spec/sprinkle/installers/rpm_spec.rb +50 -0
  106. data/spec/sprinkle/installers/runner_spec.rb +31 -0
  107. data/spec/sprinkle/installers/source_spec.rb +371 -0
  108. data/spec/sprinkle/installers/transfer_spec.rb +98 -0
  109. data/spec/sprinkle/installers/yum_spec.rb +49 -0
  110. data/spec/sprinkle/installers/zypper_spec.rb +49 -0
  111. data/spec/sprinkle/package_spec.rb +474 -0
  112. data/spec/sprinkle/policy_spec.rb +126 -0
  113. data/spec/sprinkle/script_spec.rb +51 -0
  114. data/spec/sprinkle/sprinkle_spec.rb +25 -0
  115. data/spec/sprinkle/verify_spec.rb +173 -0
  116. data/sprinkle-0.3.3.1.gem +0 -0
  117. data/sprinkle.gemspec +26 -0
  118. metadata +281 -0
@@ -0,0 +1,10 @@
1
+ class String #:nodoc:
2
+
3
+ # REVISIT: what chars shall we allow in task names?
4
+ def to_task_name
5
+ s = downcase
6
+ s.gsub!(/-/, '_') # all - to _ chars
7
+ s
8
+ end
9
+
10
+ end
@@ -0,0 +1,7 @@
1
+ class Symbol #:nodoc:
2
+
3
+ def to_task_name
4
+ to_s.to_task_name
5
+ end
6
+
7
+ end
@@ -0,0 +1,52 @@
1
+ module Sprinkle
2
+ module Installers
3
+ # = Apt Package Installer
4
+ #
5
+ # The Apt package installer uses the +apt-get+ command to install
6
+ # packages. The apt installer has only one option which can be
7
+ # modified which is the +dependencies_only+ option. When this is
8
+ # set to true, the installer uses +build-dep+ instead of +install+
9
+ # to only build the dependencies.
10
+ #
11
+ # == Example Usage
12
+ #
13
+ # First, a simple installation of the magic_beans package:
14
+ #
15
+ # package :magic_beans do
16
+ # description "Beans beans they're good for your heart..."
17
+ # apt 'magic_beans_package'
18
+ # end
19
+ #
20
+ # Second, only build the magic_beans dependencies:
21
+ #
22
+ # package :magic_beans_depends do
23
+ # apt 'magic_beans_package' { dependencies_only true }
24
+ # end
25
+ #
26
+ # As you can see, setting options is as simple as creating a
27
+ # block and calling the option as a method with the value as
28
+ # its parameter.
29
+ class Apt < Installer
30
+ attr_accessor :packages #:nodoc:
31
+
32
+ def initialize(parent, *packages, &block) #:nodoc:
33
+ packages.flatten!
34
+
35
+ options = { :dependencies_only => false }
36
+ options.update(packages.pop) if packages.last.is_a?(Hash)
37
+
38
+ super parent, options, &block
39
+
40
+ @packages = packages
41
+ end
42
+
43
+ protected
44
+
45
+ def install_commands #:nodoc:
46
+ command = @options[:dependencies_only] ? 'build-dep' : 'install'
47
+ "env DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get --force-yes -qyu #{command} #{@packages.join(' ')}"
48
+ end
49
+
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,46 @@
1
+ module Sprinkle
2
+ module Installers
3
+ # = Binary Installer
4
+ #
5
+ # binary "http://some.url.com/archive.tar.gz" do
6
+ # prefix "/home/user/local"
7
+ # archives "/home/user/sources"
8
+ # end
9
+ #
10
+ class Binary < Installer
11
+ def initialize(parent, binary_archive, options = {}, &block) #:nodoc:
12
+ @binary_archive = binary_archive
13
+ @options = options
14
+ super parent, options, &block
15
+ end
16
+
17
+ def prepare_commands #:nodoc:
18
+ raise 'No installation area defined' unless @options[:prefix]
19
+ raise 'No archive download area defined' unless @options[:archives]
20
+
21
+ [ "mkdir -p #{@options[:prefix]}",
22
+ "mkdir -p #{@options[:archives]}" ]
23
+ end
24
+
25
+ def install_commands #:nodoc:
26
+ commands = [ "bash -c 'wget -cq --directory-prefix=#{@options[:archives]} #{@binary_archive}'" ]
27
+ commands << "bash -c 'cd #{@options[:prefix]} && #{extract_command} #{@options[:archives]}/#{@binary_archive.split("/").last}'"
28
+ end
29
+
30
+ def extract_command(archive_name = @binary_archive.split("/").last)
31
+ case archive_name
32
+ when /(tar.gz)|(tgz)$/
33
+ 'tar xzf'
34
+ when /(tar.bz2)|(tb2)$/
35
+ 'tar xjf'
36
+ when /tar$/
37
+ 'tar xf'
38
+ when /zip$/
39
+ 'unzip -o'
40
+ else
41
+ raise "Unknown binary archive format: #{archive_name}"
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,33 @@
1
+ module Sprinkle
2
+ module Installers
3
+ # = OpenBSD and FreeBSD Port Installer
4
+ #
5
+ # The Port installer installs OpenBSD and FreeBSD ports.
6
+ # Before usage, the ports sytem must be installed and
7
+ # read on the target operating system.
8
+ #
9
+ # == Example Usage
10
+ #
11
+ # Installing the magic_beans port.
12
+ #
13
+ # package :magic_beans do
14
+ # bsd_port 'magic/magic_beans'
15
+ # end
16
+ #
17
+ class BsdPort < Installer
18
+ attr_accessor :port #:nodoc:
19
+
20
+ def initialize(parent, port, &block) #:nodoc:
21
+ super parent, &block
22
+ @port = port
23
+ end
24
+
25
+ protected
26
+
27
+ def install_commands #:nodoc:
28
+ "sh -c 'cd /usr/ports/#{@port} && make BATCH=yes install clean'"
29
+ end
30
+
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,41 @@
1
+ module Sprinkle
2
+ module Installers
3
+ # = Deb Package Installer
4
+ #
5
+ # The Deb installer installs deb packages sourced from a remote URL
6
+ #
7
+ # == Example Usage
8
+ #
9
+ # Installing the magic_beans deb.
10
+ #
11
+ # package :magic_beans do
12
+ # deb 'http://debs.example.com/magic_beans.deb'
13
+ # end
14
+ #
15
+ class Deb < Installer
16
+ attr_accessor :packages #:nodoc:
17
+
18
+ def initialize(parent, packages, &block) #:nodoc:
19
+ super parent, &block
20
+ packages = [packages] unless packages.is_a? Array
21
+ @packages = packages
22
+ end
23
+
24
+ protected
25
+
26
+ def install_commands #:nodoc:
27
+ [
28
+ "wget -cq --directory-prefix=/tmp #{@packages.join(' ')}",
29
+ "dpkg -i #{@packages.collect{|p| "/tmp/#{package_name(p)}"}.join(" ")}"
30
+ ]
31
+ end
32
+
33
+ private
34
+
35
+ def package_name(url)
36
+ url.split('/').last
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,37 @@
1
+ module Sprinkle
2
+ module Installers
3
+ # = FreeBSD Package Installer
4
+ #
5
+ # The Pkg package installer installs FreeBSD packages.
6
+ #
7
+ # == Example Usage
8
+ #
9
+ # Installing the magic_beans package.
10
+ #
11
+ # package :magic_beans do
12
+ # freebsd_pkg 'magic_beans'
13
+ # end
14
+ #
15
+ # You may also specify multiple packages as an array:
16
+ #
17
+ # package :magic_beans do
18
+ # freebsd_pkg %w(magic_beans magic_sauce)
19
+ # end
20
+ class FreebsdPkg < Installer
21
+ attr_accessor :packages #:nodoc:
22
+
23
+ def initialize(parent, packages, &block) #:nodoc:
24
+ super parent, &block
25
+ packages = [packages] unless packages.is_a? Array
26
+ @packages = packages
27
+ end
28
+
29
+ protected
30
+
31
+ def install_commands #:nodoc:
32
+ "pkg_add -r #{@packages.join(' ')}"
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,36 @@
1
+ module Sprinkle
2
+ module Installers
3
+ # = FreeBSD Portinstall Installer
4
+ #
5
+ # The Portinstall installer installs FreeBSD ports.
6
+ # It uses the ports-mgmt/portupgrade port to install.
7
+ # Before usage, the ports system must be installed and
8
+ # read on the target operating system.
9
+ # It is recommended to use `portsnap fetch extract` to
10
+ # install the ports system.
11
+ #
12
+ # == Example Usage
13
+ #
14
+ # Installing the magic_beans port.
15
+ #
16
+ # package :magic_beans do
17
+ # freebsd_portinstall 'magic/magic_beans'
18
+ # end
19
+ #
20
+ class FreebsdPortinstall < Installer
21
+ attr_accessor :port #:nodoc:
22
+
23
+ def initialize(parent, port, &block) #:nodoc:
24
+ super parent, &block
25
+ @port = port
26
+ end
27
+
28
+ protected
29
+
30
+ def install_commands #:nodoc:
31
+ "portinstall --batch #{@port}"
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,64 @@
1
+ module Sprinkle
2
+ module Installers
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.
31
+ class Gem < Installer
32
+ attr_accessor :gem #:nodoc:
33
+
34
+ def initialize(parent, gem, options = {}, &block) #:nodoc:
35
+ super parent, options, &block
36
+ @gem = gem
37
+ end
38
+
39
+ def source(location = nil) #:nodoc:
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
+
47
+ protected
48
+
49
+ # rubygems 0.9.5+ installs dependencies by default, and does platform selection
50
+
51
+ def install_commands #:nodoc:
52
+ cmd = "gem install #{gem}"
53
+ cmd << " --version '#{version}'" if version
54
+ cmd << " --source #{source}" if source
55
+ cmd << " --install-dir #{repository}" if option?(:repository)
56
+ cmd << " --no-rdoc --no-ri" unless option?(:build_docs)
57
+ cmd << " --http-proxy #{http_proxy}" if option?(:http_proxy)
58
+ cmd << " -- #{build_flags}" if option?(:build_flags)
59
+ cmd
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,79 @@
1
+ module Sprinkle
2
+ module Installers
3
+ class InstallPackage < Installer
4
+ cattr_accessor :installer
5
+ attr_accessor :packages #:nodoc:
6
+
7
+ def initialize(parent, packages, &block) #:nodoc:
8
+ super parent, &block
9
+ if packages.is_a?(Array) && packages.first.is_a?(Array)
10
+ packages = packages.first
11
+ else
12
+ packages = [packages] unless packages.is_a? Array
13
+ end
14
+
15
+ @packages = packages
16
+ end
17
+
18
+ protected
19
+
20
+ def install_commands #:nodoc:
21
+ case installer
22
+ when :smart
23
+ "smart install #{@packages.join(' ')} -y 2>&1 | tee -a /var/log/smart-sprinkle"
24
+ when :yum
25
+ "yum install #{@packages.join(' ')} -y 2>&1 | tee -a /var/log/yum-sprinkle"
26
+ else
27
+ raise "Unknown InstallPackage.installer"
28
+ end
29
+ end
30
+ end
31
+
32
+ class UninstallPackage < Installer
33
+ attr_accessor :packages #:nodoc:
34
+
35
+ def initialize(parent, packages, &block) #:nodoc:
36
+ super parent, &block
37
+ if packages.is_a?(Array) && packages.first.is_a?(Array)
38
+ packages = packages.first
39
+ else
40
+ packages = [packages] unless packages.is_a? Array
41
+ end
42
+
43
+ @packages = packages
44
+ end
45
+
46
+ protected
47
+
48
+ def install_commands #:nodoc:
49
+ case Sprinkle::Installers::InstallPackage.installer
50
+ when :smart
51
+ "smart remove #{@packages.join(' ')} -y 2>&1 | tee -a /var/log/smart-sprinkle"
52
+ when :yum
53
+ "yum erase #{@packages.join(' ')} -y 2>&1 | tee -a /var/log/yum-sprinkle"
54
+ else
55
+ raise "Unknown InstallPackage.installer"
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ module Sprinkle
63
+ module Package
64
+ class Package
65
+ def install_package(*names, &block)
66
+ @installers << Sprinkle::Installers::InstallPackage.new(self, names, &block)
67
+ end
68
+
69
+ def uninstall_package(*names, &block)
70
+ @installers << Sprinkle::Installers::UninstallPackage.new(self, names, &block)
71
+ end
72
+
73
+
74
+ alias_method :install_packages, :install_package
75
+ alias_method :uninstall_packages, :uninstall_package
76
+ end
77
+ end
78
+ end
79
+
@@ -0,0 +1,123 @@
1
+ module Sprinkle
2
+ module Installers
3
+ # The base class which all installers must subclass, this class makes
4
+ # sure all installers share some general features, which are outlined
5
+ # below.
6
+ #
7
+ # = Pre/Post Installation Hooks
8
+ #
9
+ # With all intallation methods you have the ability to specify multiple
10
+ # pre/post installation hooks. This gives you the ability to specify
11
+ # commands to run before and after an installation takes place. All
12
+ # commands by default are sudo'd so there is no need to include "sudo"
13
+ # in the command itself. There are three ways to specify a pre/post hook.
14
+ #
15
+ # First, a single command:
16
+ #
17
+ # pre :install, 'echo "Hello, World!"'
18
+ # post :install, 'rm -rf /'
19
+ #
20
+ # Second, an array of commands:
21
+ #
22
+ # commands = ['echo "First"', 'echo "Then Another"']
23
+ # pre :install, commands
24
+ # post :install, commands
25
+ #
26
+ # Third, a block which returns either a single or multiple commands:
27
+ #
28
+ # pre :install do
29
+ # amount = 7 * 3
30
+ # "echo 'Before we install, lets plant #{amount} magic beans...'"
31
+ # end
32
+ # post :install do
33
+ # ['echo "Now... let's hope they sprout!", 'echo "Indeed they have!"']
34
+ # end
35
+ #
36
+ # = Other Pre/Post Hooks
37
+ #
38
+ # Some installation methods actually grant you more fine grained
39
+ # control of when commands are run rather than a blanket pre :install
40
+ # or post :install. If this is the case, it will be documented on
41
+ # the installation method's corresponding documentation page.
42
+ class Installer
43
+ include Sprinkle::Configurable
44
+ attr_accessor :delivery, :package, :options, :pre, :post #:nodoc:
45
+
46
+ def initialize(package, options = {}, &block) #:nodoc:
47
+ @package = package
48
+ @options = options
49
+ @pre = {}; @post = {}
50
+ self.instance_eval(&block) if block
51
+ end
52
+
53
+ def pre(stage, *commands)
54
+ @pre[stage] ||= []
55
+ @pre[stage] += commands
56
+ @pre[stage] += [yield] if block_given?
57
+ end
58
+
59
+ def post(stage, *commands)
60
+ @post[stage] ||= []
61
+ @post[stage] += commands
62
+ @post[stage] += [yield] if block_given?
63
+ end
64
+
65
+ def process(roles) #:nodoc:
66
+ assert_delivery
67
+
68
+ if logger.debug?
69
+ sequence = install_sequence; sequence = sequence.join('; ') if sequence.is_a? Array
70
+ logger.debug "#{@package.name} install sequence: #{sequence} for roles: #{roles}\n"
71
+ end
72
+
73
+ unless Sprinkle::OPTIONS[:testing]
74
+ logger.info "--> Installing #{package.name} for roles: #{roles}"
75
+ @delivery.process(@package.name, install_sequence, roles)
76
+ end
77
+ end
78
+
79
+ protected
80
+ # More complicated installers that have different stages, and require pre/post commands
81
+ # within stages can override install_sequence and take complete control of the install
82
+ # command sequence construction (eg. source based installer).
83
+ def install_sequence
84
+ commands = pre_commands(:install) + [ install_commands ] + post_commands(:install)
85
+ commands.flatten
86
+ end
87
+
88
+ # A concrete installer (subclass of this virtual class) must override this method
89
+ # and return the commands it needs to run as either a string or an array.
90
+ #
91
+ # <b>Overriding this method is required.</b>
92
+ def install_commands
93
+ raise 'Concrete installers implement this to specify commands to run to install their respective packages'
94
+ end
95
+
96
+ def pre_commands(stage) #:nodoc:
97
+ # DWH 20110407 - Added stage to fix bug as build directory and log don't exist yet
98
+ dress @pre[stage] || [], stage, :pre
99
+ end
100
+
101
+ def post_commands(stage) #:nodoc:
102
+ # DWH 20110407 - Added stage to fix bug as build directory and log don't exist yet
103
+ dress @post[stage] || [], stage, :post
104
+ end
105
+
106
+ # Concrete installers (subclasses of this virtual class) can override this method to
107
+ # specify stage-specific (pre-installation, post-installation, etc.) modifications
108
+ # of commands.
109
+ #
110
+ # An example usage of overriding this would be to prefix all commands for a
111
+ # certain stage to change to a certain directory. An example is given below:
112
+ #
113
+ # def dress(commands, stage, type)
114
+ # commands.collect { |x| "cd #{magic_beans_path} && #{x}" }
115
+ # end
116
+ #
117
+ # By default, no modifications are made to the commands.
118
+ # DWH 20110407 - Added stage parameter to fix bug as build directory and log don't exist yet
119
+ def dress(commands, stage, type); commands; end
120
+
121
+ end
122
+ end
123
+ end