hippo-cli 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f83aed53c34504783dbbddbcdd77dfa3b7a612b3963538744b7c7fd67dfd700
4
- data.tar.gz: 55a178de59ec1f5d2cea029e4ab1183cfeb458248d1239e725193dff49a26d50
3
+ metadata.gz: 5b0705ed92b4a87716b435a10107d472adb75e391404c981e359a258318ed106
4
+ data.tar.gz: 385e2ec641b638bbdc9bd650174249bdd12a5c1304f76bd183402f99bf44b1c3
5
5
  SHA512:
6
- metadata.gz: 695c51c84ca1f193a58263e0d362cd7d3d3bf16f1c7a2d649306c2c8d36ad8ae4e8b6e0408d71a6e0c069073602e8d1b3d9708c9070e461d5784852a460ad790
7
- data.tar.gz: f949d4bcfc454b6178322f5e63d380452a89f31b928d2632ef498f61c3c89f7f8b1001c0aff0e7ea2c83c53844356de16a4b087ae1809b5353dbc8dd100d176b
6
+ metadata.gz: f868b57d54be99ac4a00a7dc47581a1ffe37f5b33c41536d4b0dd326b32377a7a7cb4eaa8740ebda0b363cba30d0a71d4f9c22e0700c9836cb98468f1e40d67c
7
+ data.tar.gz: c2d27be5d0cb74d54499ebfd3b4bc4d0d9cd047a4e5675d5433aa6ccef24bab3e4d156b57bc1ea6c2ae8b04c6f90dc0eacf71b4b73469d60fd821c0e3edeac34
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- >��}� :1��VDX�� �$,����� ��x��$ B���xl�-mMp�݋�޷�# 1�1��`E~Y�w������0���H߮��*%�Y!�Pu�/���I�&�OTG;ծO8m���W 2�YW��+ۺ�i�T��V�w7���("��o�=@�1�?�1÷�y�Ry{e���RL��R�<�.�����E@�8^��;��ԛ�f�$���F�y�,p���������5~�zu;��D
1
+ T��Aӝ����Bdxͮe�Y��Q�ԮeOe��2=�P��҄y������`�X����'�u�Y�IQ6����g)X� fe{�QmLI��?���-�������V�&g4�����M6FB?��wZPI�<��˷{ÐGwJ�f<�G�ky8�?�QHl��ü���,H������^��ձ�1��%"�'S�W�q��%�|�W#j�x�F�C�����1����v9�
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ command :exec do
4
+ desc 'Exec a command on a given pod'
5
+
6
+ action do |context|
7
+ require 'hippo/cli'
8
+ cli = Hippo::CLI.setup(context)
9
+ cli.preflight
10
+
11
+ command = context.args[2]
12
+ if command.nil?
13
+ raise Error, 'Must specify command alias as first argument after `exec`'
14
+ end
15
+
16
+ command = cli.stage.command(command)
17
+ raise Error, "Invalid command alias `#{context.args[2]}`" if command.nil?
18
+
19
+ command_to_run = ([command[:command]] + context.args[3..-1]).join(' ')
20
+
21
+ exec cli.stage.kubectl("exec -it #{command[:target]} -- #{command_to_run}").join(' ')
22
+ end
23
+ end
data/cli/run.rb CHANGED
@@ -12,7 +12,7 @@ command :run do
12
12
  cli = Hippo::CLI.setup(context)
13
13
  cli.preflight
14
14
 
15
- image = cli.stage.images.values.first
15
+ image = cli.stage.images[context.options[:image]] || cli.stage.images.values.first
16
16
  raise Error, "No image exists at #{image.image_url}" unless image.exists?
17
17
 
18
18
  command = context.options[:command] || '/bin/bash'
@@ -36,6 +36,10 @@ module Hippo
36
36
  @options['console']
37
37
  end
38
38
 
39
+ def commands
40
+ @options['commands'] || {}
41
+ end
42
+
39
43
  def config
40
44
  @options['config'] || {}
41
45
  end
@@ -45,6 +45,16 @@ module Hippo
45
45
  @options['config']
46
46
  end
47
47
 
48
+ def command(name)
49
+ base = manifest.commands[name]
50
+ return nil if base.nil?
51
+
52
+ {
53
+ target: base['target'],
54
+ command: decorator.call(base['command'])
55
+ }
56
+ end
57
+
48
58
  def images
49
59
  @images ||= manifest.images.deep_merge(@options['images'] || {}).each_with_object({}) do |(key, image), hash|
50
60
  hash[key] = Image.new(key, image)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hippo
4
- VERSION = '1.2.1'
4
+ VERSION = '1.2.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hippo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
@@ -30,7 +30,7 @@ cert_chain:
30
30
  3wUJNGnT5XYq+qvTqmjkTSTfdGvZCM63C6bGdN5CAyMokGOOatGqyCMAONolWnfC
31
31
  gm3t2GWWrxY=
32
32
  -----END CERTIFICATE-----
33
- date: 2020-02-20 00:00:00.000000000 Z
33
+ date: 2020-02-23 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: encryptor
@@ -143,9 +143,9 @@ files:
143
143
  - bin/hippo
144
144
  - cli/apply_config.rb
145
145
  - cli/apply_services.rb
146
- - cli/console.rb
147
146
  - cli/create.rb
148
147
  - cli/deploy.rb
148
+ - cli/exec.rb
149
149
  - cli/help.rb
150
150
  - cli/init.rb
151
151
  - cli/install.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- command :console do
4
- desc 'Open a console based on the configuration'
5
-
6
- option '-d', '--deployment [NAME]', 'The name of the deployment to use' do |value, options|
7
- options[:deployment] = value.to_s
8
- end
9
-
10
- option '-c', '--command [NAME]', 'The command to run' do |value, options|
11
- options[:command] = value.to_s
12
- end
13
-
14
- action do |context|
15
- require 'hippo/cli'
16
- cli = Hippo::CLI.setup(context)
17
-
18
- if cli.manifest.console.nil?
19
- raise Error, 'No console configuration has been provided in Hippofile'
20
- end
21
-
22
- cli.preflight
23
-
24
- time = Time.now.to_i
25
- deployment_name = context.options[:deployment] || cli.manifest.console['deployment']
26
- command = context.options[:command] || cli.manifest.console['command'] || 'bash'
27
- exec cli.stage.kubectl("exec -it deployment/#{deployment_name} -- #{command}").join(' ')
28
- end
29
- end