okcomputer 1.14.2 → 1.15.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/lib/ok_computer/built_in_checks/sequel_check.rb +38 -0
 - data/lib/ok_computer/version.rb +1 -1
 - data/lib/okcomputer.rb +7 -1
 - metadata +18 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 99ca2ec1ff46d08a26f3ff8ee3d83057d3e767db
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 838198d8a85cd59691ae608cf9f9908f1c3796d6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 225b273a77e2f230625265bd6a40463c0de7d9212ac1bb38eeb7c48a1b21369722edaf5fbcab6ac48018e6ca5c2701ddb66f4c09093dc4d3638fbf9140da2204
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0b6f9987e4f0dcd90967592a439f00435fd96128aa2f6a4056b48e2aa927032c8cab3be203d5c55c98299ce1a5a8df7dfaeb1df5861ba557ab4e6bd706fcd23b
         
     | 
| 
         @@ -0,0 +1,38 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module OkComputer
         
     | 
| 
      
 2 
     | 
    
         
            +
              class SequelCheck < Check
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_reader :migration_directory
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                # Public: Initialize the SequelCheck with the database and/or the migration_directory.
         
     | 
| 
      
 6 
     | 
    
         
            +
                #
         
     | 
| 
      
 7 
     | 
    
         
            +
                # Defaults to Sequel:Model.db and 'db/migration' respectively. "database" option can be a Proc so that
         
     | 
| 
      
 8 
     | 
    
         
            +
                # Sequel can be instantiated later in the boot process.
         
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(options={})
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @database = options[:database] || -> { ::Sequel::Model.db }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @migration_directory = options[:migration_directory] || 'db/migrate'
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                # Public: Return the schema version of the database
         
     | 
| 
      
 15 
     | 
    
         
            +
                def check
         
     | 
| 
      
 16 
     | 
    
         
            +
                  mark_message "Schema is #{'not ' unless is_current?}up to date"
         
     | 
| 
      
 17 
     | 
    
         
            +
                rescue ConnectionFailed => e
         
     | 
| 
      
 18 
     | 
    
         
            +
                  mark_failure
         
     | 
| 
      
 19 
     | 
    
         
            +
                  mark_message "Error: '#{e}'"
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def database
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @database.is_a?(Proc) ? @database.call : @database
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                # Public: The scema version of the app's database
         
     | 
| 
      
 27 
     | 
    
         
            +
                #
         
     | 
| 
      
 28 
     | 
    
         
            +
                # Returns a String with the version number
         
     | 
| 
      
 29 
     | 
    
         
            +
                def is_current?
         
     | 
| 
      
 30 
     | 
    
         
            +
                  ::Sequel.extension(:migration)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  ::Sequel::Migrator.is_current?(database, migration_directory)
         
     | 
| 
      
 32 
     | 
    
         
            +
                rescue => e
         
     | 
| 
      
 33 
     | 
    
         
            +
                  raise ConnectionFailed, e
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                ConnectionFailed = Class.new(StandardError)
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/ok_computer/version.rb
    CHANGED
    
    
    
        data/lib/okcomputer.rb
    CHANGED
    
    | 
         @@ -30,8 +30,14 @@ require "ok_computer/built_in_checks/resque_backed_up_check" 
     | 
|
| 
       30 
30 
     | 
    
         
             
            require "ok_computer/built_in_checks/resque_down_check"
         
     | 
| 
       31 
31 
     | 
    
         
             
            require "ok_computer/built_in_checks/resque_failure_threshold_check"
         
     | 
| 
       32 
32 
     | 
    
         
             
            require "ok_computer/built_in_checks/ruby_version_check"
         
     | 
| 
      
 33 
     | 
    
         
            +
            require "ok_computer/built_in_checks/sequel_check"
         
     | 
| 
       33 
34 
     | 
    
         
             
            require "ok_computer/built_in_checks/sidekiq_latency_check"
         
     | 
| 
       34 
35 
     | 
    
         
             
            require "ok_computer/built_in_checks/solr_check"
         
     | 
| 
       35 
36 
     | 
    
         | 
| 
       36 
37 
     | 
    
         
             
            OkComputer::Registry.register "default", OkComputer::DefaultCheck.new
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            if defined?(ActiveRecord)
         
     | 
| 
      
 40 
     | 
    
         
            +
              OkComputer::Registry.register "database", OkComputer::ActiveRecordCheck.new
         
     | 
| 
      
 41 
     | 
    
         
            +
            elsif defined?(Sequel)
         
     | 
| 
      
 42 
     | 
    
         
            +
              OkComputer::Registry.register "database", OkComputer::SequelCheck.new
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: okcomputer
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.15.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Patrick Byrne
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2017- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2017-05-08 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: sqlite3
         
     | 
| 
         @@ -54,6 +54,20 @@ dependencies: 
     | 
|
| 
       54 
54 
     | 
    
         
             
                - - ">="
         
     | 
| 
       55 
55 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       56 
56 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 57 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 58 
     | 
    
         
            +
              name: sequel
         
     | 
| 
      
 59 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 60 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 61 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 62 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 63 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 64 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 65 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 66 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 67 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 68 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 69 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 70 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       57 
71 
     | 
    
         
             
            description: "\n    Inspired by the simplicity of Fitter Happier, but frustrated by
         
     | 
| 
       58 
72 
     | 
    
         
             
              its lack of\n    flexibility, we built OK Computer. Create and register your own
         
     | 
| 
       59 
73 
     | 
    
         
             
              custom\n    health checks, or choose from the built-in library of checks to ensure
         
     | 
| 
         @@ -94,6 +108,7 @@ files: 
     | 
|
| 
       94 
108 
     | 
    
         
             
            - lib/ok_computer/built_in_checks/resque_down_check.rb
         
     | 
| 
       95 
109 
     | 
    
         
             
            - lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb
         
     | 
| 
       96 
110 
     | 
    
         
             
            - lib/ok_computer/built_in_checks/ruby_version_check.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - lib/ok_computer/built_in_checks/sequel_check.rb
         
     | 
| 
       97 
112 
     | 
    
         
             
            - lib/ok_computer/built_in_checks/sidekiq_latency_check.rb
         
     | 
| 
       98 
113 
     | 
    
         
             
            - lib/ok_computer/built_in_checks/size_threshold_check.rb
         
     | 
| 
       99 
114 
     | 
    
         
             
            - lib/ok_computer/built_in_checks/solr_check.rb
         
     | 
| 
         @@ -125,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       125 
140 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       126 
141 
     | 
    
         
             
            requirements: []
         
     | 
| 
       127 
142 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       128 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 143 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
       129 
144 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       130 
145 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       131 
146 
     | 
    
         
             
            summary: A simple, extensible health-check monitor
         
     |