Class: Kplay::CLI

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

Instance Method Summary collapse

Instance Method Details

#configObject



25
26
27
28
29
30
31
# File 'lib/kplay/cli.rb', line 25

def config
  print 'Global config file: '
  puts Kplay::Config.global.path.to_s.yellow
  puts
  config = Kplay::Config.local
  puts config.to_h.to_yaml
end

#infoObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/kplay/cli.rb', line 11

def info
  print 'Checking requirements... '
  Kplay.assert_requirements!
  puts 'OK'.green

  path = Dir.pwd
  pod  = Kplay::Pod.new(path)
  puts "     name: #{pod.name}"
  puts "host path: #{pod.path_host}"
  puts "  vm path: #{pod.path_vm}"
  puts
end

#openObject



66
67
68
69
70
# File 'lib/kplay/cli.rb', line 66

def open
  Kplay.assert_requirements!
  pod = Kplay::Pod.new(Dir.pwd, Kplay::Config.local, options)
  pod.shell
end

#playObject



74
75
76
77
78
# File 'lib/kplay/cli.rb', line 74

def play
  start
  open
  stop
end

#pod_configObject



35
36
37
38
39
# File 'lib/kplay/cli.rb', line 35

def pod_config
  Kplay.assert_requirements!
  pod = Kplay::Pod.new(Dir.pwd, Kplay::Config.local, options)
  puts pod.configuration
end

#startObject



52
53
54
55
56
# File 'lib/kplay/cli.rb', line 52

def start
  Kplay.assert_requirements!
  pod = Kplay::Pod.new(Dir.pwd, Kplay::Config.local, options)
  pod.start!
end

#statusObject



43
44
45
46
47
48
# File 'lib/kplay/cli.rb', line 43

def status
  Kplay.assert_requirements!
  Kplay.sh ['minikube', 'status']
  pod = Kplay::Pod.new(Dir.pwd)
  Kplay.sh ['kubectl', 'get', 'pods', pod.name] rescue nil
end

#stopObject



59
60
61
62
63
# File 'lib/kplay/cli.rb', line 59

def stop
  Kplay.assert_requirements!
  pod = Kplay::Pod.new(Dir.pwd, Kplay::Config.local, options)
  pod.stop!
end