inspec 0.14.5 → 0.14.6

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: 46086a8807d15265955db741c7bd40588230fea3
4
- data.tar.gz: 7de696eaa0d504e06bf3721db82453cb98ab684f
3
+ metadata.gz: 22439c33205070f48e2e1f199f040ff3f4a50133
4
+ data.tar.gz: 12fb11787b0df75c7c3f275a5ee43bb19df94983
5
5
  SHA512:
6
- metadata.gz: 62812a33d54e2ca96dd59d38e77bf8bba0df28aeb20a11d41524c5d2cc090f35a2ac5cc5afb0f498140c2d4d9a5446bac73678faa34ae89eb477c3531946fee3
7
- data.tar.gz: bb685a5a79c4d562676431b3640c5870702a54a9d11815ceeec56252790c56d775135cc3f8f8410e349a10069d0247f90159359ce4bc15ac6033908e3453e2ef
6
+ metadata.gz: 1b8fc567acb8bf86a1b9fa4ec40dab1ac50f596874cf26ed30e240612c2a32ad772e3b2166767ed4f9676aa966530bf114fb004187b6aa71dd5a436449c4ef28
7
+ data.tar.gz: 1e17444082f76b7c02a9590783a93c350ac12f6e039492737a3af54cd5c6f91c2a9530db2422241f971b175cbdb194bfd1903d8694c6d13dbb05ca7a81afd119
@@ -1,10 +1,22 @@
1
1
  # Change Log
2
2
 
3
- ## [0.14.5](https://github.com/chef/inspec/tree/0.14.5) (2016-02-29)
4
- [Full Changelog](https://github.com/chef/inspec/compare/v0.14.4...0.14.5)
3
+ ## [0.14.6](https://github.com/chef/inspec/tree/0.14.6) (2016-03-01)
4
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.14.5...0.14.6)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - add missing supermarket loader [\#506](https://github.com/chef/inspec/pull/506) ([chris-rock](https://github.com/chris-rock))
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Improve Supermarket CLI [\#508](https://github.com/chef/inspec/pull/508) ([alexpop](https://github.com/alexpop))
13
+
14
+ ## [v0.14.5](https://github.com/chef/inspec/tree/v0.14.5) (2016-02-29)
15
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.14.4...v0.14.5)
5
16
 
6
17
  **Merged pull requests:**
7
18
 
19
+ - 0.14.5 [\#505](https://github.com/chef/inspec/pull/505) ([chris-rock](https://github.com/chris-rock))
8
20
  - Fix license warning during gem build. [\#503](https://github.com/chef/inspec/pull/503) ([juliandunn](https://github.com/juliandunn))
9
21
 
10
22
  ## [v0.14.4](https://github.com/chef/inspec/tree/v0.14.4) (2016-02-26)
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+ # author: Christoph Hartmann
3
+ # author: Dominik Richter
4
+
5
+ libdir = File.dirname(__FILE__)
6
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
7
+
8
+ module Supermarket
9
+ autoload :Configuration, 'inspec-supermarket/configuration'
10
+ autoload :API, 'inspec-supermarket/api'
11
+ end
12
+
13
+ require 'inspec-supermarket/cli'
14
+ require 'inspec-supermarket/target'
@@ -18,7 +18,11 @@ module Supermarket
18
18
  _success, data = get(url, { q: 'compliance_profile' })
19
19
  if !data.nil?
20
20
  profiles = JSON.parse(data)
21
- profiles['items']
21
+ profiles['items'].map { |x|
22
+ m = %r{^#{Supermarket::API.supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(x['tool'])
23
+ x['slug'] = m[:slug]
24
+ x
25
+ }
22
26
  else
23
27
  []
24
28
  end
@@ -34,15 +38,12 @@ module Supermarket
34
38
  # displays profile infos
35
39
  def self.info(profile)
36
40
  _tool_owner, tool_name = profile_name("supermarket://#{profile}")
41
+ return if tool_name.nil? || tool_name.empty?
37
42
  url = "#{SUPERMARKET_URL}/api/v1/tools/#{tool_name}"
38
43
  _success, data = get(url, {})
39
- if !data.nil?
40
- JSON.parse(data)
41
- else
42
- {}
43
- end
44
+ JSON.parse(data) if !data.nil?
44
45
  rescue JSON::ParserError
45
- {}
46
+ nil
46
47
  end
47
48
 
48
49
  # compares a profile with the supermarket tool info
@@ -13,12 +13,11 @@ module Supermarket
13
13
 
14
14
  headline('Available profiles:')
15
15
  supermarket_profiles.each { |p|
16
- m = %r{^#{Supermarket::API.supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(p['tool'])
17
- li("#{p['tool_owner']}/#{m[:slug]}")
16
+ li("#{p['tool_owner']}/#{p['slug']}")
18
17
  }
19
18
  end
20
19
 
21
- desc 'exec PROFILE', 'executes a Supermarket profile'
20
+ desc 'exec PROFILE', 'execute a Supermarket profile'
22
21
  option :id, type: :string,
23
22
  desc: 'Attach a profile ID to all test results'
24
23
  target_options
@@ -32,10 +31,21 @@ module Supermarket
32
31
  run_tests(tests, opts)
33
32
  end
34
33
 
35
- desc 'info profile', 'display profile details'
34
+ desc 'info PROFILE', 'display Supermarket profile details'
36
35
  def info(profile)
37
- info = Supermarket::API.info(profile)
36
+ # check that the profile is available
37
+ supermarket_profiles = Supermarket::API.profiles
38
+ found = supermarket_profiles.select { |p|
39
+ "#{p['tool_owner']}/#{p['slug']}" == profile
40
+ }
38
41
 
42
+ if found.length == 0
43
+ puts "#{mark_text(profile)} is not available on Supermarket"
44
+ return
45
+ end
46
+
47
+ # load details for the specific profile
48
+ info = Supermarket::API.info(profile)
39
49
  puts "#{mark_text('name: ')} #{info['slug']}"
40
50
  puts "#{mark_text('owner:')} #{info['owner']}"
41
51
  puts "#{mark_text('url: ')} #{info['source_url']}"
@@ -3,5 +3,5 @@
3
3
  # author: Christoph Hartmann
4
4
 
5
5
  module Inspec
6
- VERSION = '0.14.5'.freeze
6
+ VERSION = '0.14.6'.freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.5
4
+ version: 0.14.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-29 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: r-train
@@ -221,6 +221,7 @@ files:
221
221
  - lib/bundles/inspec-init/templates/profile/controls/example.rb
222
222
  - lib/bundles/inspec-init/templates/profile/inspec.yml
223
223
  - lib/bundles/inspec-init/templates/profile/libraries/.gitkeep
224
+ - lib/bundles/inspec-supermarket.rb
224
225
  - lib/bundles/inspec-supermarket/README.md
225
226
  - lib/bundles/inspec-supermarket/api.rb
226
227
  - lib/bundles/inspec-supermarket/cli.rb