gli 2.13.1 → 2.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 682f0c39f5868ca9916a096f827f8b17a8da42ef
4
- data.tar.gz: f30d788626a9e064a60c572a0d34de8af449868e
3
+ metadata.gz: 94f421bf818175143af61b7b8e7ae0a4f9d79254
4
+ data.tar.gz: 7edaeb9e3d2c98c0c9c5e15ca3688bcfd40acd57
5
5
  SHA512:
6
- metadata.gz: e9186466da8fdb400d99bc8a720fb07b46dac8f1ed3fafc923fc57e36ef6476d05fb61a1574b59ab23a970f6f3b57aceeb15b31a8e46acfedfdbe4a3e6cf176c
7
- data.tar.gz: 778bf6e7cff32246c3a9598a8b33b1ef594389053b8bab79e5a3e960f4aa9ce49af658c03e9250302ccdbd097f0f7562f533e15d8bcdee76e0c24ca742784847
6
+ metadata.gz: 30444e8c7f15e1eef0c2ea2c1761dfdcf7a3b307cfa965b4722d22eb0b7dcb3a1939b73119faaa81e3e4b67c8c04978e637311c48aee82314fba9d524be9913b
7
+ data.tar.gz: 039e7d4cf7331f676ed7bfc61f39d9f988a075758c1529760d5826af5f6b7dd2e33c10ae12363ed235ba6a55a2961fbcd5362fc45e517052ec8916ba2e35ff08
@@ -1 +1 @@
1
- ruby-2.1
1
+ 2.2.2
@@ -6,6 +6,7 @@ rvm:
6
6
  - 1.9.3
7
7
  - 2.0.0
8
8
  - 2.1
9
+ - 2.2
9
10
  branches:
10
11
  only:
11
12
  - 'gli-2'
data/Gemfile CHANGED
@@ -6,3 +6,7 @@ gem "rcov", ">= 0.9.8", :platforms => :mri_18
6
6
  gem "simplecov", "~> 0.6.4", :platforms => :mri_19
7
7
  gem "psych", :platforms => :mri_19
8
8
 
9
+ major,minor = RUBY_VERSION.split(/\./)
10
+ if major.to_i >=2 && minor.to_i >= 2
11
+ gem "test-unit"
12
+ end
@@ -27,7 +27,7 @@ spec = Gem::Specification.new do |s|
27
27
  s.add_development_dependency('clean_test')
28
28
  s.add_development_dependency('cucumber')
29
29
  s.add_development_dependency('gherkin')
30
- s.add_development_dependency('aruba')
30
+ s.add_development_dependency('aruba', '0.5.1')
31
31
  s.add_development_dependency('sdoc')
32
32
  s.add_development_dependency('faker','1.0.0')
33
33
  end
@@ -94,7 +94,7 @@ module GLI
94
94
  @skips_around = true
95
95
  end
96
96
 
97
- # Sets that this app uses a config file as well as the name of the config file.
97
+ # Sets that this app uses a config file as well as the name of the config file.
98
98
  #
99
99
  # +filename+:: A String representing the path to the file to use for the config file. If it's an absolute
100
100
  # path, this is treated as the path to the file. If it's *not*, it's treated as relative to the user's home
@@ -152,7 +152,7 @@ module GLI
152
152
  # Define a block to run if an error occurs.
153
153
  # The block will receive any Exception that was caught.
154
154
  # It should evaluate to false to avoid the built-in error handling (which basically just
155
- # prints out a message). GLI uses a variety of exceptions that you can use to find out what
155
+ # prints out a message). GLI uses a variety of exceptions that you can use to find out what
156
156
  # errors might've occurred during command-line parsing:
157
157
  # * GLI::CustomExit
158
158
  # * GLI::UnknownCommandArgument
@@ -165,7 +165,7 @@ module GLI
165
165
 
166
166
  # Indicate the version of your application
167
167
  #
168
- # +version+:: String containing the version of your application.
168
+ # +version+:: String containing the version of your application.
169
169
  def version(version)
170
170
  @version = version
171
171
  desc 'Display the program version'
@@ -191,7 +191,7 @@ module GLI
191
191
  end
192
192
 
193
193
  # Configure a type conversion not already provided by the underlying OptionParser.
194
- # This works more or less like the OptionParser version.
194
+ # This works more or less like the OptionParser version. It's global.
195
195
  #
196
196
  # object:: the class (or whatever) that triggers the type conversion
197
197
  # block:: the block that will be given the string argument and is expected
@@ -201,7 +201,7 @@ module GLI
201
201
  #
202
202
  # accept(Hash) do |value|
203
203
  # result = {}
204
- # value.split(/,/) do |pair|
204
+ # value.split(/,/).each do |pair|
205
205
  # k,v = pair.split(/:/)
206
206
  # result[k] = v
207
207
  # end
@@ -213,7 +213,7 @@ module GLI
213
213
  accepts[object] = block
214
214
  end
215
215
 
216
- # Simpler means of exiting with a custom exit code. This will
216
+ # Simpler means of exiting with a custom exit code. This will
217
217
  # raise a CustomExit with the given message and exit code, which will ultimatley
218
218
  # cause your application to exit with the given exit_code as its exit status
219
219
  # Use #help_now! if you want to show the help in addition to the error message
@@ -291,7 +291,7 @@ module GLI
291
291
  @subcommand_option_handling_strategy = handling_strategy
292
292
  end
293
293
 
294
- # How to handle argument validation.
294
+ # How to handle argument validation.
295
295
  #
296
296
  # handling_strategy:: One of:
297
297
  # +:loose+:: no argument validation. Use of `arg` or `arg_name` is for documentation purposes only. (Default)
@@ -78,7 +78,11 @@ module GLI
78
78
  #
79
79
  # Returns an Array of size two Ints representing the terminal width and height
80
80
  def size
81
- SIZE_DETERMINERS.select { |(predicate,ignore)| predicate.call }.first[1].call
81
+ SIZE_DETERMINERS.each do |predicate, get_size|
82
+ next unless predicate.call
83
+ size = get_size.call
84
+ return size unless size == [0, 0]
85
+ end
82
86
  rescue Exception => ex
83
87
  raise ex if @unsafe
84
88
  Terminal.default_size
@@ -1,5 +1,5 @@
1
1
  module GLI
2
2
  unless const_defined? :VERSION
3
- VERSION = '2.13.1'
3
+ VERSION = '2.13.2'
4
4
  end
5
5
  end
@@ -73,6 +73,30 @@ class TC_testTerminal < Clean::Test::TestCase
73
73
  assert_equal [5678,1234],terminal.size
74
74
  end
75
75
 
76
+ def test_size_using_stty_but_returns_0
77
+ terminal = GLI::Terminal.new
78
+ terminal.make_unsafe!
79
+ GLI::Terminal.instance_eval do
80
+ def run_command(command)
81
+
82
+ if RUBY_PLATFORM == 'java'
83
+ return '0' if command == 'tput cols'
84
+ return '0' if command == 'tput lines'
85
+ else
86
+ return '0 0' if command == 'stty size'
87
+ return '0 0' if command == 'stty'
88
+ end
89
+
90
+ raise "Unexpected command called: #{command} for #{RUBY_PLATFORM}"
91
+ end
92
+ def command_exists?(command); true; end
93
+ def jruby?; false; end
94
+ def solaris?; false; end
95
+ end
96
+ ENV['COLUMNS'] = 'foo'
97
+ assert_equal [80,24],terminal.size
98
+ end
99
+
76
100
  def test_size_using_default
77
101
  terminal = GLI::Terminal.new
78
102
  terminal.make_unsafe!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.1
4
+ version: 2.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Copeland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-12 00:00:00.000000000 Z
11
+ date: 2015-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: aruba
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.5.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 0.5.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: sdoc
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -277,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  version: '0'
278
278
  requirements: []
279
279
  rubyforge_project: gli
280
- rubygems_version: 2.4.4
280
+ rubygems_version: 2.4.8
281
281
  signing_key:
282
282
  specification_version: 4
283
283
  summary: Build command-suite CLI apps that are awesome.