summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-03-12 04:59:25 +0900
committerHomu <homu@barosl.com>2016-03-12 04:59:25 +0900
commit91b5ba65368e5b65bb36efe01be5dc5f4a595d86 (patch)
tree6860e750ae4251e597f4f56ff2f3dcb87424ce55
parent2aa6108c33960e383ccaa921e886f55182034a74 (diff)
parentd5eeff68fe3a6171ea47017e4de291bb5e96eb69 (diff)
downloadbundler-91b5ba65368e5b65bb36efe01be5dc5f4a595d86.tar.gz
Auto merge of #4342 - bronzdoc:colorize_gem_updates, r=segiddins
Colorize gem updates closes https://github.com/bundler/bundler/issues/4334 ![alt tag](http://i.imgur.com/djHFR95.png)
-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