bundle_update_interactive 0.9.1 → 0.10.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: f45b67dd4da1f56e5bad0b154acfb7dce40b4f518eb1cf9c1101302ec3ee71f4
4
- data.tar.gz: 9d763c27460be163b2dc6eaa818e770e81448244bcd0c2c94dee368b148d4a1d
3
+ metadata.gz: 903a652a152b38ae645e7aea5a4216d36f464b8c9de1fb7a912d2a68aeb0a25d
4
+ data.tar.gz: cebf133ae5be56b8706ead28c59ea8d2c11967a0994327fa8ccd8ab41ef99c5c
5
5
  SHA512:
6
- metadata.gz: 5bf17f343e90aa16f244c470ad9f58590702d61f610e9ac6bb4623990b997f103ea52448433f8c5273880b3f110e467c72c841fa25274c9770e21805c3ce403a
7
- data.tar.gz: 248b8e8b066fa56574297c76ce25eab8bbd6b14e10ca1a8d83444679a82dae76ae7117775fa6df9753a1c847a337d2c4730270d87ec55c33186e249e9d002a02
6
+ metadata.gz: 170ac818830a83eda22e6b24349e81af25d9aeeace867e839e6e9b96ebd93b19cf3b2e7d72df8b5e3610fe3390ae95791be034dfae7d147f75964a9075c055fe
7
+ data.tar.gz: 8d3c98c30d19335071e3c582e8e828039da65b53231b38968147a4dbf3a13f6532b5bfb9db12e03d6da2a15a88a6f14a3cbf17d8b5531fa62e93515386c3c308
data/README.md CHANGED
@@ -44,6 +44,7 @@ bundle ui
44
44
 
45
45
  - `--commit` [applies each gem update in a discrete git commit](#git-commits)
46
46
  - `--latest` [modifies the Gemfile if necessary to allow the latest gem versions](#allow-latest-versions)
47
+ - `--only-explicit` [updates Gemfile gems only (excluding indirect dependencies)](#exclude-indirect-dependencies)
47
48
  - `-D` / `--exclusively=GROUP` [limits updatable gems by Gemfile groups](#limit-impact-by-gemfile-groups)
48
49
 
49
50
  ## Features
@@ -145,6 +146,16 @@ https://github.com/rails/rails/compare/5a8d894...77dfa65
145
146
 
146
147
  This feature currently works for GitHub, GitLab, and Bitbucket repos.
147
148
 
149
+ ### Exclude indirect dependencies
150
+
151
+ Just like with `bundle outdated`, you can pass `--only-explicit` to limit updates to only gems that are explicitly listed in the Gemfile.
152
+
153
+ ```sh
154
+ bundle update-interactive --only-explicit
155
+ ```
156
+
157
+ This will omit indirect dependencies from the list of gems that can be updated.
158
+
148
159
  ### Limit impact by Gemfile groups
149
160
 
150
161
  The effects of `bundle update-interactive` can be limited to one or more Gemfile groups using the `--exclusively` option:
@@ -71,6 +71,9 @@ module BundleUpdateInteractive
71
71
  parser.on("--latest", "Modify the Gemfile to allow the latest gem versions") do
72
72
  options.latest = true
73
73
  end
74
+ parser.on("--only-explicit", "Update Gemfile gems only (no indirect dependencies)") do
75
+ options.only_explicit = true
76
+ end
74
77
  parser.on(
75
78
  "--exclusively=GROUP",
76
79
  "Update gems exclusively belonging to the specified Gemfile GROUP(s)"
@@ -94,12 +97,13 @@ module BundleUpdateInteractive
94
97
  end
95
98
 
96
99
  attr_accessor :exclusively
97
- attr_writer :commit, :latest
100
+ attr_writer :commit, :latest, :only_explicit
98
101
 
99
102
  def initialize
100
103
  @exclusively = []
101
104
  @commit = false
102
105
  @latest = false
106
+ @only_explicit = false
103
107
  end
104
108
 
105
109
  def commit?
@@ -109,6 +113,10 @@ module BundleUpdateInteractive
109
113
  def latest?
110
114
  @latest
111
115
  end
116
+
117
+ def only_explicit?
118
+ @only_explicit
119
+ end
112
120
  end
113
121
  end
114
122
  end
@@ -47,7 +47,7 @@ module BundleUpdateInteractive
47
47
  end
48
48
 
49
49
  def gem_names
50
- rows.keys
50
+ rows.keys.sort
51
51
  end
52
52
 
53
53
  def render_header
@@ -61,7 +61,7 @@ module BundleUpdateInteractive
61
61
 
62
62
  def render
63
63
  lines = [render_header]
64
- rows.keys.sort.each { |name| lines << render_gem(name) }
64
+ gem_names.each { |name| lines << render_gem(name) }
65
65
  lines.join("\n")
66
66
  end
67
67
 
@@ -61,7 +61,7 @@ module BundleUpdateInteractive
61
61
  def generate_report(options)
62
62
  whisper "Resolving latest gem versions..."
63
63
  updater_class = options.latest? ? Latest::Updater : Updater
64
- updater = updater_class.new(groups: options.exclusively)
64
+ updater = updater_class.new(groups: options.exclusively, only_explicit: options.only_explicit?)
65
65
 
66
66
  report = updater.generate_report
67
67
  unless report.empty?
@@ -22,5 +22,9 @@ module BundleUpdateInteractive
22
22
  def dependencies
23
23
  @dependencies.values
24
24
  end
25
+
26
+ def gem_names
27
+ dependencies.map(&:name)
28
+ end
25
29
  end
26
30
  end
@@ -2,7 +2,8 @@
2
2
 
3
3
  module BundleUpdateInteractive
4
4
  class Updater
5
- def initialize(groups: [])
5
+ def initialize(groups: [], only_explicit: false)
6
+ @only_explicit = only_explicit
6
7
  @gemfile = Gemfile.parse
7
8
  @current_lockfile = Lockfile.parse
8
9
  @candidate_gems = current_lockfile.gems_exclusively_installed_by(gemfile: gemfile, groups: groups) if groups.any?
@@ -32,12 +33,14 @@ module BundleUpdateInteractive
32
33
 
33
34
  private
34
35
 
35
- attr_reader :gemfile, :current_lockfile, :candidate_gems
36
+ attr_reader :gemfile, :current_lockfile, :candidate_gems, :only_explicit
36
37
 
37
38
  def find_updatable_gems
38
39
  return {} if candidate_gems && candidate_gems.empty?
39
40
 
40
- build_outdated_gems(BundlerCommands.read_updated_lockfile(*Array(candidate_gems)))
41
+ updatable = build_outdated_gems(BundlerCommands.read_updated_lockfile(*Array(candidate_gems)))
42
+ updatable = updatable.slice(*gemfile.gem_names) if only_explicit
43
+ updatable
41
44
  end
42
45
 
43
46
  def build_outdated_gems(lockfile_contents)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BundleUpdateInteractive
4
- VERSION = "0.9.1"
4
+ VERSION = "0.10.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundle_update_interactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brictson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-24 00:00:00.000000000 Z
11
+ date: 2024-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler