lib/sprinkle/installers/source.rb in crafterm-sprinkle-0.1.2 vs lib/sprinkle/installers/source.rb in crafterm-sprinkle-0.1.4
- old
+ new
@@ -1,26 +1,15 @@
module Sprinkle
module Installers
class Source < Installer
- attr_accessor :source, :pre, :post
+ attr_accessor :source
def initialize(parent, source, options = {}, &block)
- @pre = {}; @post = {}
@source = source
super parent, options, &block
end
- def pre(stage, *commands)
- @pre[stage] ||= []
- @pre[stage] += commands
- end
-
- def post(stage, *commands)
- @post[stage] ||= []
- @post[stage] += commands
- end
-
protected
def install_sequence
prepare + download + extract + configure + build + install
end
@@ -81,22 +70,16 @@
# REVISIT: must be better processing of custom install commands somehow? use splat operator?
def custom_install_commands
dress @options[:custom_install], :install
end
- private
+ protected
- def pre_commands(stage)
- dress @pre[stage] || [], :pre
- end
-
- def post_commands(stage)
- dress @post[stage] || [], :post
- end
-
def dress(commands, stage)
commands.collect { |command| "bash -c 'cd #{build_dir} && #{command} >> #{@package.name}-#{stage}.log 2>&1'" }
end
+
+ private
def create_options(key, prefix)
@options[key].inject(' ') { |m, option| m << "#{prefix}-#{option} "; m }
end