methadone 1.3.1 → 1.3.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/features/bootstrap.feature +8 -15
- data/lib/methadone/cli_logger.rb +13 -3
- data/lib/methadone/version.rb +1 -1
- data/test/test_cli_logger.rb +22 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34efc1c3a2d8209ce45d31de375c52a3cb0fa3d8
|
4
|
+
data.tar.gz: 957eeb5f82278810774d35308356768ca4e038c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e796c7cb5fa1980a1a1ca09ce3bb68f0c2c48acdd4e2ce9f5f3c95d1aea33654ee549b8b204bdae387b9c89aa3188496703a87366d93e4d97e1994f5a254c98a
|
7
|
+
data.tar.gz: 68e86c8dcb4f412282af3fc9056e73a56b5dfe03d791509fd04c94d960cfb90f576d4541c457bae1c2fe02547f991d37b376d604277c441e09cf756ae69b4e86
|
data/.travis.yml
CHANGED
data/features/bootstrap.feature
CHANGED
@@ -50,20 +50,14 @@ Feature: Bootstrap a new command-line app
|
|
50
50
|
|--log-level|
|
51
51
|
And the banner should document that this app takes no arguments
|
52
52
|
When I successfully run `rake -T -I../../lib`
|
53
|
-
Then the output should
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
"""
|
62
|
-
rake rdoc # Build RDoc HTML files
|
63
|
-
rake release # Create tag v0.0.1 and build and push newgem-0.0.1.gem to Rubygems
|
64
|
-
rake rerdoc # Rebuild RDoc HTML files
|
65
|
-
rake test # Run tests
|
66
|
-
"""
|
53
|
+
Then the output should match /rake clean/
|
54
|
+
Then the output should match /rake clobber/
|
55
|
+
Then the output should match /rake clobber_rdoc/
|
56
|
+
Then the output should match /rake features/
|
57
|
+
Then the output should match /rake rdoc/
|
58
|
+
Then the output should match /rake release/
|
59
|
+
Then the output should match /rake rerdoc/
|
60
|
+
Then the output should match /rake test/
|
67
61
|
And the output should match /rake install # Build and install newgem-0.0.1.gem into system gems/
|
68
62
|
And the output should match /rake build # Build newgem-0.0.1.gem into the pkg directory/
|
69
63
|
When I run `rake -I../../../../lib`
|
@@ -111,7 +105,6 @@ Feature: Bootstrap a new command-line app
|
|
111
105
|
new-gem version 0.0.1
|
112
106
|
"""
|
113
107
|
|
114
|
-
@wip
|
115
108
|
Scenario: Version flag can be used to only show the app version with a custom format
|
116
109
|
Given I successfully run `methadone tmp/new-gem`
|
117
110
|
And "bin/new-gem" has configured version to show only the version with a custom format and not help
|
data/lib/methadone/cli_logger.rb
CHANGED
@@ -85,13 +85,16 @@ module Methadone
|
|
85
85
|
super(log_device)
|
86
86
|
@stderr_logger = Logger.new(error_device)
|
87
87
|
|
88
|
-
|
88
|
+
log_device_tty = tty?(log_device)
|
89
|
+
error_device_tty = tty?(error_device)
|
90
|
+
|
91
|
+
@split_logs = log_device_tty && error_device_tty
|
89
92
|
|
90
93
|
self.level = Logger::Severity::INFO
|
91
94
|
@stderr_logger.level = DEFAULT_ERROR_LEVEL
|
92
95
|
|
93
|
-
self.formatter = BLANK_FORMAT if
|
94
|
-
@stderr_logger.formatter = BLANK_FORMAT if
|
96
|
+
self.formatter = BLANK_FORMAT if log_device_tty
|
97
|
+
@stderr_logger.formatter = BLANK_FORMAT if error_device_tty
|
95
98
|
end
|
96
99
|
|
97
100
|
def level=(level)
|
@@ -119,5 +122,12 @@ module Methadone
|
|
119
122
|
@stderr_logger.formatter=formatter
|
120
123
|
end
|
121
124
|
|
125
|
+
private
|
126
|
+
|
127
|
+
def tty?(device_or_string)
|
128
|
+
return device_or_string.tty? if device_or_string.respond_to? :tty?
|
129
|
+
false
|
130
|
+
end
|
131
|
+
|
122
132
|
end
|
123
133
|
end
|
data/lib/methadone/version.rb
CHANGED
data/test/test_cli_logger.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'base_test'
|
2
2
|
require 'methadone'
|
3
3
|
require 'stringio'
|
4
|
+
require 'tempfile'
|
4
5
|
|
5
6
|
class TestCLILogger < BaseTest
|
6
7
|
include Methadone
|
@@ -158,6 +159,27 @@ class TestCLILogger < BaseTest
|
|
158
159
|
}
|
159
160
|
end
|
160
161
|
|
162
|
+
test_that "we can use filenames as log devices" do
|
163
|
+
Given {
|
164
|
+
tempfile = Tempfile.new("stderr_log")
|
165
|
+
@stdout_file = tempfile.path
|
166
|
+
tempfile.close
|
167
|
+
|
168
|
+
tempfile = Tempfile.new("stdout_log")
|
169
|
+
@stderr_file = tempfile.path
|
170
|
+
tempfile.close
|
171
|
+
}
|
172
|
+
When {
|
173
|
+
@logger = CLILogger.new(@stdout_file,@stderr_file)
|
174
|
+
@logger.info("some info")
|
175
|
+
@logger.error("some error")
|
176
|
+
}
|
177
|
+
Then {
|
178
|
+
File.read(@stdout_file).should =~ /some info/
|
179
|
+
File.read(@stderr_file).should =~ /some error/
|
180
|
+
}
|
181
|
+
end
|
182
|
+
|
161
183
|
private
|
162
184
|
|
163
185
|
def log_all_levels
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: methadone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- davetron5000
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
260
|
rubyforge_project: methadone
|
261
|
-
rubygems_version: 2.0.
|
261
|
+
rubygems_version: 2.0.14
|
262
262
|
signing_key:
|
263
263
|
specification_version: 4
|
264
264
|
summary: Kick the bash habit and start your command-line apps off right
|