tango 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/tango/logger.rb +9 -3
- data/lib/tango/version.rb +1 -1
- data/spec/logger_spec.rb +16 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/tango/logger.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
module Tango
|
4
4
|
module TermANSIColorStubs
|
5
|
-
[:red, :green, :yellow]
|
5
|
+
ALLOWED_COLOURS = [:red, :green, :yellow]
|
6
|
+
ALLOWED_COLOURS.each do |color|
|
6
7
|
define_method(color) { |str| str }
|
7
8
|
end
|
8
9
|
end
|
@@ -39,8 +40,13 @@ module Tango
|
|
39
40
|
log "} #{red("✕ #{step_name}")}\n\n"
|
40
41
|
end
|
41
42
|
|
42
|
-
def log(message)
|
43
|
-
|
43
|
+
def log(message, colour = nil)
|
44
|
+
if colour && ALLOWED_COLOURS.include?(colour)
|
45
|
+
@io.puts send(colour,"#{indent}#{message}")
|
46
|
+
|
47
|
+
else
|
48
|
+
@io.puts "#{indent}#{message}"
|
49
|
+
end
|
44
50
|
end
|
45
51
|
|
46
52
|
def log_raw(message)
|
data/lib/tango/version.rb
CHANGED
data/spec/logger_spec.rb
CHANGED
@@ -33,5 +33,21 @@ module Tango
|
|
33
33
|
@logger.begin_step("inner step")
|
34
34
|
@io.string.should == "outer step {\n inner step {\n"
|
35
35
|
end
|
36
|
+
|
37
|
+
it "should accept a few colours" do
|
38
|
+
@logger.should_receive(:red)
|
39
|
+
@logger.log("hello", :red)
|
40
|
+
|
41
|
+
@logger.should_receive(:yellow)
|
42
|
+
@logger.log("hello", :yellow)
|
43
|
+
|
44
|
+
@logger.should_receive(:green)
|
45
|
+
@logger.log("hello", :green)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should ignore other colours" do
|
49
|
+
@logger.should_not_receive(:brown)
|
50
|
+
@logger.log("hello", :brown)
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tango
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70352874942700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70352874942700
|
25
25
|
description: Experiment in deployment tools, taking ideas from babushka and elsewhere.
|
26
26
|
email:
|
27
27
|
- pete@notahat.com
|