serverspec-runner 0.1.4 → 0.1.5

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: 8bbdaab098b4ab210d5f3990c4a2fa59b34740da
4
- data.tar.gz: 6f9b74bd39f704d32ba75a77245df1e0cd65bd8c
3
+ metadata.gz: 823e68555ca8c2499cfa43632b38acee4adf578c
4
+ data.tar.gz: ab87834f25d30b4164741b2b7529255ddc1dcc9c
5
5
  SHA512:
6
- metadata.gz: 336d14453ead53ea80583ddddb2ff3dfcb2431251c81e2b9bb67bbd5bd464369fee8abb8b28ffffc2fa0a226a0dc18085b1a3bd63abfead11ad9b932557c6b5c
7
- data.tar.gz: a44f9de7fb360df996945e68eb20355247610bc72eb7ee438555bd1d8422d78d6e9ea8fa98411eb7b596a0a255be56680f88088a65c3a8bf1a5d9511cd6c5282
6
+ metadata.gz: 048b817e190b480eb1dcfcfceef09a2355a3cbe553bf581c07076b4189fd742073ec36bd5f57999dcff59eca29b059a1341aeaceb3ed1db88166a1de6c0397fa
7
+ data.tar.gz: d3f4dc098e12f3755596438fd2c7f47092e3076ded153b445772cb2518798f14d4c336bc219ad6236e873e77ea8ee4167ec7a48c67e0692b2d03a52aaefde801
data/README.md CHANGED
@@ -19,13 +19,14 @@ initialize spec direcotries and create skeleton-specfiles.
19
19
 
20
20
  Edit your [spec-files](http://serverspec.org/resource_types.html).
21
21
 
22
- $ vim /path/to/your_serverspec_root/test_name/test_sub_name/your_serverspec_test.rb
22
+ $ vim /path/to/your_serverspec_root/test_top_dir/.../your_serverspec_test.rb
23
23
 
24
24
  Edit your infrastructure or middleware tests scenario to "scenario.yml".
25
25
 
26
26
  ```
27
- test_name: # test directory name
28
- test_sub_name: # test sub directory name(not required)
27
+ test_top_dir: # test directory top
28
+ : # test hierarchy directories
29
+ test_bottom_dir: # test directory bottom
29
30
  - servername # ssh-accessible ip address or fqdn. or alias
30
31
  - :
31
32
  - :
@@ -54,7 +55,72 @@ You can also specify [ssh_options.yml](http://net-ssh.github.io/net-ssh/classes/
54
55
 
55
56
  $ serverspec-runner -s /path/to/your_scenario.yml -o /path/to/your_ssh_options.yml
56
57
 
57
- <!-- See details to [here](http://serverspec.org/) -->
58
+ For example. You write serverspec code like this.
59
+
60
+ ```
61
+ describe "nginx" do
62
+ describe "check install" do
63
+ describe package('nginx') do
64
+ it { should be_installed }
65
+ end
66
+ end
67
+
68
+ describe "check running" do
69
+ describe process('nginx') do
70
+ it { should be_running }
71
+ end
72
+ end
73
+
74
+ describe "check process" do
75
+ describe process('nginx') do
76
+ it { should be_enabled }
77
+ end
78
+ end
79
+
80
+ describe "worker_connection:1024" do
81
+ describe file('/etc/nginx/nginx.conf') do
82
+ it { should contain "worker_connections 1024;" }
83
+ end
84
+ end
85
+
86
+ describe "logrotate interval" do
87
+ describe file('/etc/logrotate.d/nginx') do
88
+ it { should contain "rotate 14" }
89
+ end
90
+ end
91
+ end
92
+ ```
93
+
94
+ You can get the following outputs.
95
+
96
+ ```
97
+ +------------------------------------------+
98
+ |description | result |
99
+ +------------------------------------------+
100
+ |example@anyhost-01(172.30.4.131) | |
101
+ | nginx check install | OK |
102
+ | nginx check running | NG |
103
+ | nginx check process | OK |
104
+ | nginx worker_connection:1024 | OK |
105
+ | nginx logrotate interval | NG |
106
+ |example@anyhost-02(172.30.4.171) | |
107
+ | nginx check install | OK |
108
+ | nginx check running | NG |
109
+ | nginx check process | OK |
110
+ | nginx worker_connection:1024 | OK |
111
+ | nginx logrotate interval | NG |
112
+ +------------------------------------------+
113
+
114
+ ```
115
+
116
+ You can use -e option and choose following outputs.
117
+
118
+ * aa : asci-art table(default)
119
+ * mkd : markdown table format
120
+ * csv : CSV file format
121
+ * bool: only 'ok' or 'ng' result string.
122
+
123
+ For more detail. You can see from `serverspec-runner -h` command.
58
124
 
59
125
  ----
60
126
 
data/Rakefile CHANGED
@@ -209,7 +209,16 @@ namespace :spec do
209
209
  n = r[0].each_char.map{|c| c.bytesize == 1 ? 1 : 2}.reduce(0, &:+)
210
210
  pad_mid = (" " * (maxlen - n)) + " | "
211
211
  pad_tail = (" " * ("result".length - r[1].length)) + " |"
212
- puts "|#{r[0]}#{pad_mid}#{r[1]}#{pad_tail}"
212
+
213
+ if r[1] == 'OK'
214
+ s_effect = "\e[32m"
215
+ e_effect = "\e[m"
216
+ elsif r[1] == 'NG'
217
+ s_effect = "\e[31m"
218
+ e_effect = "\e[m"
219
+ end
220
+
221
+ puts "|#{r[0]}#{pad_mid}#{s_effect}#{r[1]}#{e_effect}#{pad_tail}"
213
222
 
214
223
  if is_header
215
224
  puts spacer
@@ -1,3 +1,3 @@
1
1
  module ServerspecRunner
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - hiracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-06 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: serverspec