concourse-fuselage 0.4.1 → 0.5.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/concourse-fuselage.gemspec +1 -1
 - data/lib/concourse-fuselage/step.rb +2 -0
 - data/lib/concourse-fuselage/support/validation.rb +33 -0
 - metadata +2 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0805880c68aa9ebaaa89bf993e07f77f467733c7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7c8fc4b3911f8a37bdda6cfb452a77767a475c80
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a19256f28c3ed4428469ca57708818d9cc387498e4f37ab10223d52be10f2a405a924b737d7b3aeeead3f27790045369b9abd786d05e64280ce8409d79e39c3b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1ab5d172dfca9f0af012c46c038bec8cfb55788487725b3974c48970fc31ef4ce1e0a1214e8b74752d520517c527c9d911a310f54a01c484a769caf42f917e18
         
     | 
    
        data/concourse-fuselage.gemspec
    CHANGED
    
    
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'contracts'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require_relative 'support/source'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require_relative 'support/debugging'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative 'support/validation'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            module Fuselage
         
     | 
| 
       6 
7 
     | 
    
         
             
              class Step
         
     | 
| 
         @@ -8,5 +9,6 @@ module Fuselage 
     | 
|
| 
       8 
9 
     | 
    
         
             
                include ::Contracts::Builtin
         
     | 
| 
       9 
10 
     | 
    
         
             
                include Support::Source
         
     | 
| 
       10 
11 
     | 
    
         
             
                include Support::Debugging
         
     | 
| 
      
 12 
     | 
    
         
            +
                include Support::Validation
         
     | 
| 
       11 
13 
     | 
    
         
             
              end
         
     | 
| 
       12 
14 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'contracts'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Fuselage
         
     | 
| 
      
 5 
     | 
    
         
            +
              module Support
         
     | 
| 
      
 6 
     | 
    
         
            +
                # Payload validation for Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
                module Validation
         
     | 
| 
      
 8 
     | 
    
         
            +
                  include ::Contracts::Core
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include ::Contracts::Builtin
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  Contract None => String
         
     | 
| 
      
 12 
     | 
    
         
            +
                  def validated(payload)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    return payload unless malformed? payload
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    STDERR.puts 'Resource failed to produce valid JSON', payload
         
     | 
| 
      
 16 
     | 
    
         
            +
                    abort
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  Contract None => Bool
         
     | 
| 
      
 20 
     | 
    
         
            +
                  def valid?(payload)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    JSON.parse payload
         
     | 
| 
      
 22 
     | 
    
         
            +
                    true
         
     | 
| 
      
 23 
     | 
    
         
            +
                  rescue JSON::ParseError
         
     | 
| 
      
 24 
     | 
    
         
            +
                    false
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  Contract None => Bool
         
     | 
| 
      
 28 
     | 
    
         
            +
                  def malformed?(payload)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    !valid? payload
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: concourse-fuselage
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Chris Olstrom
         
     | 
| 
         @@ -53,6 +53,7 @@ files: 
     | 
|
| 
       53 
53 
     | 
    
         
             
            - lib/concourse-fuselage/support/debugging.rb
         
     | 
| 
       54 
54 
     | 
    
         
             
            - lib/concourse-fuselage/support/params.rb
         
     | 
| 
       55 
55 
     | 
    
         
             
            - lib/concourse-fuselage/support/source.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/concourse-fuselage/support/validation.rb
         
     | 
| 
       56 
57 
     | 
    
         
             
            - lib/concourse-fuselage/support/work_dir.rb
         
     | 
| 
       57 
58 
     | 
    
         
             
            homepage: 
         
     | 
| 
       58 
59 
     | 
    
         
             
            licenses:
         
     |