Class: GoodJob::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/good_job/cli.rb

Overview

Implements the good_job command-line tool, which executes jobs and provides other utilities. The actual entry point is in exe/good_job, but it just sets up and calls this class.

The good_job command-line tool is based on Thor, a CLI framework for Ruby. For more on general usage, see whatisthor.com/ and github.com/erikhuda/thor/wiki.

Constant Summary collapse

RAILS_ENVIRONMENT_RB =

Path to the local Rails application’s environment configuration. Requiring this loads the application’s configuration and classes.

File.expand_path("config/environment.rb")
SHUTDOWN_EVENT_TIMEOUT =

Number of seconds between checking shutdown conditions

10
SHUTDOWN_EVENT_TIMEOUT_FOR_IDLE_TIMEOUT =

Number of seconds between checking shutdown conditions when idle-timeout is enabled

1

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.log_to_stdoutBoolean? Also known as: log_to_stdout?

Whether to log to STDOUT

Returns:

  • (Boolean, nil)


34
35
36
# File 'lib/good_job/cli.rb', line 34

def log_to_stdout
  @log_to_stdout
end

.within_exeBoolean? Also known as: within_exe?

Whether the CLI is running from the executable

Returns:

  • (Boolean, nil)


29
30
31
# File 'lib/good_job/cli.rb', line 29

def within_exe
  @within_exe
end

Instance Method Details

#cleanup_preserved_jobsvoid

This method returns an undefined value.

The good_job cleanup_preserved_jobs command. Destroys preserved job records.



143
# File 'lib/good_job/cli.rb', line 143

desc :cleanup_preserved_jobs, "Destroys preserved job records."

#startvoid

This method returns an undefined value.

The good_job start command. Executes queued jobs.



47
# File 'lib/good_job/cli.rb', line 47

desc :start, "Executes queued jobs."