lib/autobuild/config.rb in autobuild-0.6.6 vs lib/autobuild/config.rb in autobuild-0.6.7
- old
+ new
@@ -44,9 +44,34 @@
@programs = Hash.new
DEFAULT_OPTIONS.each do |name, value|
send("#{name}=", value)
end
+ def self.post_install(*args, &block)
+ if args.empty?
+ @post_install_handler = block
+ elsif !block
+ @post_install_handler = args
+ else
+ raise ArgumentError, "cannot set both arguments and block"
+ end
+ end
+ attr_reader :post_install_handler
+
+ def self.apply_post_install(info)
+ return unless info
+
+ case info
+ when Array
+ args = info.dup
+ tool = Autobuild.tool(args.shift)
+
+ Autobuild::Subprocess.run name, 'post-install', tool, *args
+ when Proc
+ info.call
+ end
+ end
+
@mail = Hash.new
class << self
# Mailing configuration. It is a hash with the following keys (as symbols)
# [:to] the mail destination. Defaults to USER@HOSTNAME, where USER is the username
# of autobuild's caller, and HOSTNAME the hostname of the current machine.