Sha256: ecc17c1bcd882cebbe7cf2e71c9335ab55cc9c1928031dc3ea1fd6c743b1ea39

Contents?: true

Size: 710 Bytes

Versions: 3

Compression:

Stored size: 710 Bytes

Contents

require "xmlsimple"

module LicenseFinder
  class Gradle
    def self.current_packages
      `#{LicenseFinder.config.gradle_command} downloadLicenses`

      xml = license_report.read

      options = {
        'GroupTags' => { 'dependencies' => 'dependency' }
      }
      XmlSimple.xml_in(xml, options).fetch('dependency', []).map do |d|
        d["license"].reject! { |l| l["name"] == "No license found" }
        GradlePackage.new(d)
      end
    end

    def self.active?
      package_path.exist?
    end

    private

    def self.license_report
      Pathname.new('build/reports/license/dependency-license.xml')
    end

    def self.package_path
      Pathname.new('build.gradle')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
license_finder-1.1.1-java lib/license_finder/package_managers/gradle.rb
license_finder-1.1.1 lib/license_finder/package_managers/gradle.rb
license_finder-1.1.0 lib/license_finder/package_managers/gradle.rb