fate 0.2.17 → 0.2.18

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.
@@ -7,6 +7,7 @@ class Fate
7
7
 
8
8
  attr_reader :width, :io
9
9
  def initialize(options)
10
+ @disable_color = options[:disable_color]
10
11
  @width = options[:width]
11
12
  if file = options[:file]
12
13
  @io = File.new(file, "a")
@@ -47,7 +48,7 @@ class Fate
47
48
  end
48
49
 
49
50
  def write(name, string, color=nil)
50
- if color
51
+ if color && !@disable_color
51
52
  line = colorize(color, format(name, string))
52
53
  else
53
54
  line = format(name, string)
@@ -58,7 +59,11 @@ class Fate
58
59
  end
59
60
 
60
61
  def error(name, string)
61
- write(name, string, "red")
62
+ write(name, "ERROR: #{string}", "red")
63
+ end
64
+
65
+ def warn(name, string)
66
+ write(name, "WARN: #{string}", "magenta")
62
67
  end
63
68
 
64
69
  def green(name, string)
@@ -70,7 +75,7 @@ class Fate
70
75
  end
71
76
 
72
77
  def debug(name, string)
73
- write(name, string)
78
+ write(name, string, "cyan")
74
79
  end
75
80
 
76
81
  def format(name, string)
@@ -46,7 +46,7 @@ class Fate
46
46
 
47
47
  def start_command(name, command)
48
48
  if pid = @pids_by_name[name]
49
- logger.error "'#{name}' is already running with pid #{pid}"
49
+ logger.warn "'#{name}' is already running with pid #{pid}"
50
50
  else
51
51
  spawn(name, command)
52
52
  end
@@ -58,7 +58,11 @@ class Fate
58
58
  @completions.merge @groups.keys
59
59
 
60
60
  @longest_name = @commands.keys.sort_by {|k| k.size }.last.size
61
- @logger = Fate::MultiLogger.new(:io => STDOUT, :width => @longest_name)
61
+ @logger = Fate::MultiLogger.new(
62
+ :io => STDOUT,
63
+ :width => @longest_name,
64
+ :disable_color => options[:disable_color]
65
+ )
62
66
  @output_handlers = Output::Handlers.new(self, options[:output] || {})
63
67
  end
64
68
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-01 00:00:00.000000000 Z
12
+ date: 2013-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json