aws-cfn-compiler 0.0.8 → 0.1.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 +4 -4
 - data/lib/aws/cfn/compiler/version.rb +1 -1
 - data/lib/aws/cfn/compiler.rb +21 -8
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 592aa0b88be9d7d1ad4cf61f894ea8b4cdbe66a1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a13ea148dd882a2cf11352cd0ceabc4d309afe6e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 1a707d5598d57e097bba7ed293058f459e3e3108255a0da1a542bde2446cf4ba4cd5c5e8dccbf27740a074e57885c814fb30625ce77ebaa3344a10c37c188098
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0e9fe3a2e7a54d848c57dc9029a7abe569865755beb299db9e4e16f99dae0f93ec224ad5323ae068cee9c3b6a5d5334299184a1a7f0cf0c67c981ae89a532da2
         
     | 
    
        data/lib/aws/cfn/compiler.rb
    CHANGED
    
    | 
         @@ -51,16 +51,16 @@ module Aws 
     | 
|
| 
       51 
51 
     | 
    
         
             
                          Outputs:                  @items['outputs'],
         
     | 
| 
       52 
52 
     | 
    
         
             
                      }
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                      output_file = @opts[:output] || 'compiled.json'
         
     | 
| 
       55 
     | 
    
         
            -
                      puts
         
     | 
| 
       56 
     | 
    
         
            -
                      puts "Writing compiled file to #{output_file}..."
         
     | 
| 
       57 
     | 
    
         
            -
                      save(compiled, output_file)
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
54 
     | 
    
         
             
                      puts
         
     | 
| 
       60 
55 
     | 
    
         
             
                      puts 'Validating compiled file...'
         
     | 
| 
       61 
56 
     | 
    
         | 
| 
       62 
57 
     | 
    
         
             
                      validate(compiled)
         
     | 
| 
       63 
58 
     | 
    
         | 
| 
      
 59 
     | 
    
         
            +
                      output_file = @opts[:output] || 'compiled.json'
         
     | 
| 
      
 60 
     | 
    
         
            +
                      puts
         
     | 
| 
      
 61 
     | 
    
         
            +
                      puts "Writing compiled file to #{output_file}..."
         
     | 
| 
      
 62 
     | 
    
         
            +
                      save(compiled, output_file)
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
       64 
64 
     | 
    
         
             
                      puts
         
     | 
| 
       65 
65 
     | 
    
         
             
                      puts '*** Compiled Successfully ***'
         
     | 
| 
       66 
66 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -122,7 +122,7 @@ module Aws 
     | 
|
| 
       122 
122 
     | 
    
         
             
                          raise "Unable to open specification: #{abs}"
         
     | 
| 
       123 
123 
     | 
    
         
             
                        end
         
     | 
| 
       124 
124 
     | 
    
         
             
                      end
         
     | 
| 
       125 
     | 
    
         
            -
                      %w{ 
     | 
| 
      
 125 
     | 
    
         
            +
                      %w{Params Mappings Resources Outputs}.each do |dir|
         
     | 
| 
       126 
126 
     | 
    
         
             
                        load_dir(dir,spec)
         
     | 
| 
       127 
127 
     | 
    
         
             
                      end
         
     | 
| 
       128 
128 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -153,9 +153,18 @@ module Aws 
     | 
|
| 
       153 
153 
     | 
    
         | 
| 
       154 
154 
     | 
    
         
             
                    def load_dir(dir,spec=nil)
         
     | 
| 
       155 
155 
     | 
    
         
             
                      puts "Loading #{dir}..."
         
     | 
| 
       156 
     | 
    
         
            -
                      @items[dir] = {}
         
     | 
| 
       157 
156 
     | 
    
         
             
                      raise "No such directory: #{@opts[:directory]}" unless File.directory?(@opts[:directory])
         
     | 
| 
       158 
     | 
    
         
            -
                       
     | 
| 
      
 157 
     | 
    
         
            +
                      set = []
         
     | 
| 
      
 158 
     | 
    
         
            +
                      if File.directory?(File.join(@opts[:directory], dir))
         
     | 
| 
      
 159 
     | 
    
         
            +
                        @items[dir] = {}
         
     | 
| 
      
 160 
     | 
    
         
            +
                        set = get_file_set(dir)
         
     | 
| 
      
 161 
     | 
    
         
            +
                      else
         
     | 
| 
      
 162 
     | 
    
         
            +
                        if File.directory?(File.join(@opts[:directory], dir.downcase))
         
     | 
| 
      
 163 
     | 
    
         
            +
                          @items[dir] = {}
         
     | 
| 
      
 164 
     | 
    
         
            +
                          set = get_file_set(dir.downcase)
         
     | 
| 
      
 165 
     | 
    
         
            +
                        end
         
     | 
| 
      
 166 
     | 
    
         
            +
                      end
         
     | 
| 
      
 167 
     | 
    
         
            +
                      set.collect do |filename|
         
     | 
| 
       159 
168 
     | 
    
         
             
                        next unless filename =~ /\.(json|ya?ml)\z/i
         
     | 
| 
       160 
169 
     | 
    
         
             
                        if spec and spec[dir]
         
     | 
| 
       161 
170 
     | 
    
         
             
                          base = File.basename(filename).gsub(%r/\.(rb|yaml)/, '')
         
     | 
| 
         @@ -183,6 +192,10 @@ module Aws 
     | 
|
| 
       183 
192 
     | 
    
         
             
                      end
         
     | 
| 
       184 
193 
     | 
    
         
             
                    end
         
     | 
| 
       185 
194 
     | 
    
         | 
| 
      
 195 
     | 
    
         
            +
                    def get_file_set(dir)
         
     | 
| 
      
 196 
     | 
    
         
            +
                      Dir[File.join(@opts[:directory], "#{dir}.*")] | Dir[File.join(@opts[:directory], dir, "**", "*")]
         
     | 
| 
      
 197 
     | 
    
         
            +
                    end
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
       186 
199 
     | 
    
         
             
                  end
         
     | 
| 
       187 
200 
     | 
    
         
             
                end
         
     | 
| 
       188 
201 
     | 
    
         
             
              end
         
     |