github_status_notifier 0.0.1
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 +7 -0
 - data/.gitignore +9 -0
 - data/.rubocop.yml +17 -0
 - data/.tachikoma.yml +1 -0
 - data/.travis.yml +15 -0
 - data/CODE_OF_CONDUCT.md +13 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +91 -0
 - data/Rakefile +10 -0
 - data/bin/console +14 -0
 - data/bin/setup +7 -0
 - data/exe/github-status-notifier +5 -0
 - data/github_status_notifier.gemspec +28 -0
 - data/lib/github_status_notifier/cli.rb +59 -0
 - data/lib/github_status_notifier/client.rb +14 -0
 - data/lib/github_status_notifier/notifier.rb +46 -0
 - data/lib/github_status_notifier/repository.rb +4 -0
 - data/lib/github_status_notifier/version.rb +3 -0
 - data/lib/github_status_notifier.rb +24 -0
 - metadata +135 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c3488a57eac600148a552af144350b9a4e08fe37
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a68580a46abef7cf495e8ed015d8b969613642ec
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f1b193113fe518e8177b9f1b84c103e6a5e581a696106822ac8cc95735391350c5470d1d6e98c7b3852c4053c7fed9b030b25f58039782a88555e6e5fd9230f9
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 844aef7d5d6da3768bfad5c3acf9e364e5550a65ddaa0adcd4ef7888d8f52aac33b28e546eaa6d141413d2f800dc3959e2015ae0604a74c7ad8964ecb5786777
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rubocop.yml
    ADDED
    
    
    
        data/.tachikoma.yml
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            strategy: 'none'
         
     | 
    
        data/.travis.yml
    ADDED
    
    
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributor Code of Conduct
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 sanemat
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,91 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # GithubStatusNotifier
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](http://badge.fury.io/rb/github_status_notifier)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](https://travis-ci.org/packsaddle/ruby-github_status_notifier)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ```
         
     | 
| 
      
 9 
     | 
    
         
            +
            # before your command
         
     | 
| 
      
 10 
     | 
    
         
            +
            $ github-status-notifier notify --state pending
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            $ SOME_YOUR_COMMAND
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            # after your command
         
     | 
| 
      
 15 
     | 
    
         
            +
            $ github-status-notifier notify --exit-status $?
         
     | 
| 
      
 16 
     | 
    
         
            +
            ```
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ## Commands
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ```
         
     | 
| 
      
 21 
     | 
    
         
            +
            Commands:
         
     | 
| 
      
 22 
     | 
    
         
            +
              github-status-notifier help [COMMAND]  # Describe available commands or one specific command
         
     | 
| 
      
 23 
     | 
    
         
            +
              github-status-notifier notify          # Notify current status to GitHub status
         
     | 
| 
      
 24 
     | 
    
         
            +
              github-status-notifier version         # Show the GithubStatusNotifier version
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            Usage:
         
     | 
| 
      
 27 
     | 
    
         
            +
              github-status-notifier notify
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            Options:
         
     | 
| 
      
 30 
     | 
    
         
            +
              [--exit-status=N]
         
     | 
| 
      
 31 
     | 
    
         
            +
              [--keep-exit-status], [--no-keep-exit-status]
         
     | 
| 
      
 32 
     | 
    
         
            +
              [--debug], [--no-debug]
         
     | 
| 
      
 33 
     | 
    
         
            +
              [--verbose], [--no-verbose]
         
     | 
| 
      
 34 
     | 
    
         
            +
              [--state=STATE]
         
     | 
| 
      
 35 
     | 
    
         
            +
              [--target-url=TARGET_URL]
         
     | 
| 
      
 36 
     | 
    
         
            +
              [--description=DESCRIPTION]
         
     | 
| 
      
 37 
     | 
    
         
            +
              [--context=CONTEXT]
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            Notify current status to GitHub status
         
     | 
| 
      
 40 
     | 
    
         
            +
            ```
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            see also: [Statuses | GitHub API](https://developer.github.com/v3/repos/statuses/)
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            ## VS.
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            ### [github-commit-status-updater](https://github.com/joker1007/github-commit-status-updater)
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            ```
         
     | 
| 
      
 49 
     | 
    
         
            +
            Commands:
         
     | 
| 
      
 50 
     | 
    
         
            +
              github-commit-status-updater error -r, --repo=REPO -s, --sha1=SHA1    # commit status error
         
     | 
| 
      
 51 
     | 
    
         
            +
              github-commit-status-updater failure -r, --repo=REPO -s, --sha1=SHA1  # commit status failure
         
     | 
| 
      
 52 
     | 
    
         
            +
              github-commit-status-updater help [COMMAND]                           # Describe available commands or one specific command
         
     | 
| 
      
 53 
     | 
    
         
            +
              github-commit-status-updater pending -r, --repo=REPO -s, --sha1=SHA1  # commit status pending
         
     | 
| 
      
 54 
     | 
    
         
            +
              github-commit-status-updater success -r, --repo=REPO -s, --sha1=SHA1  # commit status success
         
     | 
| 
      
 55 
     | 
    
         
            +
            ```
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            `github-commit-status-updater` is very simple, but I want to detect `repo` and `sha1` automatically.
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 64 
     | 
    
         
            +
            gem 'github_status_notifier'
         
     | 
| 
      
 65 
     | 
    
         
            +
            ```
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                $ gem install github_status_notifier
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            ## Setting
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            require `GITHUB_ACCESS_TOKEN`
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec github_status_notifier` to use the code located in this directory, ignoring other installed copies of this gem.
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            1. Fork it ( https://github.com/packsaddle/ruby-github_status_notifier/fork )
         
     | 
| 
      
 88 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 89 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 90 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 91 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'github_status_notifier'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require 'irb'
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'github_status_notifier/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = 'github_status_notifier'
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = GithubStatusNotifier::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ['sanemat']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ['o.gata.ken@gmail.com']
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = 'Notify to GitHub status.'
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.description   = 'Easy to handle GitHub status with exit status. Like TravisCI\'s build status.'
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.homepage      = 'https://github.com/packsaddle/ruby-github_status_notifier'
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.license       = 'MIT'
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.bindir        = 'exe'
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_runtime_dependency 'thor'
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_runtime_dependency 'saddler-reporter-github'
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 1.8'
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '~> 10.0'
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_development_dependency 'test-unit'
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'thor'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module GithubStatusNotifier
         
     | 
| 
      
 4 
     | 
    
         
            +
              class CLI < Thor
         
     | 
| 
      
 5 
     | 
    
         
            +
                def self.exit_on_failure?
         
     | 
| 
      
 6 
     | 
    
         
            +
                  true
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                desc 'version', 'Show the GithubStatusNotifier version'
         
     | 
| 
      
 10 
     | 
    
         
            +
                map %w(-v --version) => :version
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def version
         
     | 
| 
      
 13 
     | 
    
         
            +
                  puts "GithubStatusNotifier version #{::GithubStatusNotifier::VERSION}"
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                desc 'notify', 'Notify current status to GitHub status'
         
     | 
| 
      
 17 
     | 
    
         
            +
                option :exit_status, type: :numeric
         
     | 
| 
      
 18 
     | 
    
         
            +
                option :keep_exit_status, type: :boolean, default: false
         
     | 
| 
      
 19 
     | 
    
         
            +
                option :debug, type: :boolean, default: false
         
     | 
| 
      
 20 
     | 
    
         
            +
                option :verbose, type: :boolean, default: false
         
     | 
| 
      
 21 
     | 
    
         
            +
                option :state, type: :string
         
     | 
| 
      
 22 
     | 
    
         
            +
                option :target_url, type: :string
         
     | 
| 
      
 23 
     | 
    
         
            +
                option :description, type: :string
         
     | 
| 
      
 24 
     | 
    
         
            +
                option :context, type: :string
         
     | 
| 
      
 25 
     | 
    
         
            +
                def notify
         
     | 
| 
      
 26 
     | 
    
         
            +
                  if options[:debug]
         
     | 
| 
      
 27 
     | 
    
         
            +
                    logger.level = Logger::DEBUG
         
     | 
| 
      
 28 
     | 
    
         
            +
                  elsif options[:verbose]
         
     | 
| 
      
 29 
     | 
    
         
            +
                    logger.level = Logger::INFO
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                  logger.debug(options.inspect)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  if options[:keep_exit_status] && !options[:exit_status]
         
     | 
| 
      
 33 
     | 
    
         
            +
                    logger.error 'keep-exit-status requires exit-status'
         
     | 
| 
      
 34 
     | 
    
         
            +
                    abort
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  params = {
         
     | 
| 
      
 38 
     | 
    
         
            +
                    state: options[:state],
         
     | 
| 
      
 39 
     | 
    
         
            +
                    exit_status: options[:exit_status],
         
     | 
| 
      
 40 
     | 
    
         
            +
                    target_url: options[:target_url],
         
     | 
| 
      
 41 
     | 
    
         
            +
                    description: options[:description],
         
     | 
| 
      
 42 
     | 
    
         
            +
                    context: options[:context]
         
     | 
| 
      
 43 
     | 
    
         
            +
                  }
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  notifier = Notifier.new
         
     | 
| 
      
 46 
     | 
    
         
            +
                  notifier.notify(params)
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                  if options[:keep_exit_status]
         
     | 
| 
      
 49 
     | 
    
         
            +
                    exit options[:exit_status]
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                no_commands do
         
     | 
| 
      
 54 
     | 
    
         
            +
                  def logger
         
     | 
| 
      
 55 
     | 
    
         
            +
                    ::GithubStatusNotifier.logger
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module GithubStatusNotifier
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Client < ::Saddler::Reporter::Github::Client
         
     | 
| 
      
 3 
     | 
    
         
            +
                def create_status(state, params)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  logger.info(['create status with these:', slug, @repo.merging_sha, state, params])
         
     | 
| 
      
 5 
     | 
    
         
            +
                  return_state = client.create_status(slug, @repo.merging_sha, state, params)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  logger.debug(return_state)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  return_state
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                def logger
         
     | 
| 
      
 11 
     | 
    
         
            +
                  ::GithubStatusNotifier.logger
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module GithubStatusNotifier
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Notifier
         
     | 
| 
      
 3 
     | 
    
         
            +
                PENDING = 'pending'
         
     | 
| 
      
 4 
     | 
    
         
            +
                SUCCESS = 'success'
         
     | 
| 
      
 5 
     | 
    
         
            +
                ERROR = 'error'
         
     | 
| 
      
 6 
     | 
    
         
            +
                FAILURE = 'failure'
         
     | 
| 
      
 7 
     | 
    
         
            +
                ALLOWED_STATUS = [PENDING, SUCCESS, ERROR, FAILURE]
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def notify(params)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  state = decide_state(params[:state], params[:exit_status])
         
     | 
| 
      
 11 
     | 
    
         
            +
                  repo_path = '.'
         
     | 
| 
      
 12 
     | 
    
         
            +
                  repo = Repository.new(repo_path)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  client = Client.new(repo)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  pass_params = {
         
     | 
| 
      
 15 
     | 
    
         
            +
                    target_url: params[:target_url],
         
     | 
| 
      
 16 
     | 
    
         
            +
                    description: params[:description],
         
     | 
| 
      
 17 
     | 
    
         
            +
                    context: decide_context(params[:context])
         
     | 
| 
      
 18 
     | 
    
         
            +
                  }
         
     | 
| 
      
 19 
     | 
    
         
            +
                  client.create_status(state, pass_params)
         
     | 
| 
      
 20 
     | 
    
         
            +
                rescue StandardError => e
         
     | 
| 
      
 21 
     | 
    
         
            +
                  logger.error e.message
         
     | 
| 
      
 22 
     | 
    
         
            +
                  logger.error e.backtrace
         
     | 
| 
      
 23 
     | 
    
         
            +
                  client.create_status(ERROR, pass_params)
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def decide_context(text)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  text || 'github_status_notifier'
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                def decide_state(state, exit_status)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  if state
         
     | 
| 
      
 32 
     | 
    
         
            +
                    return state.downcase if ALLOWED_STATUS.include?(state.downcase)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    fail Error("state: #{state} is invalid. allowed #{ALLOWED_STATUS}")
         
     | 
| 
      
 34 
     | 
    
         
            +
                  elsif exit_status
         
     | 
| 
      
 35 
     | 
    
         
            +
                    return SUCCESS if exit_status.to_i == 0
         
     | 
| 
      
 36 
     | 
    
         
            +
                    return FAILURE
         
     | 
| 
      
 37 
     | 
    
         
            +
                  else
         
     | 
| 
      
 38 
     | 
    
         
            +
                    fail Error('require state or exit-state')
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                def logger
         
     | 
| 
      
 43 
     | 
    
         
            +
                  ::GithubStatusNotifier.logger
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'saddler/reporter/github'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'github_status_notifier/version'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'github_status_notifier/notifier'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module GithubStatusNotifier
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Error < StandardError; end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def self.default_logger
         
     | 
| 
      
 10 
     | 
    
         
            +
                logger = Logger.new(STDERR)
         
     | 
| 
      
 11 
     | 
    
         
            +
                logger.progname = 'GithubStatusNotifier'
         
     | 
| 
      
 12 
     | 
    
         
            +
                logger.level = Logger::WARN
         
     | 
| 
      
 13 
     | 
    
         
            +
                logger
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def self.logger
         
     | 
| 
      
 17 
     | 
    
         
            +
                return @logger if @logger
         
     | 
| 
      
 18 
     | 
    
         
            +
                @logger = default_logger
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 22 
     | 
    
         
            +
                attr_writer :logger
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,135 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: github_status_notifier
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - sanemat
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-02-28 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: thor
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: saddler-reporter-github
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '1.8'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '1.8'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: test-unit
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            description: Easy to handle GitHub status with exit status. Like TravisCI's build
         
     | 
| 
      
 84 
     | 
    
         
            +
              status.
         
     | 
| 
      
 85 
     | 
    
         
            +
            email:
         
     | 
| 
      
 86 
     | 
    
         
            +
            - o.gata.ken@gmail.com
         
     | 
| 
      
 87 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 88 
     | 
    
         
            +
            - github-status-notifier
         
     | 
| 
      
 89 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 90 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 91 
     | 
    
         
            +
            files:
         
     | 
| 
      
 92 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 93 
     | 
    
         
            +
            - ".rubocop.yml"
         
     | 
| 
      
 94 
     | 
    
         
            +
            - ".tachikoma.yml"
         
     | 
| 
      
 95 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 96 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 97 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 98 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 99 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 100 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 101 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 102 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 103 
     | 
    
         
            +
            - exe/github-status-notifier
         
     | 
| 
      
 104 
     | 
    
         
            +
            - github_status_notifier.gemspec
         
     | 
| 
      
 105 
     | 
    
         
            +
            - lib/github_status_notifier.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - lib/github_status_notifier/cli.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - lib/github_status_notifier/client.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - lib/github_status_notifier/notifier.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - lib/github_status_notifier/repository.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - lib/github_status_notifier/version.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            homepage: https://github.com/packsaddle/ruby-github_status_notifier
         
     | 
| 
      
 112 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 113 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 114 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 115 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 116 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 117 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 118 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 119 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 120 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 121 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 122 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 123 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 124 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 125 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 126 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 127 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 128 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 129 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 130 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 131 
     | 
    
         
            +
            rubygems_version: 2.4.5
         
     | 
| 
      
 132 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 133 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 134 
     | 
    
         
            +
            summary: Notify to GitHub status.
         
     | 
| 
      
 135 
     | 
    
         
            +
            test_files: []
         
     |