class Dynosaur::Process::Heroku::Finder

Attributes

client[R]
rake_command[R]

Public Class Methods

new(rake_command:, client: Client::HerokuClient.client) click to toggle source
# File lib/dynosaur/process/heroku/finder.rb, line 6
def initialize(rake_command:, client: Client::HerokuClient.client)
  @rake_command = rake_command
  @client = client
end

Public Instance Methods

exists?() click to toggle source
# File lib/dynosaur/process/heroku/finder.rb, line 11
def exists?
  one_off_dynos.any? do |dyno|
    Utils::RakeCommand.valid?(dyno.command) &&
      Utils::RakeCommand.parse(dyno.command) == rake_command
  end
end

Private Instance Methods

one_off_dynos() click to toggle source

@return [Array] Object instances, which respond to command, for all

locally one off dynos
# File lib/dynosaur/process/heroku/finder.rb, line 24
def one_off_dynos
  app_name = Dynosaur::Client::HerokuClient.app_name
  dynos = client.dyno.list(app_name).map do |response|
    Struct.new(:type, :command).new(response['type'], response['command'])
  end
  dynos.select { |dyno| dyno.type == 'run' }
end