koma 0.11.0 → 0.12.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
  SHA1:
3
- metadata.gz: 81a82ab20cf42d0d1961a641f0694c9e1e5ae68f
4
- data.tar.gz: 44d1c6c6180fe5adeac4ceaf7da558fef6d9aff6
3
+ metadata.gz: e32b642be41676c51afc7f85a8b59b5187de12bb
4
+ data.tar.gz: e3756595e53e4524f36622e1f270e5aa69711789
5
5
  SHA512:
6
- metadata.gz: add6325fa9970357a34053e2c90fac65ed276cfed461d69576d08237cef832cdc41a6e012ffb2e1c7e90ca0b32278f5df3dccd37938c602d7db89aac711baa95
7
- data.tar.gz: 55faa2f2c085b3f4db78743bb6dc9acaabc5b87ea7b50832645f366b90ef87707492803ab3428aeb02f821b276d98df3b13f58b2f9ceb164c024f49f7fa18d1a
6
+ metadata.gz: 644d63e5d096efe79533342e9631873b7249d0c665d9ad081bccddd6adae20e51a849bf7890c9e9bb99e00dd5a8df6947b9b7507f11991820aab85f93b119486
7
+ data.tar.gz: 34892ac818069131b3d9e9576a29c4894bc9a007c5d6104989743e9163044732d3ffb891a512a2cac726e72b7c95066fd2ba610526252293b2360afbfb04b20b
data/README.md CHANGED
@@ -24,6 +24,8 @@ $ gem install koma
24
24
 
25
25
  ## Usage
26
26
 
27
+ ### Gather remote host inventory
28
+
27
29
  If you login remote server via `ssh example.com`, you can execute:
28
30
 
29
31
  ```sh
@@ -32,6 +34,12 @@ $ koma ssh example.com
32
34
 
33
35
  And gather host inventory stdout like [this](stdout_sample.json).
34
36
 
37
+ ### Gather local host inventory
38
+
39
+ ```sh
40
+ $ koma exec
41
+ ```
42
+
35
43
  ### Gather host inventory from multiple hosts
36
44
 
37
45
  ```sh
@@ -78,6 +86,29 @@ Gather vagrant host inventory.
78
86
  $ vagrant ssh-config | koma ssh --key cpu,kernel
79
87
  ```
80
88
 
89
+ ### Run command on remote hosts
90
+
91
+ ```sh
92
+ $ koma run-command example.com,example.jp uptime
93
+ {
94
+ "example.com": {
95
+ "uptime": {
96
+ "exit_signal": null,
97
+ "exit_status": 0,
98
+ "stderr": "",
99
+ "stdout": " 00:18:10 up 337 days, 4:51, 1 user, load average: 0.08, 0.02, 0.01\n"
100
+ }
101
+ },
102
+ "example.jp": {
103
+ "uptime": {
104
+ "exit_signal": null,
105
+ "exit_status": 0,
106
+ "stderr": "",
107
+ "stdout": " 00:10:09 up 182 days, 7:34, 1 user, load average: 0.07, 0.03, 0.01\n"
108
+ }
109
+ }
110
+ }
111
+ ```
81
112
 
82
113
  ## Host inventory keys
83
114
 
@@ -17,7 +17,7 @@ class Koma::Backend::Base
17
17
  key.split(',')
18
18
  end
19
19
  Koma::HostInventory.disabled_keys.each do |k|
20
- keys.push(k) if @options["with-#{k}"]
20
+ keys.push(k) if @options["enable-#{k}"]
21
21
  end
22
22
 
23
23
  keys.each do |k|
@@ -4,13 +4,15 @@ require 'yaml'
4
4
 
5
5
  module Koma
6
6
  class CLI < Thor
7
+ class_option :version, type: :boolean, aliases: :V
8
+
7
9
  desc 'ssh <host1,host2,..>', 'stdout remote host inventory'
8
10
  option :key, type: :string, banner: '<key1,key2,..>', desc: 'inventory keys', aliases: :k
9
11
  option :yaml, type: :boolean, desc: 'stdout YAML', aliases: :Y
10
12
  option :identity_file, type: :string, banner: '<identity_file>', desc: 'identity file', aliases: :i
11
13
  option :port, type: :numeric, banner: '<port>', desc: 'port', aliases: :p
12
14
  Koma::HostInventory.disabled_keys.each do |key|
13
- option "with-#{key}", type: :boolean, desc: "enable #{key}"
15
+ option "enable-#{key}", type: :boolean, desc: "enable #{key}"
14
16
  end
15
17
  def ssh(host = nil)
16
18
  if host.nil?
@@ -34,7 +36,7 @@ module Koma
34
36
  end
35
37
  end
36
38
 
37
- desc 'run-command <host1,host2,..> <command1> <command2> ...', 'run command on a remote machine'
39
+ desc 'run-command <host1,host2,..> <command1> <command2> ...', 'run command on remote hosts'
38
40
  option :yaml, type: :boolean, desc: 'stdout YAML', aliases: :Y
39
41
  option :identity_file, type: :string, banner: '<identity_file>', desc: 'identity file', aliases: :i
40
42
  option :port, type: :numeric, banner: '<port>', desc: 'port', aliases: :p
@@ -75,7 +77,7 @@ module Koma
75
77
  option :key, type: :string, banner: '<key1,key2,..>', desc: 'inventory keys', aliases: :k
76
78
  option :yaml, type: :boolean, desc: 'stdout YAML', aliases: :Y
77
79
  Koma::HostInventory.disabled_keys.each do |key|
78
- option "with-#{key}", type: :boolean, desc: "enable #{key}"
80
+ option "enable-#{key}", type: :boolean, desc: "enable #{key}"
79
81
  end
80
82
  def exec
81
83
  backend = Koma::Backend::Exec.new(nil, options)
@@ -94,9 +96,8 @@ module Koma
94
96
  end
95
97
  end
96
98
 
97
- option :version, type: :boolean, aliases: :V
98
- def help(version = nil)
99
- if version
99
+ def help(command = nil)
100
+ if options[:version]
100
101
  puts Koma::VERSION
101
102
  else
102
103
  super
@@ -1,3 +1,3 @@
1
1
  module Koma
2
- VERSION = '0.11.0'
2
+ VERSION = '0.12.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor