bundler-versions_report 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d0eaee09b6ca8a99bdc875830c8cbe7145179fa84e2de8db9042f3a5ec3bba92
4
+ data.tar.gz: f7a3dc0034276415563b2aa9e6be90048148d806e12a518e7bcf19a6bd632a25
5
+ SHA512:
6
+ metadata.gz: 680da7a118a2deb96e1bf91025cd3fd36179ad0d656679777aa501cd0692ab252a39e22d8d6f70ee5eee36461cb85d93d429d087102bb0d169faa326cdb17158
7
+ data.tar.gz: ddb9397dd16bc8e9cd38e3990a0ee958e8b09c522fc64503fbcfa8d9bd7a0cdc8c45a49cc13ac4a42feb347aa069430869889b9e5e04c395220473c5855f74b0
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-01-27
4
+
5
+ - Initial release
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jakub Pavlík
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Bundler::VersionsReport
2
+
3
+ [Bundler][bundler] plugin extending the output of `bundle update` with a report of gems
4
+ updated by a major or minor version.
5
+
6
+ We assume [semantic versioning][semver]: major version updates definitely deserve attention;
7
+ minor version ones should be backward-compatible, but may be worth attention nevertheless;
8
+ updates beyond the major and minor version are considered harmless.
9
+
10
+ ```
11
+ MINOR version updates:
12
+ - builder 3.2.4 -> 3.3.0 (by 1 minor versions)
13
+ - concurrent-ruby 1.2.3 -> 1.3.5 (by 1 minor versions)
14
+ - dry-inflector 1.0.0 -> 1.2.0 (by 2 minor versions)
15
+ - jbuilder 2.11.5 -> 2.13.0 (by 2 minor versions)
16
+ - loofah 2.22.0 -> 2.24.0 (by 2 minor versions)
17
+ - rouge 4.2.1 -> 4.5.1 (by 3 minor versions)
18
+ - tilt 2.3.0 -> 2.6.0 (by 3 minor versions)
19
+ - tins 1.32.1 -> 1.38.0 (by 6 minor versions)
20
+
21
+ MAJOR version updates:
22
+ - rspec-rails 6.1.2 -> 7.1.0 (by 1 major versions)
23
+ ```
24
+
25
+ ## Installation
26
+
27
+ `$ bundle plugin install bundler-versions_report`
28
+
29
+ ## Development
30
+
31
+ 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.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ [bundler]: https://bundler.io
36
+ [semver]: https://semver.org
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec]
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/bundler/versions_report/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bundler-versions_report"
7
+ spec.version = Bundler::VersionsReport::VERSION
8
+ spec.authors = ["Jakub Pavlík"]
9
+ spec.email = ["jkb.pavlik@gmail.com"]
10
+
11
+ spec.summary = "Bundler plugin extending 'bundle update' with a report of gems updated by a major or minor version"
12
+ # spec.description = ""
13
+ spec.homepage = "https://github.com/igneus/bundler-versions_report"
14
+ spec.licenses = ["MIT"]
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (File.expand_path(f) == __FILE__) ||
26
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Uncomment to register a new dependency of your gem
34
+ # spec.add_dependency "example-gem", "~> 1.0"
35
+
36
+ # For more information and examples about making a new gem, check out our
37
+ # guide at: https://bundler.io/guides/creating_gem.html
38
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module VersionsReport
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "versions_report/version"
data/plugins.rb ADDED
@@ -0,0 +1,103 @@
1
+ require 'bundler/versions_report'
2
+
3
+ Bundler::Plugin.add_hook 'before-install-all' do
4
+ Bundler::VersionsReport.save_locked
5
+ end
6
+
7
+ Bundler::Plugin.add_hook 'before-install' do |spec_installation|
8
+ Bundler::VersionsReport.check spec_installation.spec
9
+ end
10
+
11
+ Bundler::Plugin.add_hook 'after-install-all' do
12
+ Bundler::VersionsReport.report
13
+ end
14
+
15
+ module Bundler
16
+ module VersionsReport
17
+ # save gem versions locked before the update
18
+ def self.save_locked
19
+ @updated = []
20
+ @previous_locked = Bundler.locked_gems.specs.inject({}) do |memo, spec|
21
+ memo[spec.name] = spec.version
22
+ memo
23
+ end
24
+ end
25
+
26
+ # check if the given gem is being updated
27
+ def self.check(spec)
28
+ previous_spec = @previous_locked[spec.name]
29
+ if previous_spec && spec.version != previous_spec.version
30
+ @updated << Update.new(spec.name, spec.version, Gem::Version.new(previous_spec.version))
31
+ end
32
+ end
33
+
34
+ # report major and minor version updates
35
+ def self.report
36
+ report = Report.new @updated
37
+
38
+ if report.significant?
39
+ puts
40
+ puts report
41
+ puts
42
+ end
43
+ end
44
+
45
+ class Update
46
+ SEGMENT_NAMES = %i[major minor patch]
47
+
48
+ attr_reader :gem_name,
49
+ :version,
50
+ :previous_version,
51
+ :update_type, # major/minor/patch
52
+ :update_by # version number difference
53
+
54
+ def initialize(gem_name, version, previous_version)
55
+ @gem_name = gem_name
56
+ @version = version
57
+ @previous_version = previous_version
58
+
59
+ version
60
+ .segments
61
+ .zip(previous_version.segments)
62
+ .each_with_index
63
+ .find {|((ver, prev), i)| ver != prev }
64
+ &.then do |((ver, prev), i)|
65
+ @update_type = SEGMENT_NAMES[i]
66
+ @update_by = ver - prev
67
+ end
68
+ end
69
+ end
70
+
71
+ class Report
72
+ SIGNIFICANT_SEGMENTS = Update::SEGMENT_NAMES[0..1]
73
+
74
+ def initialize(updates)
75
+ @data =
76
+ updates
77
+ .sort_by {|u| [u.update_by, u.gem_name] }
78
+ .group_by(&:update_type)
79
+ end
80
+
81
+ def significant?
82
+ SIGNIFICANT_SEGMENTS.find {|s| @data[s] }
83
+ end
84
+
85
+ def to_s
86
+ r = StringIO.new
87
+
88
+ SIGNIFICANT_SEGMENTS
89
+ .reverse # most important last, we are in the terminal
90
+ .each do |s|
91
+ next unless @data[s]
92
+
93
+ r.puts "\n#{s.to_s.upcase} version updates:"
94
+ @data[s].each do |update|
95
+ r.puts "- #{update.gem_name} #{update.previous_version} -> #{update.version} (by #{update.update_by} #{s} versions)"
96
+ end
97
+ end
98
+
99
+ r.string
100
+ end
101
+ end
102
+ end
103
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-versions_report
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jakub Pavlík
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-01-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - jkb.pavlik@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - ".rubocop.yml"
22
+ - CHANGELOG.md
23
+ - LICENSE
24
+ - README.md
25
+ - Rakefile
26
+ - bundler-versions_report.gemspec
27
+ - lib/bundler/versions_report.rb
28
+ - lib/bundler/versions_report/version.rb
29
+ - plugins.rb
30
+ homepage: https://github.com/igneus/bundler-versions_report
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ homepage_uri: https://github.com/igneus/bundler-versions_report
35
+ source_code_uri: https://github.com/igneus/bundler-versions_report
36
+ changelog_uri: https://github.com/igneus/bundler-versions_report/blob/master/CHANGELOG.md
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.6.0
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubygems_version: 3.5.3
53
+ signing_key:
54
+ specification_version: 4
55
+ summary: Bundler plugin extending 'bundle update' with a report of gems updated by
56
+ a major or minor version
57
+ test_files: []