-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Show release date with bundle outdated #9337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -199,7 +199,11 @@ def print_gem(current_spec, active_spec, dependency, groups) | |
| end | ||
|
|
||
| spec_outdated_info = "#{active_spec.name} (newest #{spec_version}, " \ | ||
| "installed #{current_version}#{dependency_version})" | ||
| "installed #{current_version}#{dependency_version}" | ||
|
|
||
| release_date = release_date_for(active_spec) | ||
| spec_outdated_info += ", released #{release_date}" unless release_date.empty? | ||
| spec_outdated_info += ")" | ||
|
|
||
| output_message = if options[:parseable] | ||
| spec_outdated_info.to_s | ||
|
|
@@ -218,6 +222,7 @@ def gem_column_for(current_spec, active_spec, dependency, groups) | |
| dependency = dependency.requirement if dependency | ||
|
|
||
| ret_val = [active_spec.name, current_version, spec_version, dependency.to_s, groups.to_s] | ||
| ret_val << release_date_for(active_spec) | ||
| ret_val << loaded_from_for(active_spec).to_s if Bundler.ui.debug? | ||
| ret_val | ||
| end | ||
|
|
@@ -283,11 +288,28 @@ def print_indented(matrix) | |
| end | ||
|
|
||
| def table_header | ||
| header = ["Gem", "Current", "Latest", "Requested", "Groups"] | ||
| header = ["Gem", "Current", "Latest", "Requested", "Groups", "Release Date"] | ||
| header << "Path" if Bundler.ui.debug? | ||
| header | ||
| end | ||
|
|
||
| def release_date_for(spec) | ||
| return "" unless spec.respond_to?(:date) | ||
|
|
||
| date = spec.date | ||
| return "" unless date | ||
|
|
||
| return "" unless Gem.const_defined?(:DEFAULT_SOURCE_DATE_EPOCH) | ||
| default_date = Time.at(Gem::DEFAULT_SOURCE_DATE_EPOCH).utc | ||
| default_date = Time.utc(default_date.year, default_date.month, default_date.day) | ||
|
|
||
| date = date.utc if date.respond_to?(:utc) | ||
|
|
||
| return "" if date == default_date | ||
|
|
||
| date.strftime("%Y-%m-%d") | ||
| end | ||
|
Comment on lines
296
to
311
|
||
|
|
||
| def justify(row, sizes) | ||
| row.each_with_index.map do |element, index| | ||
| element.ljust(sizes[index]) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,29 +82,29 @@ in the output. | |
|
|
||
| If the regular output shows the following: | ||
|
|
||
| * Gem Current Latest Requested Groups | ||
| * faker 1.6.5 1.6.6 ~> 1.4 development, test | ||
| * hashie 1.2.0 3.4.6 = 1.2.0 default | ||
| * headless 2.2.3 2.3.1 = 2.2.3 test | ||
| * Gem Current Latest Requested Groups Release Date | ||
| * faker 1.6.5 1.6.6 ~> 1.4 development, test 2024-02-05 | ||
| * hashie 1.2.0 3.4.6 = 1.2.0 default 2023-11-10 | ||
| * headless 2.2.3 2.3.1 = 2.2.3 test 2022-08-19 | ||
|
Comment on lines
+85
to
+88
|
||
|
|
||
| `--filter-major` would only show: | ||
|
|
||
| * Gem Current Latest Requested Groups | ||
| * hashie 1.2.0 3.4.6 = 1.2.0 default | ||
| * Gem Current Latest Requested Groups Release Date | ||
| * hashie 1.2.0 3.4.6 = 1.2.0 default 2023-11-10 | ||
|
|
||
| `--filter-minor` would only show: | ||
|
|
||
| * Gem Current Latest Requested Groups | ||
| * headless 2.2.3 2.3.1 = 2.2.3 test | ||
| * Gem Current Latest Requested Groups Release Date | ||
| * headless 2.2.3 2.3.1 = 2.2.3 test 2022-08-19 | ||
|
|
||
| `--filter-patch` would only show: | ||
|
|
||
| * Gem Current Latest Requested Groups | ||
| * faker 1.6.5 1.6.6 ~> 1.4 development, test | ||
| * Gem Current Latest Requested Groups Release Date | ||
| * faker 1.6.5 1.6.6 ~> 1.4 development, test 2024-02-05 | ||
|
|
||
| Filter options can be combined. `--filter-minor` and `--filter-patch` would show: | ||
|
|
||
| * Gem Current Latest Requested Groups | ||
| * faker 1.6.5 1.6.6 ~> 1.4 development, test | ||
| * Gem Current Latest Requested Groups Release Date | ||
| * faker 1.6.5 1.6.6 ~> 1.4 development, test 2024-02-05 | ||
|
|
||
| Combining all three `filter` options would be the same result as providing none of them. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default-date suppression compares against
Gem::DEFAULT_SOURCE_DATE_EPOCH, butGem::Specification#datedefaults toGem.source_date_epoch(which may differ whenSOURCE_DATE_EPOCHis set). In those environments, gems with no real packaged date can end up showing an arbitrary build-epoch date as the “Release Date”. Consider avoiding callingspec.datewhen the date wasn’t explicitly set (e.g., check the underlying ivar), or compare againstGem.source_date_epochusing the same normalization RubyGems uses.