serverspec 2.32.0 → 2.33.0

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: d629e86c428878a40544bc2beff61c6869491a31
4
- data.tar.gz: fc3996256189a5636032106fd42d559fd94d702f
3
+ metadata.gz: e8cb6202bb17b2d00ab02b03db491a3f202115c6
4
+ data.tar.gz: 384cf92bdcfb12da69e2ace11aa9d73556d59715
5
5
  SHA512:
6
- metadata.gz: dc0c442b4fea567318daa7f51bc196fd2825aec1434e1b30dab7cd9bf01a38bc63bbe7d50e7f568073412d1f290a32a4b70aac8c3fb9fc925dd769afe606f789
7
- data.tar.gz: 4ed56238b527ee2d589806b4b288842360e9a691492cb89f1faadb01b87476f9e754e3fca1ca0d74c8567e8a687d0a2402bd054380f6a0c62b627cce83524b59
6
+ metadata.gz: 612c03a69be35c981006c1df4ada37ba9e7328bbc5c78440328bd816d13989229902265cce594ce9d9c76443364ffca68c76cf41bad291853e6e8749117c3429
7
+ data.tar.gz: 256da65cc862344419a75e1051758a3462d9609a0548c5a2f5c96d7fc5b96d12e2ddd0dbe800880a106e0ab95d3890840a3d4f6fcf6409fb41903a160026e7fa
@@ -4,7 +4,7 @@ module Serverspec
4
4
  types = %w(
5
5
  base bridge bond cgroup command cron default_gateway file fstab
6
6
  group host iis_website iis_app_pool interface ipfilter ipnat
7
- iptables ip6tables kernel_module linux_kernel_parameter lxc
7
+ iptables ip6tables json_file kernel_module linux_kernel_parameter lxc
8
8
  mail_alias mysql_config package php_config port ppa process
9
9
  routing_table selinux selinux_module service user yumrepo
10
10
  windows_feature windows_hot_fix windows_registry_key
@@ -16,14 +16,12 @@ module Serverspec::Type
16
16
  end
17
17
 
18
18
  def inspection
19
- return @inspection if @inspection
20
- @inspection = ::MultiJson.load(get_inspection.stdout)[0]
19
+ @inspection ||= ::MultiJson.load(get_inspection.stdout)[0]
21
20
  end
22
21
 
23
22
  private
24
23
  def get_inspection
25
- return @get_inspection if @get_inspection
26
- @get_inspection = @runner.run_command("docker inspect #{@name}")
24
+ @get_inspection ||= @runner.run_command("docker inspect #{@name}")
27
25
  end
28
26
  end
29
27
  end
@@ -0,0 +1,9 @@
1
+ require 'json'
2
+
3
+ module Serverspec::Type
4
+ class JsonFile < File
5
+ def content
6
+ JSON.parse(super)
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "2.32.0"
2
+ VERSION = "2.33.0"
3
3
  end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, {:family => 'base'}
4
+
5
+ describe json_file('example.json') do
6
+ let(:stdout) {<<EOF
7
+ {
8
+ "json": {
9
+ "title": "this is a json",
10
+ "array" : [
11
+ {
12
+ "title": "array 1"
13
+ },
14
+ {
15
+ "title": "array 2"
16
+ }
17
+ ]
18
+ }
19
+ }
20
+ EOF
21
+ }
22
+
23
+ its(:content) { should include('json') }
24
+ its(:content) { should include('json' => include('title' => 'this is a json')) }
25
+ its(:content) { should include('json' => include('array' => include('title' => 'array 2'))) }
26
+ end
27
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.32.0
4
+ version: 2.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-22 00:00:00.000000000 Z
11
+ date: 2016-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -165,6 +165,7 @@ files:
165
165
  - lib/serverspec/type/ipfilter.rb
166
166
  - lib/serverspec/type/ipnat.rb
167
167
  - lib/serverspec/type/iptables.rb
168
+ - lib/serverspec/type/json_file.rb
168
169
  - lib/serverspec/type/kernel_module.rb
169
170
  - lib/serverspec/type/linux_audit_system.rb
170
171
  - lib/serverspec/type/linux_kernel_parameter.rb
@@ -209,6 +210,7 @@ files:
209
210
  - spec/type/base/file_spec.rb
210
211
  - spec/type/base/group_spec.rb
211
212
  - spec/type/base/host_spec.rb
213
+ - spec/type/base/json_file_spec.rb
212
214
  - spec/type/base/mail_alias_spec.rb
213
215
  - spec/type/base/mysql_config_spec.rb
214
216
  - spec/type/base/package_spec.rb
@@ -353,6 +355,7 @@ test_files:
353
355
  - spec/type/base/file_spec.rb
354
356
  - spec/type/base/group_spec.rb
355
357
  - spec/type/base/host_spec.rb
358
+ - spec/type/base/json_file_spec.rb
356
359
  - spec/type/base/mail_alias_spec.rb
357
360
  - spec/type/base/mysql_config_spec.rb
358
361
  - spec/type/base/package_spec.rb