sshkit 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .yardoc
3
3
  .vagrant
4
4
  test/tmp
5
+ Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -3,6 +3,35 @@
3
3
  This file is written in reverse chronological order, newer releases will
4
4
  appear at the top.
5
5
 
6
+ ## 0.0.6
7
+
8
+ * Support arbitrary properties on Host objects. (see below)
9
+
10
+ Starting with this version, the `Host` class supports arbitrary properties,
11
+ here's a proposed use-case:
12
+
13
+ servers = %w{one.example.com two.example.com
14
+ three.example.com four.example.com}.collect do |s|
15
+ h = SSHKit::Host.new(s)
16
+ if s.match /(one|two)/
17
+ h.properties.roles = [:web]
18
+ else
19
+ h.properties.roles = [:app]
20
+ end
21
+ end
22
+
23
+ on servers do |host|
24
+ if host.properties.roles.include?(:web)
25
+ # Do something pertinent to web servers
26
+ elsif host.properties.roles.include?(:app)
27
+ # Do something pertinent to application servers
28
+ end
29
+ end
30
+
31
+ Naturally, this is a contrived example, the `#properties` attribute on the
32
+ Host instance is implemented as an [`OpenStruct`](http://ruby-doc.org/stdlib-1.9.3/libdoc/ostruct/rdoc/OpenStruct.html) and
33
+ will behave exactly as such.
34
+
6
35
  ## 0.0.5
7
36
 
8
37
  * Removed configuration option `SSHKit.config.format` (see below)
data/EXAMPLES.md CHANGED
@@ -198,3 +198,29 @@ match.
198
198
 
199
199
  You might also look at `./lib/sshkit/dsl.rb` where you can see almost the
200
200
  exact code as above, which implements the `on()` method.
201
+
202
+ ## Use the Host properties attribute
203
+
204
+ Implemented since `v0.0.6`
205
+
206
+ servers = %w{one.example.com two.example.com
207
+ three.example.com four.example.com}.collect do |s|
208
+ h = SSHKit::Host.new(s)
209
+ if s.match /(one|two)/
210
+ h.properties.roles = [:web]
211
+ else
212
+ h.properties.roles = [:app]
213
+ end
214
+ end
215
+
216
+ on servers do |host|
217
+ if host.properties.roles.include?(:web)
218
+ # Do something pertinent to web servers
219
+ elsif host.properties.roles.include?(:app)
220
+ # Do something pertinent to application servers
221
+ end
222
+ end
223
+
224
+ The `SSHKit::Host#properties` is an [`OpenStruct`](http://ruby-doc.org/stdlib-1.9.3/libdoc/ostruct/rdoc/OpenStruct.html)
225
+ which is not verified or validated in any way, it is up to you, or your
226
+ library to attach meanings or conventions to this mechanism.
data/README.md CHANGED
@@ -181,8 +181,8 @@ should be printed.
181
181
  * No built-in way to background() something (execute and background the
182
182
  process).
183
183
  * No environment handling (sshkit might not need to care)
184
- * No arbitrary `Host` properties (example storing `roles` on servers, or other
185
- metadata that might be useful in the `on()` block)
184
+ * ~~No arbitrary `Host` properties (example storing `roles` on servers, or other
185
+ metadata that might be useful in the `on()` block)~~
186
186
  * No log/warning facility (passing Log messages to the output would work)
187
187
  A log object could be made available globally which would emit a LogMessage
188
188
  type object which would be recognised by the formatters that need to care
@@ -1,3 +1,3 @@
1
1
  module SSHKit
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -227,7 +227,6 @@ files:
227
227
  - EXAMPLES.md
228
228
  - FAQ.md
229
229
  - Gemfile
230
- - Gemfile.lock
231
230
  - LICENSE.md
232
231
  - README.md
233
232
  - RELEASING.md
data/Gemfile.lock DELETED
@@ -1,69 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- sshkit (0.0.5)
5
- net-ssh
6
- term-ansicolor
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- ZenTest (4.6.2)
12
- ansi (1.4.3)
13
- archive-tar-minitar (0.5.2)
14
- autotest (4.4.6)
15
- ZenTest (>= 4.4.1)
16
- childprocess (0.3.6)
17
- ffi (~> 1.0, >= 1.0.6)
18
- columnize (0.3.6)
19
- debugger (1.2.3)
20
- columnize (>= 0.3.1)
21
- debugger-linecache (~> 1.1.1)
22
- debugger-ruby_core_source (~> 1.1.5)
23
- debugger-linecache (1.1.2)
24
- debugger-ruby_core_source (>= 1.1.1)
25
- debugger-ruby_core_source (1.1.6)
26
- erubis (2.7.0)
27
- ffi (1.2.0)
28
- i18n (0.6.1)
29
- json (1.5.4)
30
- log4r (1.1.10)
31
- metaclass (0.0.1)
32
- minitest (2.11.3)
33
- mocha (0.10.5)
34
- metaclass (~> 0.0.1)
35
- net-scp (1.0.4)
36
- net-ssh (>= 1.99.1)
37
- net-ssh (2.2.2)
38
- rake (10.0.3)
39
- redcarpet (2.2.2)
40
- term-ansicolor (1.0.7)
41
- turn (0.9.6)
42
- ansi
43
- unindent (1.0)
44
- vagrant (1.0.5)
45
- archive-tar-minitar (= 0.5.2)
46
- childprocess (~> 0.3.1)
47
- erubis (~> 2.7.0)
48
- i18n (~> 0.6.0)
49
- json (~> 1.5.1)
50
- log4r (~> 1.1.9)
51
- net-scp (~> 1.0.4)
52
- net-ssh (~> 2.2.2)
53
- yard (0.8.3)
54
-
55
- PLATFORMS
56
- ruby
57
-
58
- DEPENDENCIES
59
- autotest
60
- debugger
61
- minitest (>= 2.11.3, < 2.12.0)
62
- mocha
63
- rake
64
- redcarpet
65
- sshkit!
66
- turn
67
- unindent
68
- vagrant
69
- yard