Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Make outdated output more "grepable"
Browse files Browse the repository at this point in the history
- Minimal solution
  • Loading branch information
Stefan Lance committed Mar 27, 2015
1 parent 71b34bb commit c6a14fc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/bundler/cli/outdated.rb
Expand Up @@ -63,6 +63,13 @@ def run
spec_version = "#{active_spec.version}#{active_spec.git_version}"
current_version = "#{current_spec.version}#{current_spec.git_version}"
dependency_version = %|Gemfile specifies "#{dependency.requirement}"| if dependency && dependency.specific?

if options["verbose"] && dependency_version
fmt_groups = dependency.groups.join(", ")
pl = (dependency.groups.length > 1) ? "s" : ""
dependency_version << " in group#{pl} \"#{fmt_groups}\""
end

Bundler.ui.info " * #{active_spec.name} (#{spec_version} > #{current_version}) #{dependency_version}".rstrip
out_count += 1
end
Expand Down
22 changes: 22 additions & 0 deletions spec/commands/outdated_spec.rb
Expand Up @@ -31,6 +31,8 @@
expect(out).to include("weakling (0.2 > 0.0.3) Gemfile specifies \"~> 0.0.1\"")
expect(out).to include("foo (1.0")

puts out

# Gem names are one per-line, between "*" and their parenthesized version.
gem_list = out.split("\n").map { |g| g[ /\* (.*) \(/, 1] }.compact
expect(gem_list).to eq(gem_list.sort)
Expand All @@ -54,6 +56,26 @@
end
end

describe "with --verbose option" do
it "adds gem group to dependency output when repo is updated" do

install_gemfile <<-G
source "file://#{gem_repo2}"
group :development, :test do
gem 'activesupport', '2.3.5'
end
G

update_repo2 { build_gem "activesupport", "3.0" }

bundle "outdated --verbose"

expect(out).to include("activesupport (3.0 > 2.3.5) Gemfile specifies \"= 2.3.5\" in groups \"development, test\"")

end
end

describe "with --local option" do
it "doesn't hit repo2" do
FileUtils.rm_rf(gem_repo2)
Expand Down

0 comments on commit c6a14fc

Please sign in to comment.