class Fastlane::Actions::QueueStartAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/queue/actions/queue_start_action.rb, line 37
def self.authors
  ["Josh Holtz"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/queue/actions/queue_start_action.rb, line 49
def self.available_options
  # No options right now but probably allow Resque options to be set
  [
    # FastlaneCore::ConfigItem.new(key: :your_option,
    #                         env_name: "QUEUE_YOUR_OPTION",
    #                      description: "A description of your option",
    #                         optional: false,
    #                             type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/queue/actions/queue_start_action.rb, line 33
def self.description
  "Starts web server and worker for queueing fastlane jobs"
end
details() click to toggle source
# File lib/fastlane/plugin/queue/actions/queue_start_action.rb, line 45
def self.details
  "Starts a Resque web server and worker for queueing fastlane jobs"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/queue/actions/queue_start_action.rb, line 60
def self.is_supported?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/queue/actions/queue_start_action.rb, line 41
def self.return_value
  # This action will NEVER return because the worker is blocking
end
run(params) click to toggle source
# File lib/fastlane/plugin/queue/actions/queue_start_action.rb, line 4
def self.run(params)
  UI.message("Starting the queue's web server and worker!")

  # Gotta do the fork thing
  # Otherwise this process will block the worker from starting
  # This can get called  multiple times and only one server will be run
  Process.fork do
    require 'vegas'
    require 'resque/server'
    Vegas::Runner.new(Resque::Server, 'fastlane-plugin-queue-resque-web', {port: 5678, skip_launch: true})
  end
  
  Process.fork do
    require 'vegas'
    require 'resque/server'
    Vegas::Runner.new(App, 'fastlane-plugin-queue-app', {port: 5679})
  end

  # Starts a blocking worker
  require 'resque'
  worker = Resque::Worker.new("fastlane")
  worker.prepare
  worker.log "Starting worker #{self}"
  worker.work(5) # interval, will block

  # Stops the queue and webserver
  other_action.queue_stop
end