diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index e5c927338388..975bff1e204b 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -192,7 +192,7 @@ def print_gems_table(gems_list) ) end - print_indented([table_header] + data) + print_indented([table_header] + data, !options_include_groups) end def print_gem(current_spec, active_spec, dependency, groups) @@ -294,7 +294,7 @@ def get_version_semver_portion_value(spec, version_portion_index) version_section.to_a[0].to_i end - def print_indented(matrix) + def print_indented(matrix, sort = true) header = matrix[0] data = matrix[1..-1] @@ -304,7 +304,7 @@ def print_indented(matrix) Bundler.ui.info justify(header, column_sizes) - data.sort_by! {|row| row[0] } + data.sort_by! {|row| row[0] } if sort data.each do |row| Bundler.ui.info justify(row, column_sizes) diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb index e6a276cceafd..0f9652c4d5e8 100644 --- a/spec/commands/outdated_spec.rb +++ b/spec/commands/outdated_spec.rb @@ -274,6 +274,7 @@ def test_group_option(group) build_repo2 do build_git "foo", path: lib_path("foo") build_git "zebra", path: lib_path("zebra") + build_gem "zondrian", "1.2" end install_gemfile <<-G @@ -284,6 +285,7 @@ def test_group_option(group) group :development, :test do gem 'activesupport', '2.3.5' gem "duradura", '7.0' + gem "zondrian", '1.2' end G end @@ -298,15 +300,17 @@ def test_group_option(group) build_gem "activesupport", "3.0" build_gem "terranova", "9" build_gem "duradura", "8.0" + build_gem "zondrian", "1.3" end bundle "outdated --groups", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups Release Date + terranova 8 9 = 8 default activesupport 2.3.5 3.0 = 2.3.5 development, test duradura 7.0 8.0 = 7.0 development, test - terranova 8 9 = 8 default + zondrian 1.2 1.3 = 1.2 development, test TABLE expect(out).to end_with(expected_output)