Class: Minfra::Cli::Dev

Inherits:
Command show all
Defined in:
lib/minfra/cli/commands/dev.rb

Instance Method Summary collapse

Methods included from Logging

#debug, #deprecated, #error, #exit_error, #info, #warn

Methods included from Common

#run_cmd

Instance Method Details

#createObject



14
15
16
# File 'lib/minfra/cli/commands/dev.rb', line 14

def create
  kube.create
end

#describeObject



9
10
11
# File 'lib/minfra/cli/commands/dev.rb', line 9

def describe
  pp minfra_config.describe(options[:environment])
end

#destroyObject



48
49
50
# File 'lib/minfra/cli/commands/dev.rb', line 48

def destroy
  kube.destroy_dev_cluster
end

#envsObject



53
54
55
# File 'lib/minfra/cli/commands/dev.rb', line 53

def envs
  puts minfra_cli.envs.keys.join(', ')
end

#restartObject



38
39
40
# File 'lib/minfra/cli/commands/dev.rb', line 38

def restart
  kube.restart
end

#startObject



43
44
45
# File 'lib/minfra/cli/commands/dev.rb', line 43

def start
  restart
end

#upgradeObject



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

def upgrade
  info 'Destroying existing dev cluster..'
  destroy
  Runner.run(
    "mv #{minfra_config.base_path.join('me',
                                       'kind.yaml.erb')} #{minfra_config.base_path.join('me', "kind_old_#{Time.now.strftime('%Y_%m_%dT%H_%M_%SZ')}.yaml.erb")}", print_stdout: true
  )
  Runner.run(
    "mv #{minfra_config.base_path.join('me', 'kube',
                                       'config')} #{minfra_config.base_path.join('me', 'kube', "config_old_#{Time.now.strftime('%Y_%m_%dT%H_%M_%SZ')}")}", print_stdout: true
  )
  Runner.run('yes | minfra setup dev', print_stdout: true) # On an existing cluster this should only ask for recreating the files that we moved previously
  info 'Creating a new dev cluster..'
  create
  info 'I am done upgrading the dev cluster! 🎉'
end