Class: Yu::CLI

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/yu.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(*args) ⇒ Object



12
13
14
# File 'lib/yu.rb', line 12

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/yu.rb', line 16

def call
  program :name, 'yu'
  program :version, VERSION
  program :description, 'Helps you manage your microservices'

  command :test do |c|
    c.syntax = 'yu test'
    c.description = 'Run tests for service(s)'
    c.action(method(:test))
  end

  command :build do |c|
    c.syntax = 'yu build'
    c.description = 'Build image for service(s)'
    c.action(method(:build))
  end

  command :shell do |c|
    c.syntax = 'yu shell'
    c.description = 'Start a shell container for a service'
    c.option '--test'
    c.action(method(:shell))
  end

  command :reset do |c|
    c.syntax = 'yu reset'
    c.description = 'Fresh build of images for all services and restart'
    c.option '--without-cache'
    c.action(method(:reset))
  end

  command :doctor do |c|
    c.syntax = 'yu doctor'
    c.description = 'Check your environment is ready to yu'
    c.action(method(:doctor))
  end

  command :restart do |c|
    c.syntax = 'yu restart'
    c.description = 'Restart containers for service(s)'
    c.action(method(:restart))
  end

  command :start do |c|
    c.syntax = 'yu start'
    c.description = 'Start containers containers for service(s)'
    c.action(method(:restart))
  end

  command :recreate do |c|
    c.syntax = 'yu recreate'
    c.description = 'Recreate containers for service(s)'
    c.action(method(:recreate))
  end

  command :service do |c|
    c.syntax = 'yu service'
    c.description = 'Create service from template'
    c.action(method(:service))
  end

  global_option('-V', '--verbose', 'Verbose output') { $verbose_mode = true }

  run!
end