Sha256: 555cde59f538fd661a7ac5f51053cc7df8b0a2f72d75063750e2a1979ebe8ccb

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby -wKU

module Scout
  class Command
    class Run < Command
      def run
        key = @args.first
        # TODO: this is an awkward way to force creation of the config directory. Could use a little refactoring.
        configuration_directory = config_dir
        log.debug("Configuration directory is #{configuration_directory} ") if log
        # TODO: too much external logic of command doing things TO server. This should be moved into the server class.
        @scout = Scout::Server.new(server, key, history, log)
        @scout.load_history
        @scout.fetch_plan

        if @scout.new_plan || @scout.time_to_checkin?  || @force
          if @scout.new_plan
            log.info("Now checking in with new plugin plan") if log
          elsif @scout.time_to_checkin?
            log.info("It is time to checkin") if log
          elsif @force
            log.info("overriding checkin schedule with --force and checking in now.") if log
          end
          create_pid_file_or_exit
          @scout.run_plugins_by_plan
          @scout.save_history
        else
          log.info "Not time to checkin yet. Next checkin in #{@scout.next_checkin}. Override by passing --force to the scout command" if log
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scout-5.1.4 lib/scout/command/run.rb
scout-5.1.3 lib/scout/command/run.rb
scout-5.1.2 lib/scout/command/run.rb
scout-5.1.1 lib/scout/command/run.rb
scout-5.1.0 lib/scout/command/run.rb
scout-5.0.3 lib/scout/command/run.rb