Class: CocoaPodsGitlabLicenseReport::ReportGenerator
- Inherits:
-
Object
- Object
- CocoaPodsGitlabLicenseReport::ReportGenerator
- Defined in:
- lib/cocoapods-gitlab_license_report/report_generator.rb
Instance Method Summary collapse
- #generate(specs, excluded) ⇒ Object
-
#initialize(sandbox) ⇒ ReportGenerator
constructor
A new instance of ReportGenerator.
Constructor Details
#initialize(sandbox) ⇒ ReportGenerator
Returns a new instance of ReportGenerator.
6 7 8 |
# File 'lib/cocoapods-gitlab_license_report/report_generator.rb', line 6 def initialize(sandbox) @sandbox = sandbox end |
Instance Method Details
#generate(specs, excluded) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cocoapods-gitlab_license_report/report_generator.rb', line 10 def generate(specs, excluded) dependencies = [] licenses = {} specs.reject { |s| excluded.include? s.name }.each do |s| license_name = s.license license_name = license_name[:type] if license_name.is_a?(Hash) license = LicenseFinder::License.find_by_name(license_name) dependencies << { :name => s.name, :version => s.version.to_s || "0.0", :package_manager => "cocoapods", :path => @sandbox.manifest_path, :licenses => [license_name] } licenses[license_name] = { :id => license_name, :name => license_name, :url => license.url || "" } end { :version => "2.1", :licenses => licenses.values.sort_by {|v| v[:id]}, :dependencies => dependencies } end |