Sha256: a79086d006026c871eb72292a3937dbb239358c557c618b5bd71df5c453b37ba

Contents?: true

Size: 890 Bytes

Versions: 3

Compression:

Stored size: 890 Bytes

Contents

module Nucleus
  module Adapters
    module V1
      class Heroku < Stub
        module Scaling
          # @see Stub#scale
          def scale(application_id, instances)
            scale_web(application_id, instances)
            # return the updated application object
            application(application_id)
          end

          private

          def scale_web(application_id, instances)
            patch("/apps/#{application_id}/formation", body: { updates: [{ process: 'web', quantity: instances }] })
          end

          def scale_worker(application_id, instances)
            patch("/apps/#{application_id}/formation", body: { updates: [{ process: 'worker', quantity: instances }] },
                  # raises 404 if no worker is defined in the Procfile
                  expects: [404])
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nucleus-0.3.1 lib/nucleus/adapters/v1/heroku/scaling.rb
nucleus-0.2.0 lib/nucleus/adapters/v1/heroku/scaling.rb
nucleus-0.1.0 lib/nucleus/adapters/v1/heroku/scaling.rb