Sha256: cd6694035a08361db16362694ca4b31f5fee673be5b1ec41e4e35d29bd6c6457
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
module CocoaPodsGitlabLicenseReport require 'cocoapods-gitlab_license_report/report_generator' require 'cocoapods' require 'set' class PostInstallHookHandler def initialize(context, options, generator = nil) @context = context @options = options @generator = generator || ReportGenerator.new(@context) end def handle! Pod::UI.section 'Generating Gitlab licenses report' do report_path = @options["report_path"] || 'reports/licenses.json' excluded_pods = Set.new(@options["exclude"]) sandbox = @context.sandbox if defined? @context.sandbox sandbox ||= Pod::Sandbox.new(@context.sandbox_root) installed_specs = @context.umbrella_targets.flat_map(&:specs).map(&:root).uniq licenses_report = @generator.generate(installed_specs, excluded_pods, @context.sandbox) Dir.mkdir File.dirname(report_path) unless File.exist? File.dirname(report_path) File.write(report_path, licenses_report.to_json) end end end Pod::HooksManager.register('cocoapods-gitlab_license_report', :post_install) do |context, user_options| # Until CocoaPods provides a HashWithIndifferentAccess, normalize the hash keys here. # See https://github.com/CocoaPods/CocoaPods/issues/3354 user_options.inject({}) do |normalized_hash, (key, value)| normalized_hash[key.to_s] = value normalized_hash end handler = PostInstallHookHandler.new(context, user_options) handler.handle! end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cocoapods-gitlab_license_report-1.0.1 | lib/cocoapods-gitlab_license_report.rb |