foreman 0.48.0.pre1 → 0.48.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/foreman/cli.rb CHANGED
@@ -15,6 +15,7 @@ class Foreman::CLI < Thor
15
15
 
16
16
  desc "start [PROCESS]", "Start the application (or a specific PROCESS)"
17
17
 
18
+ method_option :color, :type => :boolean, :aliases => "-c", :desc => "Force color to be enabled"
18
19
  method_option :env, :type => :string, :aliases => "-e", :desc => "Specify an environment file to load, defaults to .env"
19
20
  method_option :formation, :type => :string, :aliases => "-m", :banner => '"alpha=5,bar=3"'
20
21
  method_option :port, :type => :numeric, :aliases => "-p"
@@ -83,11 +84,7 @@ class Foreman::CLI < Thor
83
84
  def engine
84
85
  @engine ||= begin
85
86
  engine_class = Foreman::Engine::CLI
86
- engine = engine_class.new(
87
- :formation => options[:formation],
88
- :port => options[:port],
89
- :root => options[:root]
90
- )
87
+ engine = engine_class.new(options)
91
88
  engine
92
89
  end
93
90
  end
@@ -24,11 +24,13 @@ class Foreman::Engine::CLI < Foreman::Engine
24
24
  :bright_white => 37,
25
25
  }
26
26
 
27
- def self.enable(io)
27
+ def self.enable(io, force=false)
28
28
  io.extend(self)
29
+ @@color_force = force
29
30
  end
30
31
 
31
32
  def color?
33
+ return true if @@color_force
32
34
  return false unless self.respond_to?(:isatty)
33
35
  self.isatty && ENV["TERM"]
34
36
  end
@@ -51,14 +53,17 @@ class Foreman::Engine::CLI < Foreman::Engine
51
53
 
52
54
  def output(name, data)
53
55
  data.to_s.chomp.split("\n").each do |message|
54
- Color.enable($stdout) unless $stdout.respond_to?(:color?)
56
+ Color.enable($stdout, options[:color]) unless $stdout.respond_to?(:color?)
55
57
  output = ""
56
58
  output += $stdout.color(@colors[name.split(".").first].to_sym)
57
59
  output += "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(name)} | "
58
60
  output += $stdout.color(:reset)
59
61
  output += message
60
62
  $stdout.puts output
63
+ $stdout.flush
61
64
  end
65
+ rescue Errno::EPIPE
66
+ terminate_gracefully
62
67
  end
63
68
 
64
69
  def shutdown
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.48.0.pre1"
3
+ VERSION = "0.48.0.pre2"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.48.0.pre1
4
+ version: 0.48.0.pre2
5
5
  prerelease: 7
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-06-11 00:00:00.000000000 Z
12
+ date: 2012-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70346306226760 !ruby/object:Gem::Requirement
16
+ requirement: &70300230243500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.13.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70346306226760
24
+ version_requirements: *70300230243500
25
25
  description: Process manager for applications with multiple components
26
26
  email: ddollar@gmail.com
27
27
  executables: