diffend 0.2.15 → 0.2.16
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
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -0
 - data/Gemfile.lock +1 -1
 - data/lib/diffend.rb +1 -1
 - data/lib/diffend/voting/request.rb +33 -13
 - metadata +2 -2
 - metadata.gz.sig +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d23a558405ac69141d76368e9a642d153300c2a9bb01fd67b9c8f3c949a9225b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5d74b929a8debf7c7a32aa0cb8d01e9f51c373b0859468a3936e40a1bccc1004
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8fe13be65aad9dda4c8a4cf3341851d691f253e4dc2d3d4a31e1da2bba92bffb2902e69ea08f78a5d3a9c6a5fb3f233abf72dd569d732df317aa5f0d8748830b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 86929a3b0259f8de839edfdd2901c203ed0e69d35a733d31860d6628c71a5874097efd3a08fb4203e4fa4768f110d5d36ec192f064b144b1a99c8c208111be0f
         
     | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data.tar.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/diffend.rb
    CHANGED
    
    
| 
         @@ -36,7 +36,8 @@ module Diffend 
     | 
|
| 
       36 
36 
     | 
    
         
             
                    # @return [Net::HTTPResponse] response from Diffend
         
     | 
| 
       37 
37 
     | 
    
         
             
                    def call(command, payload, config)
         
     | 
| 
       38 
38 
     | 
    
         
             
                      retry_count ||= 0
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                      build_http(commands_url(command, config.project_id)) do |http, uri|
         
     | 
| 
       40 
41 
     | 
    
         
             
                        http.request(build_request(uri, config, payload))
         
     | 
| 
       41 
42 
     | 
    
         
             
                      end
         
     | 
| 
       42 
43 
     | 
    
         
             
                    rescue *CONNECTION_EXCEPTIONS => e
         
     | 
| 
         @@ -46,7 +47,7 @@ module Diffend 
     | 
|
| 
       46 
47 
     | 
    
         | 
| 
       47 
48 
     | 
    
         
             
                      retry if retry_count < 3
         
     | 
| 
       48 
49 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                       
     | 
| 
      
 50 
     | 
    
         
            +
                      output_report(build_report(payload, e))
         
     | 
| 
       50 
51 
     | 
    
         
             
                      Bundler.ui.error('^^^ Above is the dump of your request ^^^')
         
     | 
| 
       51 
52 
     | 
    
         
             
                      Bundler.ui.error(build_request_error_message)
         
     | 
| 
       52 
53 
     | 
    
         | 
| 
         @@ -58,25 +59,29 @@ module Diffend 
     | 
|
| 
       58 
59 
     | 
    
         | 
| 
       59 
60 
     | 
    
         
             
                      retry if retry_count < 3
         
     | 
| 
       60 
61 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                       
     | 
| 
      
 62 
     | 
    
         
            +
                      output_report(build_report(payload, e))
         
     | 
| 
       62 
63 
     | 
    
         
             
                      Bundler.ui.error('^^^ Above is the dump of your request ^^^')
         
     | 
| 
       63 
64 
     | 
    
         
             
                      Bundler.ui.error(build_request_error_message)
         
     | 
| 
       64 
65 
     | 
    
         | 
| 
       65 
66 
     | 
    
         
             
                      exit 1
         
     | 
| 
       66 
67 
     | 
    
         
             
                    rescue StandardError => e
         
     | 
| 
       67 
     | 
    
         
            -
                       
     | 
| 
      
 68 
     | 
    
         
            +
                      exception_payload = build_report(payload, e)
         
     | 
| 
      
 69 
     | 
    
         
            +
                      output_report(exception_payload)
         
     | 
| 
       68 
70 
     | 
    
         
             
                      Bundler.ui.error('^^^ Above is the dump of your request ^^^')
         
     | 
| 
       69 
71 
     | 
    
         
             
                      Bundler.ui.error(build_unhandled_exception_message)
         
     | 
| 
       70 
72 
     | 
    
         | 
| 
      
 73 
     | 
    
         
            +
                      build_http(errors_url(config.project_id)) do |http, uri|
         
     | 
| 
      
 74 
     | 
    
         
            +
                        http.request(build_request(uri, config, exception_payload))
         
     | 
| 
      
 75 
     | 
    
         
            +
                      end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       71 
77 
     | 
    
         
             
                      exit 1
         
     | 
| 
       72 
78 
     | 
    
         
             
                    end
         
     | 
| 
       73 
79 
     | 
    
         | 
| 
       74 
80 
     | 
    
         
             
                    # Builds http connection object
         
     | 
| 
       75 
81 
     | 
    
         
             
                    #
         
     | 
| 
       76 
     | 
    
         
            -
                    # @param  
     | 
| 
       77 
     | 
    
         
            -
                     
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
                      uri = URI(endpoint_url(command, project_id))
         
     | 
| 
      
 82 
     | 
    
         
            +
                    # @param url [String] command endpoint url
         
     | 
| 
      
 83 
     | 
    
         
            +
                    def build_http(url)
         
     | 
| 
      
 84 
     | 
    
         
            +
                      uri = URI(url)
         
     | 
| 
       80 
85 
     | 
    
         | 
| 
       81 
86 
     | 
    
         
             
                      Net::HTTP.start(
         
     | 
| 
       82 
87 
     | 
    
         
             
                        uri.host,
         
     | 
| 
         @@ -122,18 +127,29 @@ module Diffend 
     | 
|
| 
       122 
127 
     | 
    
         
             
                      request.body = JSON.dump(payload: payload)
         
     | 
| 
       123 
128 
     | 
    
         
             
                    end
         
     | 
| 
       124 
129 
     | 
    
         | 
| 
       125 
     | 
    
         
            -
                    # Provides diffend endpoint url
         
     | 
| 
      
 130 
     | 
    
         
            +
                    # Provides diffend command endpoint url
         
     | 
| 
       126 
131 
     | 
    
         
             
                    #
         
     | 
| 
       127 
132 
     | 
    
         
             
                    # @param command [String] either install or update
         
     | 
| 
       128 
133 
     | 
    
         
             
                    # @param project_id [String] diffend project_id
         
     | 
| 
       129 
134 
     | 
    
         
             
                    #
         
     | 
| 
       130 
135 
     | 
    
         
             
                    # @return [String] diffend endpoint
         
     | 
| 
       131 
     | 
    
         
            -
                    def  
     | 
| 
       132 
     | 
    
         
            -
                      return ENV[' 
     | 
| 
      
 136 
     | 
    
         
            +
                    def commands_url(command, project_id)
         
     | 
| 
      
 137 
     | 
    
         
            +
                      return ENV['DIFFEND_COMMAND_URL'] if ENV.key?('DIFFEND_COMMAND_URL')
         
     | 
| 
       133 
138 
     | 
    
         | 
| 
       134 
139 
     | 
    
         
             
                      "https://my.diffend.io/api/projects/#{project_id}/bundle/#{command}"
         
     | 
| 
       135 
140 
     | 
    
         
             
                    end
         
     | 
| 
       136 
141 
     | 
    
         | 
| 
      
 142 
     | 
    
         
            +
                    # Provides diffend errors endpoint url
         
     | 
| 
      
 143 
     | 
    
         
            +
                    #
         
     | 
| 
      
 144 
     | 
    
         
            +
                    # @param project_id [String] diffend project_id
         
     | 
| 
      
 145 
     | 
    
         
            +
                    #
         
     | 
| 
      
 146 
     | 
    
         
            +
                    # @return [String] diffend endpoint
         
     | 
| 
      
 147 
     | 
    
         
            +
                    def errors_url(project_id)
         
     | 
| 
      
 148 
     | 
    
         
            +
                      return ENV['DIFFEND_ERROR_URL'] if ENV.key?('DIFFEND_ERROR_URL')
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                      "https://my.diffend.io/api/projects/#{project_id}/errors"
         
     | 
| 
      
 151 
     | 
    
         
            +
                    end
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
       137 
153 
     | 
    
         
             
                    def exponential_backoff(retry_count)
         
     | 
| 
       138 
154 
     | 
    
         
             
                      2**(retry_count + 1)
         
     | 
| 
       139 
155 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -154,7 +170,7 @@ module Diffend 
     | 
|
| 
       154 
170 
     | 
    
         
             
                      MSG
         
     | 
| 
       155 
171 
     | 
    
         
             
                    end
         
     | 
| 
       156 
172 
     | 
    
         | 
| 
       157 
     | 
    
         
            -
                    def  
     | 
| 
      
 173 
     | 
    
         
            +
                    def build_report(payload, exception)
         
     | 
| 
       158 
174 
     | 
    
         
             
                      {
         
     | 
| 
       159 
175 
     | 
    
         
             
                        request_id: SecureRandom.uuid,
         
     | 
| 
       160 
176 
     | 
    
         
             
                        payload: payload,
         
     | 
| 
         @@ -163,7 +179,11 @@ module Diffend 
     | 
|
| 
       163 
179 
     | 
    
         
             
                          message: exception.message,
         
     | 
| 
       164 
180 
     | 
    
         
             
                          backtrace: exception.backtrace
         
     | 
| 
       165 
181 
     | 
    
         
             
                        }
         
     | 
| 
       166 
     | 
    
         
            -
                      } 
     | 
| 
      
 182 
     | 
    
         
            +
                      }
         
     | 
| 
      
 183 
     | 
    
         
            +
                    end
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
                    def output_report(report)
         
     | 
| 
      
 186 
     | 
    
         
            +
                      puts report.to_json
         
     | 
| 
       167 
187 
     | 
    
         
             
                    end
         
     | 
| 
       168 
188 
     | 
    
         
             
                  end
         
     | 
| 
       169 
189 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: diffend
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.16
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Tomasz Pajor
         
     | 
| 
         @@ -34,7 +34,7 @@ cert_chain: 
     | 
|
| 
       34 
34 
     | 
    
         
             
              9MmF6uCQa1EjK2p8tYT0MnbHrFkoehxdX4VO9y99GAkhZyJNKPYPtyAUFV27sT2V
         
     | 
| 
       35 
35 
     | 
    
         
             
              LfCJRk4ifKIN/FUCwDSn8Cz0m6oH265q0p6wdzI6qrWOjP8tGOMBTA==
         
     | 
| 
       36 
36 
     | 
    
         
             
              -----END CERTIFICATE-----
         
     | 
| 
       37 
     | 
    
         
            -
            date: 2020-07- 
     | 
| 
      
 37 
     | 
    
         
            +
            date: 2020-07-28 00:00:00.000000000 Z
         
     | 
| 
       38 
38 
     | 
    
         
             
            dependencies:
         
     | 
| 
       39 
39 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       40 
40 
     | 
    
         
             
              name: bundler
         
     | 
    
        metadata.gz.sig
    CHANGED
    
    | 
         Binary file 
     |