Sha256: e9b3951ac9193f2b852f297f231806b165c222668542fb6adfb342df43237222

Contents?: true

Size: 932 Bytes

Versions: 4

Compression:

Stored size: 932 Bytes

Contents

#!/usr/bin/env ruby
require_relative '../lib/cfnlego'
require 'optparse'
options = {resources: []}
OptionParser.new do |opts|
  opts.banner = "Usage: cfnlego --reousrce resource [options]"

  opts.on("-r", "--resource=RESOURCE_TYPE,RESOURCE_LOGICAL_NAME", "Add resource type and logical name") do |r|
    options[:resources] << r
  end

  opts.on("-h", "--help", "Prints this help") do
    puts opts
    puts <<-EXAMPLE
Example:
  cfnlego                                           \\
    --reousrce AutoScaling::AutoScalingGroup,ASG    \\
    --reousrce IAM::Role,Role                       \\
    --reousrce IAM::InstanceProfile,InstanceProfile \\
EXAMPLE

    exit
  end
end.parse!

# Constructure Resources
resources = []
options[:resources].each do |r|
  /(.*),(.*)/.match(r) do |m|
    type = m[1]
    name = m[2]
    resources << Cfnlego::Resource.new(type, name)
  end
end

puts Cfnlego::CloudFormation.new(resources).render

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cfnlego-0.0.4 bin/cfnlego
cfnlego-0.0.3 bin/cfnlego
cfnlego-0.0.2 bin/cfnlego
cfnlego-0.0.1 bin/cfnlego