Sha256: 835f5c5d29215a19931493bff5366ea75b4b8e8aa2713d2d41df0647f88ebaa4

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

require "xmlsimple"

module LicenseFinder
  class Gradle
    def self.current_packages
      `gradle downloadLicenses`

      xml = File.read('build/reports/license/dependency-license.xml')

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

    def self.active?
      File.exists?(package_path)
    end

    private

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-1.0.0.0 lib/license_finder/package_managers/gradle.rb
license_finder-1.0.0.0-java lib/license_finder/package_managers/gradle.rb