patches 2.4.1 → 3.1.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/CHANGELOG.md +8 -0
- data/bin/console +0 -0
- data/docs/usage.md +1 -9
- data/lib/patches/config.rb +2 -18
- data/lib/patches/notifier.rb +1 -11
- data/lib/patches/tenant_run_concern.rb +3 -2
- data/lib/patches/version.rb +4 -1
- data/patches.gemspec +0 -1
- metadata +3 -19
- data/script/buildkite.sh +0 -21
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0c64a7680b2e1f703e7b66026113aa41a1c8a4eb6150eddf41d57fe3dc73cc3a
         | 
| 4 | 
            +
              data.tar.gz: 1857e2c1a65df0e1df26dff96b65db37380f1f8887d855d906ca7791be410e03
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2ba176d20d1b4212da9c5f6170a8e9aaca2060074d908ad0bf1638b100ba7acd7089a90db000ad33eb81a5297dda2a4f54eee0801de0bc73e1a0e1292a060cd1
         | 
| 7 | 
            +
              data.tar.gz: dca92ff447b236a9e47b28f5b1ce31739d7eb8a40f5325d53f977263655929a727a2f0089842b2fe7fccfb9b4fe4390ccfd0beaf629764d403bbd1c4bf0686d9
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
| 6 6 |  | 
| 7 7 | 
             
            ## [Unreleased]
         | 
| 8 8 |  | 
| 9 | 
            +
            ## [3.0.1] - 2018-11-19
         | 
| 10 | 
            +
            ### Added
         | 
| 11 | 
            +
            - Set icon_emoji of posted slack message to :dog:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ## [3.0.0] - 2018-11-19
         | 
| 14 | 
            +
            ### Removed
         | 
| 15 | 
            +
            - Hipchat is no longer supported
         | 
| 16 | 
            +
             | 
| 9 17 | 
             
            ## [2.4.1] - 2018-09-19
         | 
| 10 18 | 
             
            ### Changed
         | 
| 11 19 | 
             
            - Corrected gem ownership and authors.
         | 
    
        data/bin/console
    CHANGED
    
    | 
            File without changes
         | 
    
        data/docs/usage.md
    CHANGED
    
    | @@ -23,21 +23,13 @@ bundle exec rake db:migrate | |
| 23 23 | 
             
            ## Configuration
         | 
| 24 24 |  | 
| 25 25 | 
             
            If you would like to run the patches asynchronously, or would like them to notify
         | 
| 26 | 
            -
            your  | 
| 26 | 
            +
            your Slack channel when they fail or succeed, you need to set up
         | 
| 27 27 | 
             
            an initializer to set those options.
         | 
| 28 28 |  | 
| 29 29 | 
             
            ```Ruby
         | 
| 30 30 | 
             
            Patches::Config.configure do |config|
         | 
| 31 31 | 
             
              config.use_sidekiq = true
         | 
| 32 32 |  | 
| 33 | 
            -
              config.use_hipchat = true
         | 
| 34 | 
            -
              config.hipchat_options = {
         | 
| 35 | 
            -
                api_token: ENV['HIPCHAT_TOKEN'],
         | 
| 36 | 
            -
                room: ENV['HIPCHAT_ROOM'],
         | 
| 37 | 
            -
                user: ENV['HIPCHAT_USERNAME'], # maximum of 15 characters
         | 
| 38 | 
            -
                api_version: 'v1', # optional
         | 
| 39 | 
            -
              }
         | 
| 40 | 
            -
             | 
| 41 33 | 
             
              config.use_slack = true
         | 
| 42 34 | 
             
              config.slack_options = {
         | 
| 43 35 | 
             
                webhook_url: ENV['SLACK_WEBHOOK_URL'],
         | 
    
        data/lib/patches/config.rb
    CHANGED
    
    | @@ -14,8 +14,8 @@ module Patches | |
| 14 14 | 
             
                  end
         | 
| 15 15 |  | 
| 16 16 | 
             
                  class Configuration
         | 
| 17 | 
            -
                    attr_accessor :use_sidekiq, :sidekiq_queue, :sidekiq_options, | 
| 18 | 
            -
                      : | 
| 17 | 
            +
                    attr_accessor :use_sidekiq, :sidekiq_queue, :sidekiq_options,
         | 
| 18 | 
            +
                      :sidekiq_parallel, :use_slack, :slack_options
         | 
| 19 19 |  | 
| 20 20 | 
             
                    def initialize
         | 
| 21 21 | 
             
                      @sidekiq_queue = 'default'
         | 
| @@ -25,22 +25,6 @@ module Patches | |
| 25 25 | 
             
                      @sidekiq_options ||= { retry: false, queue: sidekiq_queue }
         | 
| 26 26 | 
             
                    end
         | 
| 27 27 |  | 
| 28 | 
            -
                    def hipchat_api_token
         | 
| 29 | 
            -
                      hipchat_options[:api_token]
         | 
| 30 | 
            -
                    end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                    def hipchat_init_options
         | 
| 33 | 
            -
                      hipchat_options.except(:api_token, :room, :user)
         | 
| 34 | 
            -
                    end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                    def hipchat_room
         | 
| 37 | 
            -
                      hipchat_options[:room]
         | 
| 38 | 
            -
                    end
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                    def hipchat_user
         | 
| 41 | 
            -
                      hipchat_options[:user]
         | 
| 42 | 
            -
                    end
         | 
| 43 | 
            -
             | 
| 44 28 | 
             
                    def slack_channel
         | 
| 45 29 | 
             
                      slack_options[:channel]
         | 
| 46 30 | 
             
                    end
         | 
    
        data/lib/patches/notifier.rb
    CHANGED
    
    | @@ -3,12 +3,10 @@ require 'slack-notifier' | |
| 3 3 | 
             
            class Patches::Notifier
         | 
| 4 4 | 
             
              class << self
         | 
| 5 5 | 
             
                def notify_success(patches)
         | 
| 6 | 
            -
                  send_hipchat_message(success_message(patches), color: 'green')
         | 
| 7 6 | 
             
                  send_slack_message(success_message(patches), 'good')
         | 
| 8 7 | 
             
                end
         | 
| 9 8 |  | 
| 10 9 | 
             
                def notify_failure(patch_path, error)
         | 
| 11 | 
            -
                  send_hipchat_message(failure_message(patch_path, error), color: 'red')
         | 
| 12 10 | 
             
                  send_slack_message(failure_message(patch_path, error), 'danger')
         | 
| 13 11 | 
             
                end
         | 
| 14 12 |  | 
| @@ -32,14 +30,6 @@ class Patches::Notifier | |
| 32 30 | 
             
                  message
         | 
| 33 31 | 
             
                end
         | 
| 34 32 |  | 
| 35 | 
            -
                def send_hipchat_message(message, options)
         | 
| 36 | 
            -
                  return unless defined?(HipChat) && config.use_hipchat
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                  client = HipChat::Client.new(config.hipchat_api_token, config.hipchat_init_options)
         | 
| 39 | 
            -
                  room = client[config.hipchat_room]
         | 
| 40 | 
            -
                  room.send(config.hipchat_user, message, options)
         | 
| 41 | 
            -
                end
         | 
| 42 | 
            -
             | 
| 43 33 | 
             
                def send_slack_message(message, color)
         | 
| 44 34 | 
             
                  return unless defined?(Slack) && config.use_slack
         | 
| 45 35 |  | 
| @@ -48,7 +38,7 @@ class Patches::Notifier | |
| 48 38 | 
             
                    channel: config.slack_channel,
         | 
| 49 39 | 
             
                    username: config.slack_username)
         | 
| 50 40 |  | 
| 51 | 
            -
                  payload = { attachments: [{ color: color, text: message }] }
         | 
| 41 | 
            +
                  payload = { icon_emoji: ":dog:", attachments: [{ color: color, text: message }] }
         | 
| 52 42 |  | 
| 53 43 | 
             
                  notifier.post payload
         | 
| 54 44 | 
             
                end
         | 
    
        data/lib/patches/version.rb
    CHANGED
    
    
    
        data/patches.gemspec
    CHANGED
    
    | @@ -34,7 +34,6 @@ Gem::Specification.new do |spec| | |
| 34 34 | 
             
              spec.add_development_dependency "database_cleaner", "~> 1.3.0"
         | 
| 35 35 | 
             
              spec.add_development_dependency "pry"
         | 
| 36 36 | 
             
              spec.add_development_dependency "sidekiq", "~> 3.4.1"
         | 
| 37 | 
            -
              spec.add_development_dependency "hipchat"
         | 
| 38 37 | 
             
              spec.add_development_dependency "webmock"
         | 
| 39 38 | 
             
              spec.add_development_dependency "byebug"
         | 
| 40 39 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: patches
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 3.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - JobReady
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2020-07-20 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: railties
         | 
| @@ -206,20 +206,6 @@ dependencies: | |
| 206 206 | 
             
                - - "~>"
         | 
| 207 207 | 
             
                  - !ruby/object:Gem::Version
         | 
| 208 208 | 
             
                    version: 3.4.1
         | 
| 209 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 210 | 
            -
              name: hipchat
         | 
| 211 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 212 | 
            -
                requirements:
         | 
| 213 | 
            -
                - - ">="
         | 
| 214 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 215 | 
            -
                    version: '0'
         | 
| 216 | 
            -
              type: :development
         | 
| 217 | 
            -
              prerelease: false
         | 
| 218 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 219 | 
            -
                requirements:
         | 
| 220 | 
            -
                - - ">="
         | 
| 221 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 222 | 
            -
                    version: '0'
         | 
| 223 209 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 224 210 | 
             
              name: webmock
         | 
| 225 211 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -291,7 +277,6 @@ files: | |
| 291 277 | 
             
            - lib/patches/worker.rb
         | 
| 292 278 | 
             
            - lib/tasks/patches.rake
         | 
| 293 279 | 
             
            - patches.gemspec
         | 
| 294 | 
            -
            - script/buildkite.sh
         | 
| 295 280 | 
             
            homepage: http://github.com/jobready/patches
         | 
| 296 281 | 
             
            licenses:
         | 
| 297 282 | 
             
            - MIT
         | 
| @@ -311,8 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 311 296 | 
             
                - !ruby/object:Gem::Version
         | 
| 312 297 | 
             
                  version: '0'
         | 
| 313 298 | 
             
            requirements: []
         | 
| 314 | 
            -
             | 
| 315 | 
            -
            rubygems_version: 2.7.6
         | 
| 299 | 
            +
            rubygems_version: 3.0.3
         | 
| 316 300 | 
             
            signing_key: 
         | 
| 317 301 | 
             
            specification_version: 4
         | 
| 318 302 | 
             
            summary: A simple gem for one off tasks
         | 
    
        data/script/buildkite.sh
    DELETED
    
    | @@ -1,21 +0,0 @@ | |
| 1 | 
            -
            #!/bin/bash
         | 
| 2 | 
            -
            set -e
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            echo '--- setting ruby version'
         | 
| 5 | 
            -
            cd /var/lib/buildkite-agent/.rbenv/plugins/ruby-build && git pull && cd -
         | 
| 6 | 
            -
            rbenv install 2.3.7 -s
         | 
| 7 | 
            -
            rbenv local 2.3.7
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            echo '--- setting up env'
         | 
| 10 | 
            -
            REVISION=https://github.com/$BUILDBOX_PROJECT_SLUG/commit/$BUILDBOX_COMMIT
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            echo '--- bundling'
         | 
| 13 | 
            -
            bundle install -j $(nproc) --without production --quiet
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            echo '--- running specs'
         | 
| 16 | 
            -
            if bundle exec rspec; then
         | 
| 17 | 
            -
              echo "[Successful] $BUILDBOX_PROJECT_SLUG - Build - $BUILDBOX_BUILD_URL - Commit - $REVISION" | hipchat_room_message -t $HIPCHAT_TOKEN -r $HIPCHAT_ROOM -f "Buildbox" -c "green"
         | 
| 18 | 
            -
            else
         | 
| 19 | 
            -
              echo "[Failed] Build $BUILDBOX_PROJECT_SLUG - Build - $BUILDBOX_BUILD_URL - Commit - $REVISION" | hipchat_room_message -t $HIPCHAT_TOKEN -r $HIPCHAT_ROOM -f "Buildbox" -c "red"
         | 
| 20 | 
            -
              exit 1;
         | 
| 21 | 
            -
            fi
         |