Class: Pulsar::CLI

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

Instance Method Summary collapse

Instance Method Details

#__print_versionObject



91
92
93
# File 'lib/pulsar/cli.rb', line 91

def __print_version
  puts Pulsar::VERSION
end

#deploy(application, environment) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/pulsar/cli.rb', line 56

def deploy(application, environment)
  load_config
  result = Pulsar::Task.call(
    repository: load_option_or_env!(:conf_repo),
    application: application, environment: environment,
    task: 'deploy'
  )

  if result.success?
    puts "Deployed #{application} on #{environment}!"
  else
    puts "Failed to deploy #{application} on #{environment}."
    puts result.error
  end
end

#install(directory = './pulsar-conf') ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/pulsar/cli.rb', line 18

def install(directory = './pulsar-conf')
  result = Pulsar::Install.call(directory: directory)

  if result.success?
    puts 'Successfully created intial repo!'
  else
    puts 'Failed to create intial repo.'
    puts result.error
  end
end

#listObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/pulsar/cli.rb', line 35

def list
  load_config
  result = Pulsar::List.call(repository: load_option_or_env!(:conf_repo))

  if result.success?
    result.applications.each do |app, stages|
      puts "#{app}: #{stages.join(', ')}"
    end
  else
    puts 'Failed to list application and environments.'
    puts result.error
  end
end

#task(application, environment, task) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/pulsar/cli.rb', line 74

def task(application, environment, task)
  load_config
  result = Pulsar::Task.call(
    repository: load_option_or_env!(:conf_repo),
    application: application, environment: environment,
    task: task
  )

  if result.success?
    puts "Executed task #{task} for #{application} on #{environment}!"
  else
    puts "Failed to execute task #{task} for #{application} on #{environment}."
    puts result.error
  end
end