Class: Jets::Rails::Job::Queue::Check

Inherits:
Object
  • Object
show all
Includes:
Util::Logging
Defined in:
lib/jets/rails/job/queue/check.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

@@error_message =
"ERROR: Unable to get queue url".color(:red)

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ Check

Returns a new instance of Check.



7
8
9
# File 'lib/jets/rails/job/queue/check.rb', line 7

def initialize(job)
  @job = job
end

Instance Method Details

#exist!Object



12
13
14
15
# File 'lib/jets/rails/job/queue/check.rb', line 12

def exist!
  job_enable_message
  existance!
end

#existance!Object



21
22
23
24
25
26
27
28
29
# File 'lib/jets/rails/job/queue/check.rb', line 21

def existance!
  return if queue_url

  log.error @@error_message
  raise Error, "Are you sure you have deployed with Jets.project.config.job.enable = true ?"
rescue Jets::Api::Error::NotFound
  log.error @@error_message
  raise Error, "It does not look like the stack has successfully deployed. Please deploy first."
end

#job_enable_messageObject

Raises:



31
32
33
34
35
36
# File 'lib/jets/rails/job/queue/check.rb', line 31

def job_enable_message
  return if queue_url

  log.error @@error_message
  raise Error, "Are you sure that config.job.enable = true ?"
end

#queue_urlObject



17
18
19
# File 'lib/jets/rails/job/queue/check.rb', line 17

def queue_url
  Url.queue_url(@job.queue_name)
end