git-check-ci 0.1.2 → 0.1.4
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.
- data/Gemfile.lock +1 -1
- data/lib/git-check-ci/checker.rb +9 -5
- data/lib/git-check-ci/shell.rb +3 -3
- data/lib/git-check-ci/version.rb +1 -1
- metadata +4 -4
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/git-check-ci/checker.rb
    CHANGED
    
    | @@ -18,8 +18,8 @@ module GitCheckCI | |
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 20 |  | 
| 21 | 
            -
                def check_and_save
         | 
| 22 | 
            -
                  save(check)
         | 
| 21 | 
            +
                def check_and_save(hash = nil)
         | 
| 22 | 
            +
                  save(check(hash))
         | 
| 23 23 | 
             
                end
         | 
| 24 24 |  | 
| 25 25 | 
             
                def uid
         | 
| @@ -30,7 +30,7 @@ module GitCheckCI | |
| 30 30 | 
             
                private
         | 
| 31 31 |  | 
| 32 32 |  | 
| 33 | 
            -
                def check
         | 
| 33 | 
            +
                def check( hash = nil )
         | 
| 34 34 | 
             
                  return {:code => 400} if @config.ci.url.empty? || @config.ci.project.empty?
         | 
| 35 35 |  | 
| 36 36 | 
             
                  login    = @config.ci.login
         | 
| @@ -39,11 +39,15 @@ module GitCheckCI | |
| 39 39 | 
             
                  unless login.empty? && password.empty?
         | 
| 40 40 | 
             
                    options[:basic_auth] = { :username => login.to_s, :password => password.to_s }
         | 
| 41 41 | 
             
                  end
         | 
| 42 | 
            -
                   | 
| 42 | 
            +
                  unless hash
         | 
| 43 | 
            +
                    url = "#{@config.ci.url}/#{@config.ci.project}/ping"
         | 
| 44 | 
            +
                  else
         | 
| 45 | 
            +
                    url = "#{@config.ci.url}/#{@config.ci.project}/build_by_hash/#{hash}/ping"
         | 
| 46 | 
            +
                  end
         | 
| 43 47 | 
             
                  response = HTTParty.get(url, options)
         | 
| 44 48 | 
             
                  return {:code => response.code, :body => response.to_s}
         | 
| 45 49 |  | 
| 46 | 
            -
                rescue HTTParty::UnsupportedURIScheme, SocketError
         | 
| 50 | 
            +
                rescue HTTParty::UnsupportedURIScheme, SocketError, Errno::ECONNREFUSED, Errno::ECONNRESET
         | 
| 47 51 | 
             
                  {:code => 400}
         | 
| 48 52 | 
             
                end
         | 
| 49 53 |  | 
    
        data/lib/git-check-ci/shell.rb
    CHANGED
    
    | @@ -9,9 +9,9 @@ module GitCheckCI | |
| 9 9 | 
             
              class Shell < Thor
         | 
| 10 10 | 
             
                include Thor::Actions
         | 
| 11 11 |  | 
| 12 | 
            -
                desc "check", "Fetch and print the current CI status."
         | 
| 13 | 
            -
                def check
         | 
| 14 | 
            -
                  Checker.new.check_and_save
         | 
| 12 | 
            +
                desc "check [SHA]", "Fetch and print the current CI status."
         | 
| 13 | 
            +
                def check(hash = nil)
         | 
| 14 | 
            +
                  Checker.new.check_and_save(hash)
         | 
| 15 15 | 
             
                  $stdout.puts Config.ci.response.to_s
         | 
| 16 16 | 
             
                end
         | 
| 17 17 |  | 
    
        data/lib/git-check-ci/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: git-check-ci
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 19
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 1
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.1. | 
| 9 | 
            +
              - 4
         | 
| 10 | 
            +
              version: 0.1.4
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Julien Letessier
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2012- | 
| 18 | 
            +
            date: 2012-08-31 00:00:00 +01:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         |