From ee62499fc023c3a861dea521062ce0b5e7d63444 Mon Sep 17 00:00:00 2001
From: Stephan Renatus <srenatus@chef.io>
Date: Mon, 11 Jan 2016 09:01:54 +0100
Subject: [PATCH] bugfix: ignore supports when generating a profile's json
 representation

without this, `inspec json PATH` does never contain rules != {}, because
of the usage of the mock backend
---
 bin/inspec           | 8 +++++---
 lib/inspec/runner.rb | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/bin/inspec b/bin/inspec
index dd22d4099..6bdbb8a4a 100755
--- a/bin/inspec
+++ b/bin/inspec
@@ -52,8 +52,10 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
   def json(path)
     diagnose
 
-    profile = Inspec::Profile.from_path(path, opts)
-    dst = opts[:output].to_s
+    o = opts.dup
+    o[:ignore_supports] = true
+    profile = Inspec::Profile.from_path(path, o)
+    dst = o[:output].to_s
     if dst.empty?
       puts JSON.pretty_generate(profile.info)
     else
@@ -73,7 +75,7 @@ class InspecCLI < Thor # rubocop:disable Metrics/ClassLength
 
     o = opts.dup
     o[:logger] = Logger.new(STDOUT)
-    o[:ignore_supports] = true # we check for integrety only
+    o[:ignore_supports] = true # we check for integrity only
     profile = Inspec::Profile.from_path(path, o)
     exit 1 unless profile.check
   end
diff --git a/lib/inspec/runner.rb b/lib/inspec/runner.rb
index 05050ab39..d38951d4c 100644
--- a/lib/inspec/runner.rb
+++ b/lib/inspec/runner.rb
@@ -54,7 +54,7 @@ module Inspec
         Inspec::Metadata.from_ref(x[:ref], x[:content], @profile_id, @conf[:logger])
       end
       metas.each do |meta|
-        return [] if !ignore_supports && !meta.supports_transport?(@backend)
+        return [] unless ignore_supports || meta.supports_transport?(@backend)
       end
       assets
     end