summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/source.rb2
-rw-r--r--lib/bundler/ui/shell.rb4
-rw-r--r--lib/bundler/ui/silent.rb3
-rw-r--r--spec/bundler/source_spec.rb2
4 files changed, 9 insertions, 2 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 5f1eb130b7..eee4ade45b 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -18,7 +18,7 @@ module Bundler
locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
locked_spec_version = locked_spec.version if locked_spec
if locked_spec_version && spec.version != locked_spec_version
- message += " (was #{locked_spec_version})"
+ message += " (#{Bundler.ui.add_color("was #{locked_spec_version}", :green)})"
end
end
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index 425ffae332..1317b1838a 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -17,6 +17,10 @@ module Bundler
@warning_history = []
end
+ def add_color(string, color)
+ @shell.set_color(string, color)
+ end
+
def info(msg, newline = nil)
tell_me(msg, nil, newline) if level("info")
end
diff --git a/lib/bundler/ui/silent.rb b/lib/bundler/ui/silent.rb
index 9f387d9e9f..af512eced3 100644
--- a/lib/bundler/ui/silent.rb
+++ b/lib/bundler/ui/silent.rb
@@ -2,6 +2,9 @@
module Bundler
module UI
class Silent
+ def add_color(string, color)
+ end
+
def info(message, newline = nil)
end
diff --git a/spec/bundler/source_spec.rb b/spec/bundler/source_spec.rb
index 1b4e4bdde9..fc28220c7d 100644
--- a/spec/bundler/source_spec.rb
+++ b/spec/bundler/source_spec.rb
@@ -58,7 +58,7 @@ describe Bundler::Source do
let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "< 1.5") }
it "should return a string with the spec name and version and locked spec version" do
- expect(subject.version_message(spec)).to eq("nokogiri >= 1.6 (was < 1.5)")
+ expect(subject.version_message(spec)).to eq("nokogiri >= 1.6 (\e[32mwas < 1.5\e[0m)")
end
end
end