Sha256: 2e6f5879eba577ec497f2e6e661d36fd50b7b14767db7fba71e46f229f49bd55
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
# # Copyright (c) 2013-2020 Hal Brodigan (postmodern.mod3 at gmail.com) # # bundler-audit is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # bundler-audit is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with bundler-audit. If not, see <http://www.gnu.org/licenses/>. # require 'thor' require 'json' module Bundler module Audit class CLI < ::Thor module Formats module JSON # # Outputs the report as JSON. Will pretty-print JSON if `output` # is a TTY, otherwise normal JSON will be outputted. # # @param [Report] report # The results from the {Scanner}. # # @param [IO, File] output # The output stream. # def print_report(report,output=$stdout) hash = report.to_h if output.tty? output.puts ::JSON.pretty_generate(hash) else output.write(::JSON.generate(hash)) end end end Formats.register :json, JSON end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bundler-audit-0.8.0.rc2 | lib/bundler/audit/cli/formats/json.rb |
bundler-audit-0.8.0.rc1 | lib/bundler/audit/cli/formats/json.rb |