bundler-dependencies 0.6.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f91f1a9abc52789ce91922327bb0841e54baad990a27d62227cf8a09b02b84f9
4
- data.tar.gz: e6e2e5dd7229e2c24f06512086f646b96122706362489d358f6f6f971cd224d9
3
+ metadata.gz: 14ac3a29d55de090dd738670f145af12e8777c7e764e195593cb33355fb61e74
4
+ data.tar.gz: 31364e1126f8b6a35054dcece7c7bd7b0dbc2ed9c181ad5a836e2c0c7a91e961
5
5
  SHA512:
6
- metadata.gz: 5465ca3807463f565fedb2e33f776203d2fc71e94428656542c88e5f665f5c82270d31980ba7811740f5f12b70f9376e9ef421ad1411816044057451c974780c
7
- data.tar.gz: 9197f27c934b71de5d360f8a0cd42972b20a98c0cab06a23a36a564be88abb48b10be3422d509111f599eeb804cd887b746894b22846b36eec2f3d06e9fe88c1
6
+ metadata.gz: bbaa127be7d0396701f9bfc257129493c01b9c1b2953a0120e88ce34b13b044bcbd9f161ff6756fbf9e605df9679b80c830f63fbe446d1e3f9ac3d9f7d8a3836
7
+ data.tar.gz: d98b0b92b3cc44cf1c550d1f4c5ce5f2bd9fc1fadb1232a2c5890e2e291a73757ca05fa8aa21de2c90252355f9cb2b7ce4938420b640be3b1615727867b2d515
@@ -0,0 +1,34 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Lint
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master" ]
13
+ pull_request:
14
+ branches: [ "master" ]
15
+
16
+ concurrency:
17
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ rubocop:
25
+ name: Run Rubocop
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ruby # Latest stable CRuby version
32
+ bundler-cache: true
33
+ - name: rubocop
34
+ run: bundle exec rubocop
@@ -0,0 +1,39 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Test
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master", "v1.0" ]
13
+ pull_request:
14
+ branches: [ "master", "v1.0" ]
15
+
16
+ concurrency:
17
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ test:
25
+
26
+ runs-on: ubuntu-latest
27
+ strategy:
28
+ matrix:
29
+ ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', 'head']
30
+
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - name: Set up Ruby
34
+ uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby-version }}
37
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
38
+ - name: Run tests
39
+ run: bundle exec rspec
data/.rubocop.yml CHANGED
@@ -1,5 +1,9 @@
1
- inherit_gem:
2
- rubocop_defaults: .rubocop.yml
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop/cop/internal_affairs
5
+ - rubocop-performance
6
+ - rubocop-rspec
3
7
 
4
8
  inherit_mode:
5
9
  merge:
@@ -7,18 +11,43 @@ inherit_mode:
7
11
  - IgnoredMethods
8
12
 
9
13
  AllCops:
10
- TargetRubyVersion: 2.6
14
+ NewCops: enable
15
+ TargetRubyVersion: 3.0
16
+ SuggestExtensions:
17
+ rubocop-rake: false
11
18
  Exclude:
12
19
  - .pryrc
13
20
 
14
- Layout/IndentFirstArrayElement:
21
+ Layout/FirstArrayElementIndentation:
15
22
  EnforcedStyle: consistent
16
23
 
24
+ Layout/ArgumentAlignment:
25
+ EnforcedStyle: with_fixed_indentation
26
+
27
+ Layout/EndAlignment:
28
+ EnforcedStyleAlignWith: variable
29
+
30
+ Naming/FileName:
31
+ Exclude:
32
+ - lib/bundler-dependencies.rb
33
+
17
34
  RSpec/ExampleLength:
18
35
  Max: 10
19
36
  Exclude:
20
37
  - spec/bundler/dependencies/cli_spec.rb
21
38
 
39
+ RSpec/ContextWording:
40
+ Enabled: false
41
+
42
+ RSpec/NamedSubject:
43
+ Enabled: false
44
+
45
+ RSpec/NestedGroups:
46
+ Max: 5
47
+
48
+ RSpec/NotToNot:
49
+ EnforcedStyle: to_not
50
+
22
51
  Style/FormatStringToken:
23
52
  Enabled: false
24
53
 
@@ -26,6 +55,6 @@ Style/NumericPredicate:
26
55
  Enabled: false
27
56
 
28
57
  Style/MethodCallWithArgsParentheses:
29
- IgnoredMethods:
58
+ AllowedMethods:
30
59
  - and
31
60
  - method_option
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,33 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-01-24 18:08:13 UTC using RuboCop version 1.71.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Severity, Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'bundler-dependencies.gemspec'
15
+
16
+ # Offense count: 14
17
+ # Configuration parameters: AllowedConstants.
18
+ Style/Documentation:
19
+ Exclude:
20
+ - 'lib/bundler/dependencies.rb'
21
+ - 'lib/bundler/dependencies/cli.rb'
22
+ - 'lib/bundler/dependencies/cli/command.rb'
23
+ - 'lib/bundler/dependencies/cli/count.rb'
24
+ - 'lib/bundler/dependencies/cli/find.rb'
25
+ - 'lib/bundler/dependencies/cli/graph.rb'
26
+ - 'lib/bundler/dependencies/cli/with_gem.rb'
27
+ - 'lib/bundler/dependencies/command.rb'
28
+ - 'lib/bundler/dependencies/graph.rb'
29
+ - 'lib/bundler/dependencies/scanner.rb'
30
+ - 'lib/bundler/dependencies/spec.rb'
31
+ - 'lib/bundler/dependencies/visitor.rb'
32
+ - 'lib/bundler/dependencies/visitors/paths.rb'
33
+ - 'lib/bundler/dependencies/visitors/shell_tree.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.2
1
+ 3.4.1
data/CHANGES.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.0 (2025-01-24)
4
+
5
+ ### New features
6
+ * Gem now works as a bundle plugin!
7
+
8
+ ### Bug fixes
9
+ * Fixed command name outputted when calling `bundle dependencies help`.
10
+
11
+ ### Changes
12
+ * Minimum supported Ruby version increased to 2.7.
13
+ * `thor` version restrictions were relaxed, now allows any `1.x.y` version.
14
+
3
15
  ## 0.6.0 (2019-11-18)
4
16
 
5
17
  ### New features
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
2
4
 
3
5
  source 'https://rubygems.org'
@@ -5,4 +7,11 @@ source 'https://rubygems.org'
5
7
  # Specify your gem's dependencies in bundler-dependencies.gemspec
6
8
  gemspec
7
9
 
8
- gem 'rubocop_defaults', github: 'dvandersluis/rubocop_defaults'
10
+ gem 'pry'
11
+ gem 'rake'
12
+ gem 'rspec'
13
+ gem 'rubocop'
14
+ gem 'rubocop-performance'
15
+ gem 'rubocop-rspec'
16
+
17
+ plugin 'bundler-dependencies', path: '.' unless ENV['CI']
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2019 Daniel Vandersluis
1
+ Copyright 2019-2025 Daniel Vandersluis
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Bundler::Dependencies
2
2
 
3
- [![Build Status](https://travis-ci.org/dvandersluis/bundler-dependencies.svg?branch=master)](https://travis-ci.org/dvandersluis/bundler-dependencies)
3
+ ![Test](https://github.com/dvandersluis/bundler-dependencies/actions/workflows/test.yml/badge.svg)
4
+ ![Lint](https://github.com/dvandersluis/bundler-dependencies/actions/workflows/lint.yml/badge.svg)
4
5
  [![Gem Version](https://badge.fury.io/rb/bundler-dependencies.svg)](https://badge.fury.io/rb/bundler-dependencies)
5
6
 
6
7
  Bundler plugin to inspect dependencies of gems used by your project.
@@ -9,8 +10,46 @@ A project's `Gemfile.lock` shows some basic information about what gems are dire
9
10
 
10
11
  Each dependency is a potential point of failure, vulnerability, maintenance and *complexity* for a project, so the goal of `bundle dependencies` is to shed some light on what's being installed by what. This shouldn't stop you from installing gems that are useful to your project, but to be able to make an educated decision if a gem with 25 dependencies is a worthy tradeoff, for example.
11
12
 
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```sh
18
+ plugin 'bundler-graph'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ ```sh
24
+ $ bundle install
25
+ ```
26
+
27
+ Alternately, you can install the plugin directly:
28
+
29
+ ```sh
30
+ $ bundle plugin install bundle-dependencies
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ```sh
36
+ bundler dependencies [command]
37
+ [--path=PATH] # Path to Gemfile.lock to scan
38
+ [-W, --without=one two three] # Gems to ignore
39
+ [-R, --without-rails] # Ignore all Rails gems
40
+ ```
41
+
42
+ Requires a `Gemfile.lock` or `gems.locked` file to evaluate.
43
+
12
44
  ## Commands
13
45
 
46
+ **NOTE:** By default, `bundler dependencies` runs the `count` command.
47
+
48
+ ### Getting Help
49
+
50
+ * `bundle dependencies help` to get an overview of all commands.
51
+ * `bundle dependencies help COMMAND` to get help for a specific command.
52
+
14
53
  ### Count
15
54
 
16
55
  Check how many dependencies each gem in the Gemfile has (use the `--minimum N` switch to limit the output to gems with at least `N` dependencies):
@@ -47,15 +86,12 @@ bundle dependencies graph GEMNAME
47
86
 
48
87
  ### Command Options
49
88
 
89
+ The following options can be used with any command:
90
+
50
91
  * `--path PATH`: User the Gemfile for the project at `PATH`, rather than the current project's Gemfile.
51
92
  * `--without foo bar baz`/`-W foo bar baz`: Exclude the listed gems from the scan. Any uses either directly in your Gemfile or as dependencies will be excluded, and not be counted.
52
93
  * `--without-rails`/`-R`: Quick option to exclude all 1st party Rails gems from the scan.
53
94
 
54
- ### Getting Help
55
-
56
- * `bundle dependencies help` to get an overview of all commands.
57
- * `bundle dependencies help COMMAND` to get help for a specific command.
58
-
59
95
  ## Development
60
96
 
61
97
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/Rakefile CHANGED
@@ -1,6 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
3
6
 
4
7
  RSpec::Core::RakeTask.new(:spec)
5
8
 
6
- task :default => :spec
9
+ desc 'Run RuboCop'
10
+ RuboCop::RakeTask.new(:rubocop)
11
+
12
+ task default: %i[spec rubocop]
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'bundler/dependencies'
@@ -7,8 +8,5 @@ require 'bundler/dependencies'
7
8
  # with your gem easier. You can also use a different console, if you like.
8
9
 
9
10
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start(__FILE__)
11
+ require 'pry'
12
+ Pry.start
@@ -1,29 +1,25 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'bundler/dependencies/version'
1
+ # frozen_string_literal: true
4
2
 
5
- Gem::Specification.new do |spec|
6
- spec.name = 'bundler-dependencies'
7
- spec.version = Bundler::Dependencies::VERSION
8
- spec.authors = ['Daniel Vandersluis']
9
- spec.email = ['daniel.vandersluis@gmail.com']
10
- spec.licenses = ['MIT']
11
-
12
- spec.summary = 'Find gems in your Gemfile with too many dependencies'
13
- spec.homepage = 'https://github.com/dvandersluis/bundler-dependencies'
3
+ require_relative 'lib/bundler/dependencies/version'
14
4
 
15
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
- # to allow pushing to a single host or delete this section to allow pushing to any host.
17
- if spec.respond_to?(:metadata)
18
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
-
20
- spec.metadata['homepage_uri'] = spec.homepage
21
- spec.metadata['source_code_uri'] = spec.homepage
22
- spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGES.md"
23
- else
24
- raise 'RubyGems 2.0 or newer is required to protect against ' \
25
- 'public gem pushes.'
26
- end
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'bundler-dependencies'
7
+ spec.version = Bundler::Dependencies::VERSION
8
+ spec.platform = Gem::Platform::RUBY
9
+ spec.required_ruby_version = '>= 2.7'
10
+ spec.authors = ['Daniel Vandersluis']
11
+ spec.email = ['daniel.vandersluis@gmail.com']
12
+ spec.licenses = ['MIT']
13
+
14
+ spec.summary = 'Find gems in your Gemfile with too many dependencies'
15
+ spec.homepage = 'https://github.com/dvandersluis/bundler-dependencies'
16
+
17
+ spec.metadata = {
18
+ 'source_code_uri' => spec.homepage,
19
+ 'changelog_uri' => "#{spec.homepage}/CHANGES.md",
20
+ 'bug_tracker_uri' => "#{spec.homepage}/issues",
21
+ 'rubygems_mfa_required' => 'true'
22
+ }
27
23
 
28
24
  # Specify which files should be added to the gem when it is released.
29
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -31,16 +27,7 @@ Gem::Specification.new do |spec|
31
27
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
32
28
  end
33
29
 
34
- glob = -> (patterns) { spec.files & Dir[*patterns] }
35
- spec.executables = glob['bin/bundle*'].map { |path| File.basename(path) }
36
- spec.default_executable = spec.executables.first if Gem::VERSION < '1.7.'
37
-
38
30
  spec.require_paths = ['lib']
39
31
 
40
- spec.add_dependency 'bundler', '~> 2.0'
41
- spec.add_dependency 'thor', '~> 0.20.3'
42
-
43
- spec.add_development_dependency 'pry', '~> 0.12.2'
44
- spec.add_development_dependency 'rake', '~> 10.0'
45
- spec.add_development_dependency 'rspec', '~> 3.0'
32
+ spec.add_dependency 'thor', '>= 1', '< 2'
46
33
  end
@@ -1,13 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class CLI < ::Thor
4
6
  class Command < ::Thor
5
- RAILS_GEMS = %w(
7
+ RAILS_GEMS = %w[
6
8
  rails actioncable actionmailbox actionmailer actionpack actiontext actionview
7
9
  activejob activemodel activerecord activestorage activesupport railties
8
- ).freeze
10
+ ].freeze
9
11
 
10
12
  def initialize(options)
13
+ super()
11
14
  @options = options
12
15
  self.shell = Thor::Shell::Basic.new unless options.color?
13
16
  end
@@ -20,7 +23,7 @@ module Bundler
20
23
  end
21
24
  end
22
25
 
23
- private
26
+ private
24
27
 
25
28
  attr_reader :options
26
29
 
@@ -63,12 +66,12 @@ module Bundler
63
66
  end
64
67
 
65
68
  def warn(message)
66
- say(message, %i(bold yellow))
69
+ say(message, %i[bold yellow])
67
70
  end
68
71
 
69
72
  def error(message)
70
73
  message = shell.send(:prepare_message, message, :red, :bold)
71
- super(message)
74
+ super
72
75
  end
73
76
  end
74
77
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class CLI < ::Thor
4
6
  class Count < Command
5
- private
7
+ private
6
8
 
7
9
  def to_s
8
10
  say(scanner.to_s, :bold)
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class CLI < ::Thor
4
6
  class Find < Command
5
7
  include WithGem
6
8
 
7
- private
9
+ private
8
10
 
9
11
  def to_s
10
12
  if dependents.empty?
@@ -26,7 +28,7 @@ module Bundler
26
28
  def paths
27
29
  dependents.each do |gem, paths|
28
30
  puts
29
- say(gem, %i(bold))
31
+ say(gem, %i[bold])
30
32
  paths.each { |p| say " * #{p}" }
31
33
  end
32
34
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class CLI < ::Thor
4
6
  class Graph < Command
5
7
  include CLI::WithGem
6
8
 
7
- private
9
+ private
8
10
 
9
11
  def to_s
10
12
  if gems.empty?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class CLI < ::Thor
@@ -7,7 +9,7 @@ module Bundler
7
9
  super(options)
8
10
  end
9
11
 
10
- private
12
+ private
11
13
 
12
14
  attr_reader :gem
13
15
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
  require 'bundler'
3
5
  require 'bundler/vendored_thor'
@@ -7,6 +9,8 @@ require 'bundler/dependencies'
7
9
  module Bundler
8
10
  module Dependencies
9
11
  class CLI < ::Thor
12
+ package_name 'bundler-dependencies'
13
+
10
14
  def self.shared_options
11
15
  method_option :path, type: :string, desc: 'Path to Gemfile.lock to scan'
12
16
  method_option :without, type: :array, desc: 'Gems to ignore', aliases: ['-W']
@@ -14,8 +18,19 @@ module Bundler
14
18
  method_option :color, type: :boolean, default: true, desc: 'Colorize output'
15
19
  end
16
20
 
21
+ def self.exit_on_failure?
22
+ true
23
+ end
24
+
25
+ def self.basename
26
+ 'bundle dependencies'
27
+ end
28
+
17
29
  default_task :count
18
30
  map '--version' => :version
31
+ map '--help' => :help
32
+ map '-h' => :help
33
+ map '-?' => :help
19
34
 
20
35
  desc 'version', 'Prints the bundler-dependencies version'
21
36
  def version
@@ -24,7 +39,9 @@ module Bundler
24
39
 
25
40
  desc 'count', 'Count the number of dependencies each gem in the bundle relies on, recursively'
26
41
  shared_options
27
- method_option :minimum, type: :numeric, desc: 'Report only gems with a minimum N dependencies', aliases: ['-m'], default: 0
42
+ method_option :minimum, type: :numeric, desc: <<~DESC, aliases: ['-m'], default: 0
43
+ Report only gems with a minimum N dependencies
44
+ DESC
28
45
 
29
46
  def count(*args)
30
47
  return help(:count) if args.first == 'help'
@@ -43,7 +60,9 @@ module Bundler
43
60
 
44
61
  desc 'find [GEM]', 'Output gems in the bundle that depend on GEM'
45
62
  shared_options
46
- method_option :quiet, type: :boolean, default: false, desc: 'Show only the number of gems and no other output', aliases: ['-q']
63
+ method_option :quiet, type: :boolean, default: false, desc: <<~DESC, aliases: ['-q']
64
+ Show only the number of gems and no other output
65
+ DESC
47
66
 
48
67
  def find(gem = nil)
49
68
  return help(:find) if gem.nil? || gem == 'help'
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module Dependencies
5
+ class Command
6
+ Bundler::Plugin::API.command('dependencies', self)
7
+
8
+ def exec(_command_name, args)
9
+ Bundler::Dependencies::CLI.start(args)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class Graph
@@ -31,12 +33,12 @@ module Bundler
31
33
  end
32
34
 
33
35
  def counts(min: 0)
34
- @counts ||= map do |gem|
36
+ @counts ||= filter_map do |gem|
35
37
  count = gem.dependency_count
36
38
  next if count < min
37
39
 
38
40
  [gem.name, gem.dependency_count]
39
- end.compact.sort_by(&:last).reverse.to_h
41
+ end.sort_by(&:last).reverse.to_h
40
42
  end
41
43
 
42
44
  def delete(*specs)
@@ -67,7 +69,7 @@ module Bundler
67
69
  self
68
70
  end
69
71
 
70
- private
72
+ private
71
73
 
72
74
  attr_reader :lockfile, :specs
73
75
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class Scanner
@@ -20,7 +22,7 @@ module Bundler
20
22
  "#{gem_count} gems scanned; #{spec_count} dependencies found"
21
23
  end
22
24
 
23
- private
25
+ private
24
26
 
25
27
  attr_reader :lockfile
26
28
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class Spec
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
- VERSION = '0.6.0'.freeze
5
+ VERSION = '1.0.0'
4
6
  end
5
7
  end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  class Visitor
4
6
  def self.walk(graph, depth = 0, &block)
5
7
  graph.each do |gem|
6
- block.call(gem, depth)
8
+ yield(gem, depth)
7
9
  walk(gem.dependencies, depth + 1, &block) if gem.dependencies
8
10
  end
9
11
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  module Visitors
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
2
4
  module Dependencies
3
5
  module Visitors
@@ -15,7 +17,7 @@ module Bundler
15
17
  nil
16
18
  end
17
19
 
18
- private
20
+ private
19
21
 
20
22
  def say(shell, message, opts)
21
23
  if shell
@@ -1,21 +1,24 @@
1
- require 'bundler/dependencies/version'
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'bundler'
4
4
 
5
- require 'bundler/dependencies/cli'
6
- require 'bundler/dependencies/graph'
7
- require 'bundler/dependencies/scanner'
8
- require 'bundler/dependencies/spec'
9
- require 'bundler/dependencies/visitor'
5
+ require_relative 'dependencies/version'
10
6
 
11
- require 'bundler/dependencies/cli/command'
12
- require 'bundler/dependencies/cli/with_gem'
13
- require 'bundler/dependencies/cli/count'
14
- require 'bundler/dependencies/cli/find'
15
- require 'bundler/dependencies/cli/graph'
7
+ require_relative 'dependencies/cli'
8
+ require_relative 'dependencies/command'
9
+ require_relative 'dependencies/graph'
10
+ require_relative 'dependencies/scanner'
11
+ require_relative 'dependencies/spec'
12
+ require_relative 'dependencies/visitor'
16
13
 
17
- require 'bundler/dependencies/visitors/shell_tree'
18
- require 'bundler/dependencies/visitors/paths'
14
+ require_relative 'dependencies/cli/command'
15
+ require_relative 'dependencies/cli/with_gem'
16
+ require_relative 'dependencies/cli/count'
17
+ require_relative 'dependencies/cli/find'
18
+ require_relative 'dependencies/cli/graph'
19
+
20
+ require_relative 'dependencies/visitors/shell_tree'
21
+ require_relative 'dependencies/visitors/paths'
19
22
 
20
23
  module Bundler
21
24
  module Dependencies
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'bundler/dependencies'
data/plugins.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/bundler-dependencies'
metadata CHANGED
@@ -1,109 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-dependencies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Vandersluis
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2019-11-18 00:00:00.000000000 Z
10
+ date: 2025-01-24 00:00:00.000000000 Z
12
11
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.0'
27
12
  - !ruby/object:Gem::Dependency
28
13
  name: thor
29
14
  requirement: !ruby/object:Gem::Requirement
30
15
  requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.20.3
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.20.3
41
- - !ruby/object:Gem::Dependency
42
- name: pry
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
16
+ - - ">="
46
17
  - !ruby/object:Gem::Version
47
- version: 0.12.2
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
18
+ version: '1'
19
+ - - "<"
53
20
  - !ruby/object:Gem::Version
54
- version: 0.12.2
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '10.0'
62
- type: :development
21
+ version: '2'
22
+ type: :runtime
63
23
  prerelease: false
64
24
  version_requirements: !ruby/object:Gem::Requirement
65
25
  requirements:
66
- - - "~>"
26
+ - - ">="
67
27
  - !ruby/object:Gem::Version
68
- version: '10.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
28
+ version: '1'
29
+ - - "<"
81
30
  - !ruby/object:Gem::Version
82
- version: '3.0'
83
- description:
31
+ version: '2'
84
32
  email:
85
33
  - daniel.vandersluis@gmail.com
86
- executables:
87
- - bundle-dependencies
88
- - bundler-dependencies
34
+ executables: []
89
35
  extensions: []
90
36
  extra_rdoc_files: []
91
37
  files:
38
+ - ".github/workflows/lint.yml"
39
+ - ".github/workflows/test.yml"
92
40
  - ".gitignore"
93
41
  - ".rspec"
94
42
  - ".rubocop.yml"
43
+ - ".rubocop_todo.yml"
95
44
  - ".ruby-version"
96
- - ".travis.yml"
97
45
  - CHANGES.md
98
46
  - Gemfile
99
47
  - LICENSE
100
48
  - README.md
101
49
  - Rakefile
102
- - bin/bundle-dependencies
103
- - bin/bundler-dependencies
104
50
  - bin/console
105
51
  - bin/setup
106
52
  - bundler-dependencies.gemspec
53
+ - lib/bundler-dependencies.rb
107
54
  - lib/bundler/dependencies.rb
108
55
  - lib/bundler/dependencies/cli.rb
109
56
  - lib/bundler/dependencies/cli/command.rb
@@ -111,6 +58,7 @@ files:
111
58
  - lib/bundler/dependencies/cli/find.rb
112
59
  - lib/bundler/dependencies/cli/graph.rb
113
60
  - lib/bundler/dependencies/cli/with_gem.rb
61
+ - lib/bundler/dependencies/command.rb
114
62
  - lib/bundler/dependencies/graph.rb
115
63
  - lib/bundler/dependencies/scanner.rb
116
64
  - lib/bundler/dependencies/spec.rb
@@ -118,15 +66,15 @@ files:
118
66
  - lib/bundler/dependencies/visitor.rb
119
67
  - lib/bundler/dependencies/visitors/paths.rb
120
68
  - lib/bundler/dependencies/visitors/shell_tree.rb
69
+ - plugins.rb
121
70
  homepage: https://github.com/dvandersluis/bundler-dependencies
122
71
  licenses:
123
72
  - MIT
124
73
  metadata:
125
- allowed_push_host: https://rubygems.org
126
- homepage_uri: https://github.com/dvandersluis/bundler-dependencies
127
74
  source_code_uri: https://github.com/dvandersluis/bundler-dependencies
128
75
  changelog_uri: https://github.com/dvandersluis/bundler-dependencies/CHANGES.md
129
- post_install_message:
76
+ bug_tracker_uri: https://github.com/dvandersluis/bundler-dependencies/issues
77
+ rubygems_mfa_required: 'true'
130
78
  rdoc_options: []
131
79
  require_paths:
132
80
  - lib
@@ -134,15 +82,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
82
  requirements:
135
83
  - - ">="
136
84
  - !ruby/object:Gem::Version
137
- version: '0'
85
+ version: '2.7'
138
86
  required_rubygems_version: !ruby/object:Gem::Requirement
139
87
  requirements:
140
88
  - - ">="
141
89
  - !ruby/object:Gem::Version
142
90
  version: '0'
143
91
  requirements: []
144
- rubygems_version: 3.0.6
145
- signing_key:
92
+ rubygems_version: 3.6.2
146
93
  specification_version: 4
147
94
  summary: Find gems in your Gemfile with too many dependencies
148
95
  test_files: []
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- ---
2
- os: linux
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.5
7
- - 2.5.7
8
- - 2.4.9
9
- - 2.7.0-preview2
10
- before_install: gem install bundler -v 2.0.1
11
-
12
- jobs:
13
- include:
14
- - stage: lint
15
- rvm: 2.6.5
16
- script: bundle exec rubocop
17
- allow_failures:
18
- - rvm: 2.7.0.preview2
19
-
20
- stages:
21
- - lint
22
- - test
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
-
5
- lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
7
-
8
- require 'bundler/dependencies/cli'
9
-
10
- Bundler::Dependencies::CLI.start
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- load File.expand_path('bundle-dependencies', __dir__)