aws_public_ips 1.0.4 → 1.0.5
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2130ff4b9f59ac6e30c1217be05ae4f3c4f73d17
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 24669a0a29799a74acb37e501c467a59865081a3
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e4656877db332ff9b05c6b2eda71cb3266280c063dd64528e1da74d4cc18e3618a57feb057b64da9f5cf60dd6deba4edce78db0d3894e215b6ee0f34e8fe322a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4505daa9cd54e8ca666b9725e25cdd70954155b381de47a4f9cab35393156fc34971371d0430ed6ed5d9b61c6352b54294f957067dbbc5a268841197b433d131
         
     | 
    
        data/lib/aws_public_ips/cli.rb
    CHANGED
    
    | 
         @@ -96,10 +96,10 @@ module AwsPublicIps 
     | 
|
| 
       96 
96 
     | 
    
         
             
                  ::AwsPublicIps::Checks.const_get(service.capitalize).run
         
     | 
| 
       97 
97 
     | 
    
         
             
                end
         
     | 
| 
       98 
98 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
                def output(formatter, results)
         
     | 
| 
      
 99 
     | 
    
         
            +
                def output(formatter, options, results)
         
     | 
| 
       100 
100 
     | 
    
         
             
                  require "aws_public_ips/formatters/#{formatter}.rb"
         
     | 
| 
       101 
101 
     | 
    
         
             
                  formatter_klass = ::AwsPublicIps::Formatters.const_get(formatter.capitalize)
         
     | 
| 
       102 
     | 
    
         
            -
                  output = formatter_klass.new(results).format
         
     | 
| 
      
 102 
     | 
    
         
            +
                  output = formatter_klass.new(results, options).format
         
     | 
| 
       103 
103 
     | 
    
         
             
                  ::STDOUT.puts output unless output.empty?
         
     | 
| 
       104 
104 
     | 
    
         
             
                end
         
     | 
| 
       105 
105 
     | 
    
         | 
| 
         @@ -111,7 +111,7 @@ module AwsPublicIps 
     | 
|
| 
       111 
111 
     | 
    
         
             
                    [service.to_sym, check_service(service)]
         
     | 
| 
       112 
112 
     | 
    
         
             
                  end.to_h
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
       114 
     | 
    
         
            -
                  output(options[:format], results)
         
     | 
| 
      
 114 
     | 
    
         
            +
                  output(options[:format], options, results)
         
     | 
| 
       115 
115 
     | 
    
         
             
                rescue ::StandardError, ::Interrupt => ex
         
     | 
| 
       116 
116 
     | 
    
         
             
                  ::STDERR.puts ex.inspect
         
     | 
| 
       117 
117 
     | 
    
         
             
                  ::STDERR.puts ex.backtrace if options && options[:verbose]
         
     | 
| 
         @@ -3,14 +3,31 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module AwsPublicIps
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Formatters
         
     | 
| 
       5 
5 
     | 
    
         
             
                class Text
         
     | 
| 
       6 
     | 
    
         
            -
                  def initialize(results)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize(results, options)
         
     | 
| 
       7 
7 
     | 
    
         
             
                    @results = results
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @options = options
         
     | 
| 
       8 
9 
     | 
    
         
             
                  end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
                  def format
         
     | 
| 
      
 12 
     | 
    
         
            +
                    lines = @options[:verbose] ? format_verbose : format_normal
         
     | 
| 
      
 13 
     | 
    
         
            +
                    lines.uniq.join("\n")
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  def format_normal
         
     | 
| 
       11 
17 
     | 
    
         
             
                    @results.values.flatten.flat_map do |hash|
         
     | 
| 
       12 
18 
     | 
    
         
             
                      hash[:ip_addresses]
         
     | 
| 
       13 
     | 
    
         
            -
                    end 
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def format_verbose
         
     | 
| 
      
 23 
     | 
    
         
            +
                    @results.flat_map do |service, hashes|
         
     | 
| 
      
 24 
     | 
    
         
            +
                      next [] if hashes.empty?
         
     | 
| 
      
 25 
     | 
    
         
            +
                      ["## #{service}"] + hashes.flat_map do |hash|
         
     | 
| 
      
 26 
     | 
    
         
            +
                        [hash[:id], hash[:hostname]].compact.map do |line|
         
     | 
| 
      
 27 
     | 
    
         
            +
                          "# #{line}"
         
     | 
| 
      
 28 
     | 
    
         
            +
                        end + hash[:ip_addresses]
         
     | 
| 
      
 29 
     | 
    
         
            +
                      end
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
       14 
31 
     | 
    
         
             
                  end
         
     | 
| 
       15 
32 
     | 
    
         
             
                end
         
     | 
| 
       16 
33 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: aws_public_ips
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Arkadiy Tetelman
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2018-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2018-05-26 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: aws-sdk-apigateway
         
     |