Class: LicenseFinder::Bundler

Inherits:
PackageManager show all
Defined in:
lib/license_finder/package_managers/bundler.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PackageManager

#active?, command_exists?, #current_packages_with_relations, #detected_package_path, installed?, #prepare, #project_root?, takes_priority_over

Constructor Details

#initialize(options = {}) ⇒ Bundler

Returns a new instance of Bundler.



7
8
9
10
11
# File 'lib/license_finder/package_managers/bundler.rb', line 7

def initialize(options = {})
  super
  @ignored_groups = options[:ignored_groups]
  @definition = options[:definition] # dependency injection for tests
end

Class Method Details

.package_management_commandObject



22
23
24
# File 'lib/license_finder/package_managers/bundler.rb', line 22

def self.package_management_command
  'bundle'
end

Instance Method Details

#current_packagesObject



13
14
15
16
17
18
19
20
# File 'lib/license_finder/package_managers/bundler.rb', line 13

def current_packages
  logger.debug self.class, "including groups #{included_groups.inspect}"
  details.map do |gem_detail, bundle_detail|
    BundlerPackage.new(gem_detail, bundle_detail, logger: logger).tap do |package|
      log_package_dependencies package
    end
  end
end

#possible_package_pathsObject



32
33
34
# File 'lib/license_finder/package_managers/bundler.rb', line 32

def possible_package_paths
  [project_path.join(gemfile)]
end

#prepare_commandObject



26
27
28
29
30
# File 'lib/license_finder/package_managers/bundler.rb', line 26

def prepare_command
  ignored_groups_argument = !ignored_groups.empty? ? "--without #{ignored_groups.to_a.join(' ')}" : ''

  "bundle install #{ignored_groups_argument}".strip
end