Class: Picobox::CLI

Inherits:
Thor
  • Object
show all
Includes:
Utils::Output
Defined in:
lib/picobox/cli.rb

Instance Method Summary collapse

Methods included from Utils::Output

#display_error, #display_info, #display_line, #display_status

Instance Method Details

#boxesObject



181
182
183
184
185
# File 'lib/picobox/cli.rb', line 181

def boxes()
  Box.new(Os::CurrentOs.get).list
rescue SignalException
  exit 1
end

#init(box) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/picobox/cli.rb', line 121

def init(box)
  Picobox.set_verbosity options[:verbose]

  os = Os::CurrentOs.get

  Project.new(os).init
  Box.new(os).install box
  Service.new(os).build
  System.new(os).start
rescue SignalException
  exit 1
end

#installObject



88
89
90
91
92
93
# File 'lib/picobox/cli.rb', line 88

def install
  Picobox.set_verbosity options[:verbose]
  System.new(Os::CurrentOs.get).install
rescue SignalException
  exit 1
end

#resetObject



201
202
203
204
205
206
207
208
# File 'lib/picobox/cli.rb', line 201

def reset()
  display_info('Cleaning stopped containers', :green)
  display_status('execute', 'container prune')
  system "docker container prune"
  system "docker volume prune"
rescue SignalException
  exit 1
end

#restartObject



160
161
162
163
164
165
# File 'lib/picobox/cli.rb', line 160

def restart()
  Picobox.set_verbosity options[:verbose]
  System.new(Os::CurrentOs.get).restart
rescue SignalException
  exit 1
end

#ssh(service) ⇒ Object



171
172
173
174
175
# File 'lib/picobox/cli.rb', line 171

def ssh(service)
  System.new(Os::CurrentOs.get).ssh service
rescue SignalException
  exit 1
end

#startObject



138
139
140
141
142
143
# File 'lib/picobox/cli.rb', line 138

def start()
  Picobox.set_verbosity options[:verbose]
  System.new(Os::CurrentOs.get).start
rescue SignalException
  exit 1
end

#statusObject



191
192
193
194
195
# File 'lib/picobox/cli.rb', line 191

def status()
  system "docker-compose ps"
rescue SignalException
  exit 1
end

#stopObject



149
150
151
152
153
154
# File 'lib/picobox/cli.rb', line 149

def stop()
  Picobox.set_verbosity options[:verbose]
  System.new(Os::CurrentOs.get).stop
rescue SignalException
  exit 1
end

#uninstallObject



110
111
112
113
114
115
# File 'lib/picobox/cli.rb', line 110

def uninstall
  Picobox.set_verbosity options[:verbose]
  System.new(Os::CurrentOs.get).uninstall
rescue SignalException
  exit 1
end

#updateObject



99
100
101
102
103
104
# File 'lib/picobox/cli.rb', line 99

def update
  Picobox.set_verbosity options[:verbose]
  System.new(Os::CurrentOs.get).install
rescue SignalException
  exit 1
end

#versionObject



77
78
79
80
81
82
# File 'lib/picobox/cli.rb', line 77

def version
  say "Picobox:  #{Picobox::VERSION}"
  say "Packages: #{Picobox::Utils::Packages.new(Os::CurrentOs.get).installed_version[1..-1]}"
rescue SignalException
  exit 1
end