cocaine 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of cocaine might be problematic. Click here for more details.

data/NEWS.md CHANGED
@@ -1,3 +1,8 @@
1
+ New for 0.4.2:
2
+
3
+ * Loggers that don't understand `tty?`, like `ActiveSupport::BufferedLogger`
4
+ will still work.
5
+
1
6
  New for 0.4.1:
2
7
 
3
8
  * Introduce FakeRunner for testing, so you don't really run commands.
@@ -21,5 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency('mocha')
22
22
  s.add_development_dependency('rake')
23
23
  s.add_development_dependency('posix-spawn')
24
+ s.add_development_dependency('active_support')
25
+ s.add_development_dependency('pry')
24
26
  end
25
27
 
@@ -95,7 +95,7 @@ module Cocaine
95
95
  private
96
96
 
97
97
  def colored(text, ansi_color = "\e[32m")
98
- if @logger && @logger.tty?
98
+ if @logger && @logger.respond_to?(:tty?) && @logger.tty?
99
99
  "#{ansi_color}#{text}\e[0m"
100
100
  else
101
101
  text
@@ -1,3 +1,3 @@
1
1
  module Cocaine
2
- VERSION = "0.4.1".freeze
2
+ VERSION = "0.4.2".freeze
3
3
  end
@@ -179,6 +179,15 @@ describe Cocaine::CommandLine do
179
179
  logger.entries.should include("\e[32mCommand\e[0m :: echo 'Logging!' 'bar'")
180
180
  end
181
181
 
182
+ it 'can still take something that does not respond to tty as a logger' do
183
+ output_buffer = StringIO.new
184
+ logger = ActiveSupport::BufferedLogger.new(output_buffer)
185
+ logger.should_not respond_to(:tty?)
186
+ Cocaine::CommandLine.new("echo", "'Logging!' :foo", :logger => logger).run(:foo => "bar")
187
+ output_buffer.rewind
188
+ output_buffer.read.should == "Command :: echo 'Logging!' 'bar'\n"
189
+ end
190
+
182
191
  it "logs the command to a supplied logger" do
183
192
  logger = FakeLogger.new
184
193
  Cocaine::CommandLine.new("echo", "'Logging!' :foo", :logger => logger).run(:foo => "bar")
@@ -4,6 +4,8 @@ require 'bourne'
4
4
  require 'cocaine'
5
5
  require 'timeout'
6
6
  require 'tempfile'
7
+ require 'pry'
8
+ require 'active_support/buffered_logger'
7
9
 
8
10
  Dir[File.dirname(__FILE__) + "/support/**.rb"].each{|support_file| require support_file }
9
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocaine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -91,6 +91,38 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: active_support
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: pry
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
94
126
  description: A small library for doing (command) lines
95
127
  email: jyurek@thoughtbot.com
96
128
  executables: []