Class: Sherpa::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



5
6
7
# File 'lib/sherpa/cli.rb', line 5

def initialize
  @prompt = TTY::Prompt.new
end

Class Method Details

.runObject



9
10
11
# File 'lib/sherpa/cli.rb', line 9

def self.run
  new.run
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sherpa/cli.rb', line 13

def run
  self.trekker = trekker_prompt
  self.stage = prompt.select("Choose the stage!", stage_choices)
  self.branch = prompt.ask("What branch would you like to deploy?")

  deploy = Sherpa::Model::Deploy.new(
    trekker: trekker,
    stage: stage,
    branch: branch
  )

  deploy.kick_off!

  prompt.ok("Deploying - #{branch} for #{`whoami`.chomp} to #{trekker.name} - #{stage.name}")

rescue FailedRequest => e
  prompt.error("API Request Failed :(")
end