cfndsl 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +1 -0
- data/bin/cfndsl +5 -1
- data/lib/cfndsl/rake_task.rb +5 -3
- data/lib/cfndsl/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                Yjc5YTJlYmM0ZTQ0YTM3MmU1OWQ5Yjc4MmYwMWYyYTg5ZmE1NTdjOA==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                ZTU2YWQ0NjAzMzVkZjY4YjdjNmUwOGY3MDJhZjk5NTEwZTZmMDAzMA==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                NWQ1NmYzOTZjZWY5NGMwZGQ0NDliZDI4Y2Y0MDZmOTUyNmEzZDE2MDBmZmMy
         | 
| 10 | 
            +
                MGYwNTE3MDQ5MGJjNmZkYzY3N2VhYzA3NjcwMGM3MDJjN2FiOTcwZGFkMzk1
         | 
| 11 | 
            +
                N2ZmNGU3ZGRhY2RiNDRjOGIzNGZjZTAxNTM3ZThiMmYyMDg1YTI=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                Y2JjODdlMTIxZWMwZWE3YWFlMzBmMjgzNTBlZTUzM2E2MWU2NDliMjA3YmQ3
         | 
| 14 | 
            +
                YWI3MWRjOGVkYjgwNWFjODE4NmYxNzVlYmRhOWEyY2NkZmMxYTQ5NTc2NGI2
         | 
| 15 | 
            +
                ODRkNjRmNThkNTQwYWUwN2UzOTE2ZWFhMDc1NWRiNjJkNjUzMTU=
         | 
    
        data/README.md
    CHANGED
    
    | @@ -101,6 +101,7 @@ Usage: cfndsl [options] FILE | |
| 101 101 | 
             
                -y, --yaml FILE                  Import yaml file as local variables
         | 
| 102 102 | 
             
                -r, --ruby FILE                  Evaluate ruby file before template
         | 
| 103 103 | 
             
                -j, --json FILE                  Import json file as local variables
         | 
| 104 | 
            +
                -p, --pretty                     Pretty-format output JSON
         | 
| 104 105 | 
             
                -D, --define "VARIABLE=VALUE"    Directly set local VARIABLE as VALUE
         | 
| 105 106 | 
             
                -v, --verbose                    Turn on verbose ouptut
         | 
| 106 107 | 
             
                -h, --help                       Display this screen
         | 
    
        data/bin/cfndsl
    CHANGED
    
    | @@ -2,6 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require 'cfndsl'
         | 
| 4 4 | 
             
            require 'optparse'
         | 
| 5 | 
            +
            require 'json'
         | 
| 5 6 |  | 
| 6 7 | 
             
            options = {}
         | 
| 7 8 |  | 
| @@ -27,6 +28,9 @@ optparse = OptionParser.new do|opts| | |
| 27 28 | 
             
                options[:extras].push([:json,File.expand_path(file)])
         | 
| 28 29 | 
             
              end
         | 
| 29 30 |  | 
| 31 | 
            +
              opts.on( '-p', '--pretty', 'Pretty-format output JSON') do
         | 
| 32 | 
            +
                options[:pretty] = true
         | 
| 33 | 
            +
              end
         | 
| 30 34 |  | 
| 31 35 | 
             
              opts.on( '-D', '--define "VARIABLE=VALUE"', 'Directly set local VARIABLE as VALUE' ) do |file|
         | 
| 32 36 | 
             
                options[:extras].push([:raw,file])
         | 
| @@ -64,4 +68,4 @@ else | |
| 64 68 | 
             
              verbose.puts("Writing to STDOUT") if verbose
         | 
| 65 69 | 
             
            end
         | 
| 66 70 |  | 
| 67 | 
            -
            output.puts model.to_json
         | 
| 71 | 
            +
            output.puts options[:pretty] ? JSON.pretty_generate(model) : model.to_json
         | 
    
        data/lib/cfndsl/rake_task.rb
    CHANGED
    
    | @@ -21,7 +21,9 @@ module CfnDsl | |
| 21 21 |  | 
| 22 22 | 
             
                def generate(opts)
         | 
| 23 23 | 
             
                  log(opts)
         | 
| 24 | 
            -
                  outputter(opts) | 
| 24 | 
            +
                  outputter(opts) do |output|
         | 
| 25 | 
            +
                    output.puts model(opts[:filename])
         | 
| 26 | 
            +
                  end
         | 
| 25 27 | 
             
                end
         | 
| 26 28 |  | 
| 27 29 | 
             
                def log(opts)
         | 
| @@ -30,7 +32,7 @@ module CfnDsl | |
| 30 32 | 
             
                end
         | 
| 31 33 |  | 
| 32 34 | 
             
                def outputter(opts)
         | 
| 33 | 
            -
                  opts[:output].nil? ? STDOUT : file_output(opts[:output])
         | 
| 35 | 
            +
                  opts[:output].nil? ? yield(STDOUT) : file_output(opts[:output]) { |f| yield f }
         | 
| 34 36 | 
             
                end
         | 
| 35 37 |  | 
| 36 38 | 
             
                def model(filename)
         | 
| @@ -48,7 +50,7 @@ module CfnDsl | |
| 48 50 | 
             
                end
         | 
| 49 51 |  | 
| 50 52 | 
             
                def file_output(path)
         | 
| 51 | 
            -
                  File.open(File.expand_path(path), "w")
         | 
| 53 | 
            +
                  File.open(File.expand_path(path), "w") { |f| yield f }
         | 
| 52 54 | 
             
                end
         | 
| 53 55 | 
             
              end
         | 
| 54 56 | 
             
            end
         | 
    
        data/lib/cfndsl/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cfndsl
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.4.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Steven Jack
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2016-02- | 
| 12 | 
            +
            date: 2016-02-11 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: bundler
         |