libyear-bundler 0.6.1 → 0.7.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 +4 -4
- data/lib/libyear_bundler/cli.rb +2 -2
- data/lib/libyear_bundler/models/ruby.rb +8 -6
- data/lib/libyear_bundler/report.rb +13 -6
- data/lib/libyear_bundler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4f90004a4a8f93453f73361a0e3415344017e83f55d10d625b0a3b69f1db74b
|
4
|
+
data.tar.gz: 55d91c831ae79f5b44c6de0bcd2f68e550590d73d5004646c1da0163abbcebea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3b1346dbdc4986e539fba595f18e01a46fd03d647210b34a6810e2bd9ae61028ffa00eae7e4e2c4088f524368a2cc74950f5d79610ab6aa2bd93d5c4cdd9e6a
|
7
|
+
data.tar.gz: 2196cc0fe1a16f2fd9ea4646eb7d07a227d58f07dc5f2cca3724c8ae4b08d4386adbdbc51f3364f2891745e7202b106348dabefed1734a6eb3b11c38823e4f17
|
data/lib/libyear_bundler/cli.rb
CHANGED
@@ -26,7 +26,7 @@ module LibyearBundler
|
|
26
26
|
if @options.grand_total?
|
27
27
|
grand_total
|
28
28
|
else
|
29
|
-
|
29
|
+
report.write
|
30
30
|
end
|
31
31
|
|
32
32
|
# Update cache
|
@@ -73,7 +73,7 @@ module LibyearBundler
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def report
|
76
|
-
@_report ||= Report.new(bundle_outdated, ruby, @options)
|
76
|
+
@_report ||= Report.new(bundle_outdated, ruby, @options, $stdout)
|
77
77
|
end
|
78
78
|
|
79
79
|
def ruby
|
@@ -176,18 +176,20 @@ module LibyearBundler
|
|
176
176
|
def version_from_bundler
|
177
177
|
return unless File.exist?(@lockfile)
|
178
178
|
ruby_version_string = ::Bundler::LockfileParser
|
179
|
-
.new(@lockfile)
|
179
|
+
.new(::File.read(@lockfile))
|
180
180
|
.ruby_version
|
181
181
|
return if ruby_version_string.nil?
|
182
|
-
|
183
182
|
::Bundler::RubyVersion.from_string(ruby_version_string).gem_version
|
184
183
|
end
|
185
184
|
|
186
|
-
# TODO: this path should probably be relative to `@lockfile` instead
|
187
|
-
# TODO: of being relative to the current working directory.
|
188
185
|
def version_from_ruby_version_file
|
189
|
-
|
190
|
-
|
186
|
+
version_file = File.join(File.dirname(@lockfile), '.ruby-version')
|
187
|
+
return unless File.exist?(version_file)
|
188
|
+
|
189
|
+
version_string = File.read(version_file).strip
|
190
|
+
version = version_string.split('-', 2).last
|
191
|
+
|
192
|
+
::Gem::Version.new(version) if version
|
191
193
|
end
|
192
194
|
|
193
195
|
def version_from_ruby
|
@@ -9,13 +9,14 @@ module LibyearBundler
|
|
9
9
|
|
10
10
|
# `gems` - Array of `::LibyearBundler::Models::Gem` instances
|
11
11
|
# `options` - Instance of `::LibyearBundler::Options`
|
12
|
-
def initialize(gems, ruby, options)
|
12
|
+
def initialize(gems, ruby, options, io)
|
13
13
|
@gems = gems
|
14
14
|
@ruby = ruby
|
15
15
|
@options = options
|
16
|
+
@io = io
|
16
17
|
end
|
17
18
|
|
18
|
-
def
|
19
|
+
def write
|
19
20
|
to_h[:gems].each { |gem| put_line_summary(gem) }
|
20
21
|
|
21
22
|
begin
|
@@ -72,7 +73,7 @@ module LibyearBundler
|
|
72
73
|
meta << libyears
|
73
74
|
end
|
74
75
|
|
75
|
-
puts meta
|
76
|
+
@io.puts meta
|
76
77
|
end
|
77
78
|
|
78
79
|
def meta_line_summary(gem_or_ruby)
|
@@ -87,11 +88,11 @@ module LibyearBundler
|
|
87
88
|
end
|
88
89
|
|
89
90
|
def put_libyear_summary(sum_libyears)
|
90
|
-
puts format("System is %.1f libyears behind", sum_libyears)
|
91
|
+
@io.puts format("System is %.1f libyears behind", sum_libyears)
|
91
92
|
end
|
92
93
|
|
93
94
|
def put_version_delta_summary(sum_major_version, sum_minor_version, sum_patch_version)
|
94
|
-
puts format(
|
95
|
+
@io.puts format(
|
95
96
|
"Major, minor, patch versions behind: %<major>d, %<minor>d, %<patch>d",
|
96
97
|
major: sum_major_version || 0,
|
97
98
|
minor: sum_minor_version || 0,
|
@@ -100,7 +101,7 @@ module LibyearBundler
|
|
100
101
|
end
|
101
102
|
|
102
103
|
def put_sum_seq_delta_summary(sum_seq_delta)
|
103
|
-
puts format(
|
104
|
+
@io.puts format(
|
104
105
|
"Total releases behind: %<seq_delta>d",
|
105
106
|
seq_delta: sum_seq_delta || 0
|
106
107
|
)
|
@@ -130,11 +131,15 @@ module LibyearBundler
|
|
130
131
|
|
131
132
|
def increment_libyears(model, memo)
|
132
133
|
memo[:sum_libyears] += model.libyears
|
134
|
+
rescue StandardError => e
|
135
|
+
warn "Unable to calculate libyears for #{model.name}: #{e}"
|
133
136
|
end
|
134
137
|
|
135
138
|
def increment_seq_deltas(model, memo)
|
136
139
|
memo[:sum_seq_delta] ||= 0
|
137
140
|
memo[:sum_seq_delta] += model.version_sequence_delta
|
141
|
+
rescue StandardError => e
|
142
|
+
warn "Unable to calculate seq deltas for #{model.name}: #{e}"
|
138
143
|
end
|
139
144
|
|
140
145
|
def increment_version_deltas(model, memo)
|
@@ -144,6 +149,8 @@ module LibyearBundler
|
|
144
149
|
memo[:sum_minor_version] += model.version_number_delta[1]
|
145
150
|
memo[:sum_patch_version] ||= 0
|
146
151
|
memo[:sum_patch_version] += model.version_number_delta[2]
|
152
|
+
rescue StandardError => e
|
153
|
+
warn "Unable to calculate version deltas for #{model.name}: #{e}"
|
147
154
|
end
|
148
155
|
end
|
149
156
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libyear-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Beck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|