methadone 1.9.4 → 1.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/lib/methadone/cli_logger.rb +7 -6
- data/lib/methadone/main.rb +21 -21
- data/lib/methadone/process_status.rb +1 -1
- data/lib/methadone/version.rb +1 -1
- data/methadone.gemspec +2 -2
- data/test/test_sh.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16b7b785cbc498169dcd41650a52eba9aba67e33
|
4
|
+
data.tar.gz: 3d1177ef34caba30beb4808ba3615d82cb0cadf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb015a80a55b3a454b59872ab84890de5ce89000009bf81137a0ca97724ad73601080bd7e431376797347f5ecd53e82749b9a4e051bd742f30e76dd649aea2f6
|
7
|
+
data.tar.gz: 2198036125cd7af64763e7d59a77fe561cd7e8dd4e7be45dc171c7a2bae4f0970ee6ee346a85b1a7aa03651013776827e6b57c5e4c5e96b62be98f2dc4b1fe11
|
data/.travis.yml
CHANGED
data/lib/methadone/cli_logger.rb
CHANGED
@@ -16,7 +16,7 @@ module Methadone
|
|
16
16
|
# is redirected to a file, a better timestamped logging format is used
|
17
17
|
#
|
18
18
|
# You can customize this in several ways:
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# * You can override the devices used by passing different devices to the constructor
|
21
21
|
# * You can adjust the level of message that goes to the error logger via error_level=
|
22
22
|
# * You can adjust the format for messages to the error logger separately via error_formatter=
|
@@ -33,7 +33,7 @@ module Methadone
|
|
33
33
|
# logger.debug("Starting up") # => only the standard output gets this
|
34
34
|
# logger.warn("careful!") # => only the standard OUTPUT gets this
|
35
35
|
# logger.error("Something went wrong!") # => only the standard error gets this
|
36
|
-
#
|
36
|
+
#
|
37
37
|
# logger = CLILogger.new('logfile.txt')
|
38
38
|
# logger.debug("Starting up") # => logfile.txt gets this
|
39
39
|
# logger.error("Something went wrong!") # => BOTH logfile.txt AND the standard error get this
|
@@ -43,7 +43,7 @@ module Methadone
|
|
43
43
|
}
|
44
44
|
|
45
45
|
# Helper to proxy methods to the super class AND to the internal error logger
|
46
|
-
#
|
46
|
+
#
|
47
47
|
# +symbol+:: Symbol for name of the method to proxy
|
48
48
|
def self.proxy_method(symbol) #:nodoc:
|
49
49
|
old_name = "old_#{symbol}".to_sym
|
@@ -58,7 +58,7 @@ module Methadone
|
|
58
58
|
proxy_method :'datetime_format='
|
59
59
|
|
60
60
|
def add(severity, message = nil, progname = nil, &block) #:nodoc:
|
61
|
-
if @split_logs
|
61
|
+
if @split_logs
|
62
62
|
unless severity >= @stderr_logger.level
|
63
63
|
super(severity,message,progname,&block)
|
64
64
|
end
|
@@ -67,7 +67,7 @@ module Methadone
|
|
67
67
|
end
|
68
68
|
@stderr_logger.add(severity,message,progname,&block)
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
DEFAULT_ERROR_LEVEL = Logger::Severity::WARN
|
72
72
|
|
73
73
|
# A logger that logs error-type messages to a second device; useful
|
@@ -82,9 +82,10 @@ module Methadone
|
|
82
82
|
# +log_device+:: device where all log messages should go, based on level
|
83
83
|
# +error_device+:: device where all error messages should go. By default, this is Logger::Severity::WARN
|
84
84
|
def initialize(log_device=$stdout,error_device=$stderr)
|
85
|
-
super(log_device)
|
86
85
|
@stderr_logger = Logger.new(error_device)
|
87
86
|
|
87
|
+
super(log_device)
|
88
|
+
|
88
89
|
log_device_tty = tty?(log_device)
|
89
90
|
error_device_tty = tty?(error_device)
|
90
91
|
|
data/lib/methadone/main.rb
CHANGED
@@ -21,22 +21,22 @@ module Methadone
|
|
21
21
|
# You also get a more expedient interface to OptionParser as well
|
22
22
|
# as checking for required arguments to your app. For example, if
|
23
23
|
# we want our app to accept a negatable switch named "switch", a flag
|
24
|
-
# named "flag", and two arguments "needed" (which is required)
|
24
|
+
# named "flag", and two arguments "needed" (which is required)
|
25
25
|
# and "maybe" which is optional, we can do the following:
|
26
26
|
#
|
27
27
|
# #!/usr/bin/env ruby
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# require 'methadone'
|
30
|
-
#
|
30
|
+
#
|
31
31
|
# class App
|
32
32
|
# include Methadone::Main
|
33
33
|
# include Methadone::CLILogging
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# main do |needed, maybe|
|
36
36
|
# options[:switch] => true or false, based on command line
|
37
37
|
# options[:flag] => value of flag passed on command line
|
38
38
|
# end
|
39
|
-
#
|
39
|
+
#
|
40
40
|
# # Proxy to an OptionParser instance's on method
|
41
41
|
# on("--[no]-switch")
|
42
42
|
# on("--flag VALUE")
|
@@ -52,7 +52,7 @@ module Methadone
|
|
52
52
|
#
|
53
53
|
# Our app then acts as follows:
|
54
54
|
#
|
55
|
-
# $ our_app
|
55
|
+
# $ our_app
|
56
56
|
# # => parse error: 'needed' is required
|
57
57
|
# $ our_app foo
|
58
58
|
# # => succeeds; "maybe" in main is nil
|
@@ -81,7 +81,7 @@ module Methadone
|
|
81
81
|
# Declare the main method for your app.
|
82
82
|
# This allows you to specify the general logic of your
|
83
83
|
# app at the top of your bin file, but can rely on any methods
|
84
|
-
# or other code that you define later.
|
84
|
+
# or other code that you define later.
|
85
85
|
#
|
86
86
|
# For example, suppose you want to process a set of files, but
|
87
87
|
# wish to determine that list from another method to keep your
|
@@ -111,7 +111,7 @@ module Methadone
|
|
111
111
|
# *Note*: #go! will modify +ARGV+ so any unparsed arguments that you do *not* declare as arguments
|
112
112
|
# to #main will essentially be unavailable. I consider this a bug, and it should be changed/fixed in
|
113
113
|
# a future version.
|
114
|
-
#
|
114
|
+
#
|
115
115
|
# To run this method, call #go!
|
116
116
|
def main(&block)
|
117
117
|
@main_block = block
|
@@ -165,7 +165,7 @@ module Methadone
|
|
165
165
|
opts.parse!
|
166
166
|
opts.check_args!
|
167
167
|
result = call_main
|
168
|
-
if result.kind_of?
|
168
|
+
if result.kind_of? Integer
|
169
169
|
exit result
|
170
170
|
else
|
171
171
|
exit 0
|
@@ -299,7 +299,7 @@ module Methadone
|
|
299
299
|
end
|
300
300
|
version_options[:custom_docs] ||= "Show help/version info"
|
301
301
|
version_options[:format] ||= "%s version %s"
|
302
|
-
opts.on("--version",version_options[:custom_docs]) do
|
302
|
+
opts.on("--version",version_options[:custom_docs]) do
|
303
303
|
if version_options[:compact]
|
304
304
|
puts version_options[:format] % [::File.basename($0),version]
|
305
305
|
else
|
@@ -352,7 +352,7 @@ module Methadone
|
|
352
352
|
|
353
353
|
def set_defaults_from_rc_file
|
354
354
|
if @rc_file && File.exists?(@rc_file)
|
355
|
-
File.open(@rc_file) do |file|
|
355
|
+
File.open(@rc_file) do |file|
|
356
356
|
parsed = begin
|
357
357
|
YAML::load(file)
|
358
358
|
rescue => ex
|
@@ -461,9 +461,9 @@ module Methadone
|
|
461
461
|
else
|
462
462
|
opt_names = option_names(*args)
|
463
463
|
@option_parser.on(*args) do |value|
|
464
|
-
opt_names.each do |name|
|
465
|
-
@options[name] = value
|
466
|
-
@options[name.to_s] = value
|
464
|
+
opt_names.each do |name|
|
465
|
+
@options[name] = value
|
466
|
+
@options[name.to_s] = value
|
467
467
|
end
|
468
468
|
end
|
469
469
|
end
|
@@ -494,7 +494,7 @@ module Methadone
|
|
494
494
|
set_banner
|
495
495
|
end
|
496
496
|
|
497
|
-
# Defers all calls save #on to
|
497
|
+
# Defers all calls save #on to
|
498
498
|
# the underlying OptionParser instance
|
499
499
|
def method_missing(sym,*args,&block)
|
500
500
|
@option_parser.send(sym,*args,&block)
|
@@ -528,7 +528,7 @@ module Methadone
|
|
528
528
|
private
|
529
529
|
|
530
530
|
def document_help
|
531
|
-
@option_parser.on("-h","--help","Show command line help") do
|
531
|
+
@option_parser.on("-h","--help","Show command line help") do
|
532
532
|
puts @option_parser.to_s
|
533
533
|
exit 0
|
534
534
|
end
|
@@ -547,10 +547,10 @@ module Methadone
|
|
547
547
|
end
|
548
548
|
|
549
549
|
def option_names_from(args)
|
550
|
-
args.select(&STRINGS_ONLY).select { |_|
|
551
|
-
_ =~ /^\-/
|
552
|
-
}.map { |_|
|
553
|
-
_.gsub(/^\-+/,'').gsub(/\s.*$/,'')
|
550
|
+
args.select(&STRINGS_ONLY).select { |_|
|
551
|
+
_ =~ /^\-/
|
552
|
+
}.map { |_|
|
553
|
+
_.gsub(/^\-+/,'').gsub(/\s.*$/,'')
|
554
554
|
}
|
555
555
|
end
|
556
556
|
|
@@ -559,7 +559,7 @@ module Methadone
|
|
559
559
|
new_banner="Usage: #{::File.basename($0)}"
|
560
560
|
new_banner += " [options]" if @accept_options
|
561
561
|
unless @args.empty?
|
562
|
-
new_banner += " "
|
562
|
+
new_banner += " "
|
563
563
|
new_banner += @args.map { |arg|
|
564
564
|
if @arg_options[arg].include? :any
|
565
565
|
"[#{arg.to_s}...]"
|
data/lib/methadone/version.rb
CHANGED
data/methadone.gemspec
CHANGED
@@ -19,13 +19,13 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
s.add_dependency("bundler")
|
21
21
|
s.add_development_dependency("rake")
|
22
|
-
s.add_development_dependency("rdoc","~>
|
22
|
+
s.add_development_dependency("rdoc","~> 5.0")
|
23
23
|
s.add_development_dependency("cucumber")
|
24
24
|
s.add_development_dependency("aruba", "0.5.1")
|
25
25
|
s.add_development_dependency("simplecov", "~> 0.5")
|
26
26
|
s.add_development_dependency("clean_test")
|
27
27
|
s.add_development_dependency("mocha", "0.13.2")
|
28
|
-
s.add_development_dependency("sdoc")
|
28
|
+
s.add_development_dependency("sdoc", "1.0.0.rc1")
|
29
29
|
s.add_development_dependency("rspec", "~> 3")
|
30
30
|
s.add_development_dependency("i18n", "= 0.6.1")
|
31
31
|
end
|
data/test/test_sh.rb
CHANGED
@@ -304,7 +304,7 @@ class TestSH < BaseTest
|
|
304
304
|
|
305
305
|
def run_command(command)
|
306
306
|
@command = command
|
307
|
-
if @exitcode.kind_of?
|
307
|
+
if @exitcode.kind_of? Integer
|
308
308
|
[any_string,any_string,OpenStruct.new(:exitstatus => @exitcode)]
|
309
309
|
else
|
310
310
|
[any_string,any_string,@exitcode]
|
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.9.
|
4
|
+
version: 1.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- davetron5000
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: cucumber
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: sdoc
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.0.0.rc1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 1.0.0.rc1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
261
|
version: '0'
|
262
262
|
requirements: []
|
263
263
|
rubyforge_project: methadone
|
264
|
-
rubygems_version: 2.
|
264
|
+
rubygems_version: 2.6.8
|
265
265
|
signing_key:
|
266
266
|
specification_version: 4
|
267
267
|
summary: Kick the bash habit and start your command-line apps off right
|