Sha256: a599cfb38b165baf9c6708ce30b98aa9b68deddeb5c766d84f5e1503947a1685

Contents?: true

Size: 791 Bytes

Versions: 28

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

require 'json'

module LicenseFinder
  class Bower < PackageManager
    def current_packages
      bower_output.map do |package|
        BowerPackage.new(package, logger: logger)
      end
    end

    def package_management_command
      'bower'
    end

    def prepare_command
      'bower install'
    end

    def possible_package_paths
      [project_path.join('bower.json')]
    end

    private

    def bower_output
      command = "#{package_management_command} list --json -l action --allow-root"
      stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
      raise "Command '#{command}' failed to execute: #{stderr}" unless status.success?

      JSON(stdout)
        .fetch('dependencies', {})
        .values
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
license_finder-7.1.0 lib/license_finder/package_managers/bower.rb
license_finder-7.0.1 lib/license_finder/package_managers/bower.rb
license_finder-7.0.0 lib/license_finder/package_managers/bower.rb
license_finder-6.15.0 lib/license_finder/package_managers/bower.rb
gitlab-license_finder-6.14.2.1 lib/license_finder/package_managers/bower.rb
license_finder-6.14.2 lib/license_finder/package_managers/bower.rb
license_finder-6.14.1 lib/license_finder/package_managers/bower.rb
license_finder-6.13.0 lib/license_finder/package_managers/bower.rb
license_finder-6.12.2 lib/license_finder/package_managers/bower.rb
license_finder-6.12.1 lib/license_finder/package_managers/bower.rb
license_finder-6.12.0 lib/license_finder/package_managers/bower.rb
license_finder-6.11.0 lib/license_finder/package_managers/bower.rb
license_finder-6.10.1 lib/license_finder/package_managers/bower.rb
license_finder-6.10.0 lib/license_finder/package_managers/bower.rb
license_finder-6.9.0 lib/license_finder/package_managers/bower.rb
license_finder-6.8.2 lib/license_finder/package_managers/bower.rb
license_finder-6.8.1 lib/license_finder/package_managers/bower.rb
license_finder-6.8.0 lib/license_finder/package_managers/bower.rb
license_finder-6.7.0 lib/license_finder/package_managers/bower.rb
license_finder-6.6.2 lib/license_finder/package_managers/bower.rb