Class: RubyNative::CLI::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_native/cli/deploy.rb

Constant Summary collapse

CONFIG_PATH =
"config/ruby_native.yml"
HOST =
ENV.fetch("RUBY_NATIVE_HOST", "https://rubynative.com")
POLL_INTERVAL =
5
POLL_TIMEOUT =
600
TokenExpiredError =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Deploy

Returns a new instance of Deploy.



17
18
19
# File 'lib/ruby_native/cli/deploy.rb', line 17

def initialize(argv)
  @if_needed = argv.include?("--if-needed")
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ruby_native/cli/deploy.rb', line 21

def run
  load_config!
  ensure_authenticated!
  app_id = resolve_app_id!

  if @if_needed && skip_build?(app_id)
    puts "Ruby Native v#{RubyNative::VERSION} already built. Skipping deploy."
    return
  end

  build = trigger_build(app_id)
  return if @if_needed

  poll_build_status(app_id, build)
end