ranch-hand 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6008b690f312b7f5966b8f846774db3cf7732ae65ed7bb5f5aa739c99e6e75dc
4
- data.tar.gz: 7c5f3229830e658d2ebfa002562df901791802920459d3f3e88764dd825b4820
3
+ metadata.gz: 739b914a9a3aaa61cbd1ea414310158a5de894f02f93028c6c6927d3dcf4d567
4
+ data.tar.gz: 0166cfe7b29ad795d8f8ee3e0bef4a91bb3fce4e55e2a662ab24e7cf06474596
5
5
  SHA512:
6
- metadata.gz: ad85870f429f70ca11025e5e00e1fd442b935f1683b651c73235dede9b433e16acb3e50c33f389468949717afa2781854c15c926e9e16477db6659fceb7bcc8f
7
- data.tar.gz: b37cd3ad67bf7f34dfb52942b8cc81c643c8654daeaee66263757e2a80a2ce49a6eda5fa6c45ac8841e5d646a8973f2bd792b78dcf0effd1e7f989b52b2001a2
6
+ metadata.gz: d0608be5112035aa5f4ca5e9e7ce1fc570763f485d688541de6c9095bcd3345cf0ce69378c820f60b782f0051b88322e4f7c052960f75db9c18ddffd3be44dc8
7
+ data.tar.gz: 957785da2e00ac1fb0834a9cb9cec97a6ed7628d1c0ad02e458ab1da3fdf76625801b733c1d4439a58ab8d1437d7ab6b3ce80ad09978a4d79417e1e39ff86f72
data/Changelog.md ADDED
@@ -0,0 +1,4 @@
1
+ ### 0.6.0
2
+
3
+ Updates for Ruby 3.0 compat
4
+ - https://rubyreferences.github.io/rubychanges/3.0.html#keyword-arguments-are-now-fully-separated-from-positional-arguments
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Provides a simple interface on top the Rancher CLI and the Kubectl commands to make running commands in pods easier.
6
6
  This is particularily useful when using Kubernetes in a development environment.
7
7
 
8
- ![ranch-hand demo](https://github.com/peregrinator/ranch-hand/raw/master/doc/ranch-hand-demo.gif "Ranch-hand Demo")
8
+ ![ranch-hand demo](https://github.com/peregrinator/ranch-hand/raw/main/doc/ranch-hand-demo.gif "Ranch-hand Demo")
9
9
 
10
10
  ## Installation
11
11
 
data/bin/ranch-hand CHANGED
@@ -14,7 +14,7 @@ module RanchHandCLI
14
14
  version RanchHand::VERSION
15
15
 
16
16
  subcommand_option_handling :normal
17
- arguments :strict
17
+ arguments :loose
18
18
 
19
19
  desc 'Sets up ranch hand'
20
20
  command :setup do |c|
@@ -44,7 +44,7 @@ module RanchHandCLI
44
44
  c.flag [:p, :pod], default_value: config[:pod], desc: "Run command in a specific pod. If used with -g only the pod name can be specified and the command will be run against the first in the group"
45
45
 
46
46
  c.action do |global_options, command_options, args|
47
- RanchHand::KubeCtl.new.exec(**command_options)
47
+ RanchHand::KubeCtl.new.exec(args: args, cmd_options: command_options)
48
48
  end
49
49
  end
50
50
 
@@ -2,26 +2,25 @@ module RanchHand
2
2
  class KubeCtl
3
3
  include RanchHand::Commands
4
4
 
5
- def exec(**options)
6
- options ||= {}
7
- # options = project_config.merge(options)
5
+ def exec(args: [], cmd_options: {})
6
+ args = Array(args)
8
7
 
9
- namespace = options.delete(:namespace)
8
+ namespace = cmd_options.delete(:namespace)
10
9
 
11
- if options[:remove]
10
+ if cmd_options[:remove]
12
11
  remove_command(namespace)
13
- elsif options[:repeat]
12
+ elsif cmd_options[:repeat]
14
13
  repeat_command(namespace)
15
- elsif options[:command]
16
- pod = select_pod(namespace, options)
17
- run_command(namespace, pod, options[:command])
14
+ elsif cmd_options[:command]
15
+ pod = select_pod(namespace, cmd_options)
16
+ run_command(namespace, pod, cmd_options[:command], args)
18
17
  else
19
- choose_command(namespace, options)
18
+ choose_command(namespace, cmd_options)
20
19
  end
21
20
  end
22
21
 
23
- def run_command(namespace, pod, cmd)
24
- system("rancher kubectl -n #{namespace} exec -it #{pod} -- #{cmd}")
22
+ def run_command(namespace, pod, cmd, args=[])
23
+ system("rancher kubectl -n #{namespace} exec -it #{pod} -- #{cmd} #{args.join(' ')}".strip)
25
24
  end
26
25
 
27
26
  def choose_command(namespace, options={})
@@ -176,7 +175,9 @@ module RanchHand
176
175
 
177
176
  def pods(namespace)
178
177
  pods_cmd = "rancher kubectl -n #{namespace} get po"
179
- command(printer: :null).run(pods_cmd).out.split("\n")[1..-1].map{|l| l.split(/\s+/)[0]}
178
+ pods = command(printer: :null).run(pods_cmd).out.split("\n")[1..-1]&.map{|l| l.split(/\s+/)[0]}
179
+
180
+ pods || []
180
181
  end
181
182
 
182
183
  def storage
@@ -1,3 +1,3 @@
1
1
  module RanchHand
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ranch-hand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peregrinator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-31 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,6 +120,7 @@ files:
120
120
  - ".rspec"
121
121
  - ".travis.yml"
122
122
  - CODE_OF_CONDUCT.md
123
+ - Changelog.md
123
124
  - Gemfile
124
125
  - LICENSE.txt
125
126
  - README.md