Sha256: ef8e213cd3f60387466a49b988dc0df96d8cabdca77cd7c4d4e4b84295364151

Contents?: true

Size: 690 Bytes

Versions: 15

Compression:

Stored size: 690 Bytes

Contents

# post process the text so that
# "!Ref IamRole" => !Ref IamRole
# We strip the surrounding quotes
class Jets::Cfn::Builder
  class PostProcess
    def initialize(text)
      @text = text
    end

    def process
      results = @text.split("\n").map do |line|
        if line.include?(': "!') # IE: IamRole: "!Ref IamRole",
           # IamRole: "!Ref IamRole" => IamRole: !Ref IamRole
          line.sub(/: "(.*)"/, ': \1')
        elsif line.include?('- "!') # IE: - "!GetAtt Foo.Arn"
           # IamRole: - "!GetAtt Foo.Arn" => - !GetAtt Foo.Arn
          line.sub(/- "(.*)"/, '- \1')
        else
          line
        end
      end
      results.join("\n") + "\n"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/cfn/builder/post_process.rb
jets-5.0.12 lib/jets/cfn/builder/post_process.rb
jets-5.0.11 lib/jets/cfn/builder/post_process.rb
jets-5.0.10 lib/jets/cfn/builder/post_process.rb
jets-5.0.9 lib/jets/cfn/builder/post_process.rb
jets-5.0.8 lib/jets/cfn/builder/post_process.rb
jets-5.0.7 lib/jets/cfn/builder/post_process.rb
jets-5.0.6 lib/jets/cfn/builder/post_process.rb
jets-5.0.5 lib/jets/cfn/builder/post_process.rb
jets-5.0.4 lib/jets/cfn/builder/post_process.rb
jets-5.0.3 lib/jets/cfn/builder/post_process.rb
jets-5.0.2 lib/jets/cfn/builder/post_process.rb
jets-5.0.1 lib/jets/cfn/builder/post_process.rb
jets-5.0.0 lib/jets/cfn/builder/post_process.rb
jets-5.0.0.beta1 lib/jets/cfn/builder/post_process.rb