Sha256: efdf85d63509974958e4d34848e01126c454f89fb08060f5773a1f6031dd6a04
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
require 'kumogata' require 'tempfile' require 'uuidtools' class UUIDTools::UUID def self.timestamp_create; 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'; end end def tempfile(content, template_ext) basename = "#{File.basename __FILE__}.#{$$}" basename = [basename, template_ext] Tempfile.open(basename) do |f| f << content f.flush f.rewind yield(f) end end def run_client(command, options = {}) $stdout = open('/dev/null', 'w') kumogata_template = options[:template] kumogata_arguments = options[:arguments] || [] kumogata_options = Kumogata::ArgumentParser::DEFAULT_OPTIONS.merge(options[:options] || {}) template_ext = options[:template_ext] || '.rb' client = Kumogata::Client.new(kumogata_options) cloud_formation = client.instance_variable_get(:@cloud_formation) yield(client, cloud_formation) if block_given? if kumogata_template tempfile(kumogata_template, template_ext) do |f| kumogata_arguments.unshift(f.path) client.send(command, *kumogata_arguments) end else client.send(command, *kumogata_arguments) end end def eval_template(template, options = {}) kumogata_options = Kumogata::ArgumentParser::DEFAULT_OPTIONS.merge(options[:options] || {}) template_ext = options[:template_ext] || '.rb' template = tempfile(template, template_ext) do |f| Kumogata::Client.new(kumogata_options).send(:evaluate_template, f) end if options[:update_deletion_policy] update_deletion_policy(template) end return template end def update_deletion_policy(template) template['Resources'].each do |k, v| v['DeletionPolicy'] = 'Retain' end end def make_double(name) obj = double(name) yield(obj) return obj end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kumogata-0.1.1 | spec/spec_helper.rb |
kumogata-0.1.0 | spec/spec_helper.rb |