Sha256: 4164e6f8374a09c65b6bf5660c6660c80563eba252c88837892baf65c51a4829

Contents?: true

Size: 685 Bytes

Versions: 15

Compression:

Stored size: 685 Bytes

Contents

require 'json'

module Heartcheck
  module Checks
    class WatchFile < Base
      def add_service(options)
        services << options.merge(runtime: installed(options[:file]))
      end

      def validate
        services.each do |service|
          if not service[:runtime].eql? installed(service[:file])
            @errors << "App outdated, check /monitoring/info for more details!"
          end
        end
      end

      def info
        services.collect do |service|
          { runtime: service[:runtime], installed: installed(service[:file]) }
        end
      end

      private

      def installed(file)
        JSON.parse open(file).read
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
heartcheck-2.0.0 lib/heartcheck/checks/watch_file.rb
heartcheck-1.6.0 lib/heartcheck/checks/watch_file.rb
heartcheck-1.5.1 lib/heartcheck/checks/watch_file.rb
heartcheck-1.5.0 lib/heartcheck/checks/watch_file.rb
heartcheck-1.4.0 lib/heartcheck/checks/watch_file.rb
heartcheck-1.3.0 lib/heartcheck/checks/watch_file.rb
heartcheck-1.2.2 lib/heartcheck/checks/watch_file.rb
heartcheck-1.2.1 lib/heartcheck/checks/watch_file.rb
heartcheck-1.2.0 lib/heartcheck/checks/watch_file.rb
heartcheck-1.1.1 lib/heartcheck/checks/watch_file.rb
heartcheck-1.1.0 lib/heartcheck/checks/watch_file.rb
heartcheck-1.0.9 lib/heartcheck/checks/watch_file.rb
heartcheck-1.0.8 lib/heartcheck/checks/watch_file.rb
heartcheck-1.0.7 lib/heartcheck/checks/watch_file.rb
heartcheck-1.0.6 lib/heartcheck/checks/watch_file.rb