Sha256: 932819184939942b21bd97342505feffe3bc1bc6e9d5567f86240d48e4917cf0
Contents?: true
Size: 675 Bytes
Versions: 4
Compression:
Stored size: 675 Bytes
Contents
require 'yaml' module AwsEc2 class Hook def initialize(options={}) @options = options end def run(name) return if @options[:noop] return unless hooks[name] command = hooks[name] puts "Running hook #{name}: #{command}" sh(command) end def hooks hooks_path = "#{AwsEc2.root}/config/hooks.yml" data = File.exist?(hooks_path) ? YAML.load_file(hooks_path) : {} data ? data : {} # in case the file is empty end def sh(command) puts "=> #{command}".colorize(:cyan) system(command) end def self.run(name, options={}) Hook.new(options).run(name.to_s) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
aws-ec2-0.5.2 | lib/aws_ec2/hook.rb |
aws-ec2-0.5.1 | lib/aws_ec2/hook.rb |
aws-ec2-0.5.0 | lib/aws_ec2/hook.rb |
aws-ec2-0.4.0 | lib/aws_ec2/hook.rb |