Class: Degem::FindUnused

Inherits:
Object
  • Object
show all
Defined in:
lib/degem/find_unused.rb

Instance Method Summary collapse

Constructor Details

#initialize(gemfile_path:, gem_specification: Gem::Specification, bundle_paths: GitLsFiles.new) ⇒ FindUnused

Returns a new instance of FindUnused.



5
6
7
8
9
10
# File 'lib/degem/find_unused.rb', line 5

def initialize(gemfile_path:, gem_specification: Gem::Specification, bundle_paths: GitLsFiles.new)
  @gemfile_path = gemfile_path
  @gem_specification = gem_specification
  fallback = Dir.glob(File.join(File.dirname(gemfile_path), "**/*.rb"))
  @bundle_paths = bundle_paths.call(fallback)
end

Instance Method Details

#callObject



12
13
14
15
16
# File 'lib/degem/find_unused.rb', line 12

def call
  rubygems = gemfile.rubygems.reject { _1.name == "degem" }
  rubygems = reject_railties(rubygems) if gemfile.rails?
  reject_used(rubygems)
end