rcmd 1.6.1 → 1.6.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
  SHA1:
3
- metadata.gz: e4563953aff83897f4899328c3f000498ab4f100
4
- data.tar.gz: d2bb4812cc89cd48309d2a7ed7064cb15b1b8141
3
+ metadata.gz: b8542fc87d941f9ed35d452d2ec13e2768d64ab7
4
+ data.tar.gz: ec6a1802464731852d3abcb4f19885e290f28940
5
5
  SHA512:
6
- metadata.gz: 45e1753421d2c0bb26679f0415952dc8a4c359911746a9b55e341a61b5192107c7a970615be82043f7b4855543c895bf65ab720ee05a117ea8b61abd156f957f
7
- data.tar.gz: f278680296d128fce092b4f1d3472bf55a5bbf01cd14b900a6d9e84a297aafa193ffca5797909878bedaa5ce5520f29199d584d71ca400da4912d50b6b3afc40
6
+ metadata.gz: 520f19d927f6a119f45055d231684549448b9d53091c18fc395dc02cdc1ca8e655516b8342b3b073b75b2125bc53ea308eb5e9f2c3d63366207718c5dddff4f4
7
+ data.tar.gz: 040ae8d280f7b230a636827db280910b86e29e5ebfc98663972e0bcc305d37e1ffa3f99bc1bf476afb84904318b3374f2dc8b370c3d9963e496b0053de20e1ad
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rcmd (1.6.1)
5
- activerecord (= 4.0.0)
4
+ rcmd (1.6.2)
5
+ activerecord (= 4.2.6)
6
+ activesupport (= 4.2.6)
6
7
  io-console
7
8
  net-ssh
8
9
  regexp-examples
@@ -12,30 +13,28 @@ PATH
12
13
  GEM
13
14
  remote: https://rubygems.org/
14
15
  specs:
15
- activemodel (4.0.0)
16
- activesupport (= 4.0.0)
17
- builder (~> 3.1.0)
18
- activerecord (4.0.0)
19
- activemodel (= 4.0.0)
20
- activerecord-deprecated_finders (~> 1.0.2)
21
- activesupport (= 4.0.0)
22
- arel (~> 4.0.0)
23
- activerecord-deprecated_finders (1.0.4)
24
- activesupport (4.0.0)
25
- i18n (~> 0.6, >= 0.6.4)
26
- minitest (~> 4.2)
27
- multi_json (~> 1.3)
28
- thread_safe (~> 0.1)
29
- tzinfo (~> 0.3.37)
30
- arel (4.0.2)
31
- builder (3.1.4)
16
+ activemodel (4.2.6)
17
+ activesupport (= 4.2.6)
18
+ builder (~> 3.1)
19
+ activerecord (4.2.6)
20
+ activemodel (= 4.2.6)
21
+ activesupport (= 4.2.6)
22
+ arel (~> 6.0)
23
+ activesupport (4.2.6)
24
+ i18n (~> 0.7)
25
+ json (~> 1.7, >= 1.7.7)
26
+ minitest (~> 5.1)
27
+ thread_safe (~> 0.3, >= 0.3.4)
28
+ tzinfo (~> 1.1)
29
+ arel (6.0.4)
30
+ builder (3.2.3)
32
31
  diff-lcs (1.3)
33
32
  equatable (0.5.0)
34
33
  hitimes (1.2.6)
35
34
  i18n (0.8.6)
36
35
  io-console (0.4.6)
37
- minitest (4.7.5)
38
- multi_json (1.12.2)
36
+ json (1.8.6)
37
+ minitest (5.10.3)
39
38
  necromancer (0.4.0)
40
39
  net-ssh (4.2.0)
41
40
  pastel (0.7.1)
@@ -70,14 +69,15 @@ GEM
70
69
  tty-reader (~> 0.1.0)
71
70
  tty-reader (0.1.0)
72
71
  wisper (~> 2.0.0)
73
- tzinfo (0.3.53)
72
+ tzinfo (1.2.3)
73
+ thread_safe (~> 0.1)
74
74
  wisper (2.0.0)
75
75
 
76
76
  PLATFORMS
77
77
  ruby
78
78
 
79
79
  DEPENDENCIES
80
- bundler (~> 1.15)
80
+ bundler (>= 1.0)
81
81
  rake (~> 10.0)
82
82
  rcmd!
83
83
  rspec (~> 3.0, >= 2.0.0)
data/README.md CHANGED
@@ -30,6 +30,12 @@ Usage: rcmd [options]
30
30
  -q, --quiet Suppress stdout of commands. stderr will still be displayed
31
31
  -v, --version Print what version of the command is in use
32
32
  -D, --debug Print debug information
33
+
34
+ Database Options
35
+ -C, --create-config Create template dbconfig file in ~/.rcmd
36
+ -T, --type server-type Database query on server type
37
+ -H, --host hostname-pattern Database query on hostname (sql like query)
38
+ -O, --os operating-system Database query on Operating System string
33
39
  ```
34
40
 
35
41
  ## Specifying nodes manually
@@ -73,6 +79,71 @@ node9 :: node9.example.com
73
79
  node12 :: node12.example.com
74
80
  ```
75
81
 
82
+ ## Database backend support
83
+ The database backend support is provided by ActiveRecord and thus
84
+ compatible with databases which are supported by ActiveRecord.
85
+ Currently the ActiveRecord version is locked to 4.0.0 in the Gemspec
86
+ due to compatibilty issues with RHEL, CentOS, and Mac OSx to name a
87
+ few.
88
+
89
+ To set up the database backend run rcmd with the '-C' switch first.
90
+ This will create a database configuration file in ~/.rcmd named
91
+ dbconfig.yml. In this file you can specify the adapter, and various
92
+ other soptions for the database backend. For the queries to work
93
+ properly, the :host_field: *MUST* be set so the command knows what
94
+ column contains the host name.
95
+
96
+ Two optional fields exist as well, which are type_field and os_field.
97
+ While these are meant to represent "Server type (I.e. Web, DB, etc)
98
+ and Operating System Name/version, you can map these to whatever
99
+ fields you would like to be able to sort by. If these fields are not
100
+ specified then using the associated command line options will result
101
+ in a run time error.
102
+
103
+ To minimize the size and possible issues with various backend
104
+ adapters, no adapters are listed/installed when installing this Gem.
105
+ It is up to you to install the correct adapter for the database you
106
+ are wanting to connect to.
107
+
108
+ The '-T' and '-O' options use strict matching in their queries where
109
+ as the '-H' option uses a 'LIKE' query.
110
+
111
+ ### Database backend examples
112
+
113
+ Hostname query (Match all systems whose hostname starts with node and contains at least two additional charectors):
114
+ ```bash
115
+ daibhidh@darkstar:~/$ rcmd -H 'node%_' -c 'hostname -f'
116
+ node20 :: node20.example.com
117
+ node10 :: node10.example.com
118
+ node12 :: node12.example.com
119
+ node13 :: node13.example.com
120
+ node15 :: node15.example.com
121
+ node16 :: node16.example.com
122
+ node18 :: node18.example.com
123
+ node17 :: node17.example.com
124
+ node11 :: node11.example.com
125
+ node19 :: node19.example.com
126
+ node14 :: node14.example.com
127
+ ```
128
+
129
+ Type query (Match all hosts listed as web servers):
130
+ ```bash
131
+ daibhidh@darkstar:~/$ rcmd -T 'web' -c 'hostname -f'
132
+ node11 :: node11.example.com
133
+ node19 :: node19.example.com
134
+ node14 :: node14.example.com
135
+ ```
136
+
137
+ OS query (Match all hosts listed as running slackware):
138
+ ```bash
139
+ daibhidh@darkstar:~/$ rcmd -o 'slackware' -c 'hostname -f'
140
+ node10 :: node10.example.com
141
+ node12 :: node12.example.com
142
+ node18 :: node18.example.com
143
+ node17 :: node17.example.com
144
+ node11 :: node11.example.com
145
+ ```
146
+
76
147
  # Development
77
148
 
78
149
  If you are wanting to modify the code by all means do so. If you clone this repository you can then run `bundle install` to install the dependencies needed. Tests are performed with *rspec* and can be run with *rake*.
@@ -64,6 +64,8 @@
64
64
  <li><a href="#label-Specifying+nodes+manually">Specifying nodes manually</a>
65
65
  <li><a href="#label-Piping+list+of+nodes">Piping list of nodes</a>
66
66
  <li><a href="#label-Using+regex+to+build+node+list">Using regex to build node list</a>
67
+ <li><a href="#label-Database+backend+support">Database backend support</a>
68
+ <li><a href="#label-Database+backend+examples">Database backend examples</a>
67
69
  <li><a href="#label-Development">Development</a>
68
70
  </ul>
69
71
  </div>
@@ -125,7 +127,13 @@ rcmd</code></p>
125
127
  -c, --command &lt;command&gt; Quoted string containing the command to be run
126
128
  -q, --quiet Suppress stdout of commands. stderr will still be displayed
127
129
  -v, --version Print what version of the command is in use
128
- -D, --debug Print debug information</pre>
130
+ -D, --debug Print debug information
131
+
132
+ Database Options
133
+ -C, --create-config Create template dbconfig file in ~/.rcmd
134
+ -T, --type server-type Database query on server type
135
+ -H, --host hostname-pattern Database query on hostname (sql like query)
136
+ -O, --os operating-system Database query on Operating System string</pre>
129
137
 
130
138
  <h2 id="label-Specifying+nodes+manually">Specifying nodes manually<span><a href="#label-Specifying+nodes+manually">&para;</a> <a href="#top">&uarr;</a></span></h2>
131
139
 
@@ -166,6 +174,56 @@ node11 :: CONNECT ERROR :: Unable to connect to host!
166
174
  node9 :: node9.example.com
167
175
  node12 :: node12.example.com</pre>
168
176
 
177
+ <h2 id="label-Database+backend+support">Database backend support<span><a href="#label-Database+backend+support">&para;</a> <a href="#top">&uarr;</a></span></h2>
178
+
179
+ <p>The database backend support is provided by ActiveRecord and thus
180
+ compatible with databases which are supported by ActiveRecord. Currently
181
+ the ActiveRecord version is locked to 4.0.0 in the Gemspec due to
182
+ compatibilty issues with RHEL, CentOS, and Mac OSx to name a few.</p>
183
+
184
+ <p>To set up the database backend run rcmd with the &#39;-C&#39; switch first.
185
+ This will create a database configuration file in ~/.rcmd named
186
+ dbconfig.yml. In this file you can specify the adapter, and various other
187
+ soptions for the database backend. For the queries to work properly, the
188
+ :host_field: <em>MUST</em> be set so the command knows what column contains
189
+ the host name.</p>
190
+
191
+ <p>Two optional fields exist as well, which are type_field and os_field. While
192
+ these are meant to represent “Server type (I.e. Web, DB, etc) and Operating
193
+ System Name/version, you can map these to whatever fields you would like to
194
+ be able to sort by. If these fields are not specified then using the
195
+ associated command line options will result in a run time error.</p>
196
+
197
+ <p>To minimize the size and possible issues with various backend adapters, no
198
+ adapters are listed/installed when installing this Gem. It is up to you to
199
+ install the correct adapter for the database you are wanting to connect to.</p>
200
+
201
+ <p>The &#39;-T&#39; and &#39;-O&#39; options use strict matching in their
202
+ queries where as the &#39;-H&#39; option uses a &#39;LIKE&#39; query.</p>
203
+
204
+ <h3 id="label-Database+backend+examples">Database backend examples<span><a href="#label-Database+backend+examples">&para;</a> <a href="#top">&uarr;</a></span></h3>
205
+
206
+ <p>Hostname query (Match all systems whose hostname starts with node and
207
+ contains at least two additional charectors): <code>bash
208
+ daibhidh@darkstar:~/$ rcmd -H &#39;node%_&#39; -c &#39;hostname -f&#39;
209
+ node20 :: node20.example.com node10 :: node10.example.com node12 ::
210
+ node12.example.com node13 :: node13.example.com node15 ::
211
+ node15.example.com node16 :: node16.example.com node18 ::
212
+ node18.example.com node17 :: node17.example.com node11 ::
213
+ node11.example.com node19 :: node19.example.com node14 ::
214
+ node14.example.com </code></p>
215
+
216
+ <p>Type query (Match all hosts listed as web servers): <code>bash
217
+ daibhidh@darkstar:~/$ rcmd -T &#39;web&#39; -c &#39;hostname -f&#39; node11
218
+ :: node11.example.com node19 :: node19.example.com node14 ::
219
+ node14.example.com </code></p>
220
+
221
+ <p>OS query (Match all hosts listed as running slackware): <code>bash
222
+ daibhidh@darkstar:~/$ rcmd -o &#39;slackware&#39; -c &#39;hostname -f&#39;
223
+ node10 :: node10.example.com node12 :: node12.example.com node18 ::
224
+ node18.example.com node17 :: node17.example.com node11 ::
225
+ node11.example.com </code></p>
226
+
169
227
  <h1 id="label-Development">Development<span><a href="#label-Development">&para;</a> <a href="#top">&uarr;</a></span></h1>
170
228
 
171
229
  <p>If you are wanting to modify the code by all means do so. If you clone this
@@ -1,6 +1,6 @@
1
- Fri, 06 Oct 2017 20:18:52 +0000
2
- README.md Wed, 04 Oct 2017 13:14:39 +0000
3
- lib/rcmd.rb Fri, 06 Oct 2017 19:05:45 +0000
4
- lib/rcmd/db.rb Fri, 06 Oct 2017 20:07:48 +0000
5
- lib/rcmd/version.rb Fri, 06 Oct 2017 19:04:22 +0000
6
- exe/rcmd Fri, 06 Oct 2017 19:36:13 +0000
1
+ Fri, 06 Oct 2017 22:12:36 +0000
2
+ README.md Fri, 06 Oct 2017 22:09:32 +0000
3
+ lib/rcmd.rb Fri, 06 Oct 2017 20:23:25 +0000
4
+ lib/rcmd/db.rb Fri, 06 Oct 2017 20:23:25 +0000
5
+ lib/rcmd/version.rb Fri, 06 Oct 2017 22:10:08 +0000
6
+ exe/rcmd Fri, 06 Oct 2017 21:52:54 +0000
@@ -123,7 +123,13 @@ rcmd</code></p>
123
123
  -c, --command &lt;command&gt; Quoted string containing the command to be run
124
124
  -q, --quiet Suppress stdout of commands. stderr will still be displayed
125
125
  -v, --version Print what version of the command is in use
126
- -D, --debug Print debug information</pre>
126
+ -D, --debug Print debug information
127
+
128
+ Database Options
129
+ -C, --create-config Create template dbconfig file in ~/.rcmd
130
+ -T, --type server-type Database query on server type
131
+ -H, --host hostname-pattern Database query on hostname (sql like query)
132
+ -O, --os operating-system Database query on Operating System string</pre>
127
133
 
128
134
  <h2 id="label-Specifying+nodes+manually">Specifying nodes manually<span><a href="#label-Specifying+nodes+manually">&para;</a> <a href="#top">&uarr;</a></span></h2>
129
135
 
@@ -164,6 +170,56 @@ node11 :: CONNECT ERROR :: Unable to connect to host!
164
170
  node9 :: node9.example.com
165
171
  node12 :: node12.example.com</pre>
166
172
 
173
+ <h2 id="label-Database+backend+support">Database backend support<span><a href="#label-Database+backend+support">&para;</a> <a href="#top">&uarr;</a></span></h2>
174
+
175
+ <p>The database backend support is provided by ActiveRecord and thus
176
+ compatible with databases which are supported by ActiveRecord. Currently
177
+ the ActiveRecord version is locked to 4.0.0 in the Gemspec due to
178
+ compatibilty issues with RHEL, CentOS, and Mac OSx to name a few.</p>
179
+
180
+ <p>To set up the database backend run rcmd with the &#39;-C&#39; switch first.
181
+ This will create a database configuration file in ~/.rcmd named
182
+ dbconfig.yml. In this file you can specify the adapter, and various other
183
+ soptions for the database backend. For the queries to work properly, the
184
+ :host_field: <em>MUST</em> be set so the command knows what column contains
185
+ the host name.</p>
186
+
187
+ <p>Two optional fields exist as well, which are type_field and os_field. While
188
+ these are meant to represent “Server type (I.e. Web, DB, etc) and Operating
189
+ System Name/version, you can map these to whatever fields you would like to
190
+ be able to sort by. If these fields are not specified then using the
191
+ associated command line options will result in a run time error.</p>
192
+
193
+ <p>To minimize the size and possible issues with various backend adapters, no
194
+ adapters are listed/installed when installing this Gem. It is up to you to
195
+ install the correct adapter for the database you are wanting to connect to.</p>
196
+
197
+ <p>The &#39;-T&#39; and &#39;-O&#39; options use strict matching in their
198
+ queries where as the &#39;-H&#39; option uses a &#39;LIKE&#39; query.</p>
199
+
200
+ <h3 id="label-Database+backend+examples">Database backend examples<span><a href="#label-Database+backend+examples">&para;</a> <a href="#top">&uarr;</a></span></h3>
201
+
202
+ <p>Hostname query (Match all systems whose hostname starts with node and
203
+ contains at least two additional charectors): <code>bash
204
+ daibhidh@darkstar:~/$ rcmd -H &#39;node%_&#39; -c &#39;hostname -f&#39;
205
+ node20 :: node20.example.com node10 :: node10.example.com node12 ::
206
+ node12.example.com node13 :: node13.example.com node15 ::
207
+ node15.example.com node16 :: node16.example.com node18 ::
208
+ node18.example.com node17 :: node17.example.com node11 ::
209
+ node11.example.com node19 :: node19.example.com node14 ::
210
+ node14.example.com </code></p>
211
+
212
+ <p>Type query (Match all hosts listed as web servers): <code>bash
213
+ daibhidh@darkstar:~/$ rcmd -T &#39;web&#39; -c &#39;hostname -f&#39; node11
214
+ :: node11.example.com node19 :: node19.example.com node14 ::
215
+ node14.example.com </code></p>
216
+
217
+ <p>OS query (Match all hosts listed as running slackware): <code>bash
218
+ daibhidh@darkstar:~/$ rcmd -o &#39;slackware&#39; -c &#39;hostname -f&#39;
219
+ node10 :: node10.example.com node12 :: node12.example.com node18 ::
220
+ node18.example.com node17 :: node17.example.com node11 ::
221
+ node11.example.com </code></p>
222
+
167
223
  <h1 id="label-Development">Development<span><a href="#label-Development">&para;</a> <a href="#top">&uarr;</a></span></h1>
168
224
 
169
225
  <p>If you are wanting to modify the code by all means do so. If you clone this
Binary file
@@ -37,6 +37,8 @@
37
37
  <li><a href="README_md.html#label-Specifying+nodes+manually">Specifying nodes manually</a>
38
38
  <li><a href="README_md.html#label-Piping+list+of+nodes">Piping list of nodes</a>
39
39
  <li><a href="README_md.html#label-Using+regex+to+build+node+list">Using regex to build node list</a>
40
+ <li><a href="README_md.html#label-Database+backend+support">Database backend support</a>
41
+ <li><a href="README_md.html#label-Database+backend+examples">Database backend examples</a>
40
42
  <li><a href="README_md.html#label-Development">Development</a>
41
43
  </ul>
42
44
  </li>
data/exe/rcmd CHANGED
@@ -36,7 +36,7 @@ opts.separator "Database Options"
36
36
  opts.on('-C', '--create-config', "Create template dbconfig file in ~/.rcmd") { |v| options[:config] = v}
37
37
  opts.on('-T server-type ', '--type server-type', "Database query on server type") { |v| options[:type] = v}
38
38
  opts.on('-H hostname-pattern', '--host hostname-pattern', "Database query on hostname (sql like query)") { |v| options[:host] = v}
39
- opts.on('-O operating-system', '--os operating-system", "Database query on Operating System string') { |v| options[:os] = v}
39
+ opts.on('-O operating-system', '--os operating-system', "Database query on Operating System string") { |v| options[:os] = v}
40
40
 
41
41
  # Process options
42
42
  begin
@@ -1,4 +1,4 @@
1
1
  module Rcmd # :notnew:
2
2
  # +VERSION+ - Version number string
3
- VERSION = "1.6.1"
3
+ VERSION = "1.6.2"
4
4
  end
@@ -36,9 +36,10 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency('io-console')
37
37
  spec.add_runtime_dependency('thread')
38
38
  spec.add_runtime_dependency('tty-prompt')
39
- spec.add_runtime_dependency('activerecord', '= 4.0.0')
39
+ spec.add_runtime_dependency('activesupport', '= 4.2.6')
40
+ spec.add_runtime_dependency('activerecord', '= 4.2.6')
40
41
  spec.add_runtime_dependency('regexp-examples')
41
42
  spec.add_development_dependency('rspec', '~> 3.0', '>= 2.0.0')
42
- spec.add_development_dependency "bundler", "~> 1.15"
43
+ spec.add_development_dependency "bundler", ">= 1.0"
43
44
  spec.add_development_dependency "rake", "~> 10.0"
44
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rose
@@ -66,20 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 4.2.6
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 4.2.6
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: activerecord
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - '='
74
88
  - !ruby/object:Gem::Version
75
- version: 4.0.0
89
+ version: 4.2.6
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - '='
81
95
  - !ruby/object:Gem::Version
82
- version: 4.0.0
96
+ version: 4.2.6
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: regexp-examples
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -118,16 +132,16 @@ dependencies:
118
132
  name: bundler
119
133
  requirement: !ruby/object:Gem::Requirement
120
134
  requirements:
121
- - - "~>"
135
+ - - ">="
122
136
  - !ruby/object:Gem::Version
123
- version: '1.15'
137
+ version: '1.0'
124
138
  type: :development
125
139
  prerelease: false
126
140
  version_requirements: !ruby/object:Gem::Requirement
127
141
  requirements:
128
- - - "~>"
142
+ - - ">="
129
143
  - !ruby/object:Gem::Version
130
- version: '1.15'
144
+ version: '1.0'
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: rake
133
147
  requirement: !ruby/object:Gem::Requirement