clamp 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c397bb4c7fbc93ee71f4df0dbeaf3513e0372dcbe12ed0ace0b89ac54bd932de
4
- data.tar.gz: 28088d25dd5a855aca74a77caa3172b2b30259e33fc5223a1d302fe4a302ef2a
3
+ metadata.gz: c164c63137c57502ad15e11ab471b2607661868298e5330a8a4961dfea629537
4
+ data.tar.gz: 297e0abb1ead811d567eea7e668a91ba7c99654657a358016abb5cdbfd13168d
5
5
  SHA512:
6
- metadata.gz: 4ee42ec998257b428af64d243b0a89f7345bbe9aad098414a9a99a53d53007489036bc7c4c8d7d03bb53f4bbaecf095e1c0d60860faec50b5b5b67bfafe4cf5f
7
- data.tar.gz: d7bd94bbea00c26fca7d388411959c92a864399b9c89c907a07008a10cc326c9eedb553091caa0602771a367e81baded339ed6bba5a86da80ee5a116dc977f5b
6
+ metadata.gz: 3773151ffa64b908d26c569877bb27704bf68efe658d9b6ebd48c009bcbc1a4d0a3fce2c4f16a02ed379e126dd436ef018ff1eac56334fcc8f467402fad6c995
7
+ data.tar.gz: 8104ea9b1d9a42669234cb0d82cc441efd7a6f94ed5cba542a502ae1cb2797d977530a07bbe649d98dab551e9078b434711e091e9d0b3716799522c04436d8c9
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
data/.rspec CHANGED
@@ -1 +1,2 @@
1
1
  --color
2
+ --warnings
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.9
4
- - 2.2.10
5
- - 2.3.7
6
- - 2.5.1
3
+ - 2.3
4
+ - 2.5
5
+ - 2.6
data/CHANGES.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## PENDING
3
+ ## 1.3.2 (2020-08-20)
4
+
5
+ * Fix Ruby warnings.
6
+
7
+ ## 1.3.1 (2019-07-11)
4
8
 
5
9
  * Choose a sensible column width in generated help, based on content.
6
10
  * Fix issue#99: extraneous parameter names in subcommand help.
@@ -54,11 +54,11 @@ module Clamp
54
54
  end
55
55
 
56
56
  def required?
57
- @required
57
+ @required ||= false
58
58
  end
59
59
 
60
60
  def hidden?
61
- @hidden
61
+ @hidden ||= false
62
62
  end
63
63
 
64
64
  def attribute_name
@@ -11,7 +11,10 @@ module Clamp #:nodoc:
11
11
  end
12
12
 
13
13
  def message(key, options = {})
14
- format(messages.fetch(key), options)
14
+ string = messages.fetch(key)
15
+ return string if options.empty?
16
+
17
+ format string, options
15
18
  end
16
19
 
17
20
  def clear_messages!
@@ -29,7 +29,7 @@ module Clamp
29
29
  end
30
30
 
31
31
  def recognised_options
32
- unless @implicit_options_declared
32
+ unless @implicit_options_declared ||= false
33
33
  declare_implicit_help_option
34
34
  @implicit_options_declared = true
35
35
  end
@@ -47,7 +47,7 @@ module Clamp
47
47
 
48
48
  def default_subcommand(*args, &block)
49
49
  if args.empty?
50
- @default_subcommand
50
+ @default_subcommand ||= false
51
51
  else
52
52
  $stderr.puts "WARNING: Clamp default_subcommand syntax has changed; check the README."
53
53
  $stderr.puts " (from #{caller(1..1).first})"
@@ -59,10 +59,10 @@ module Clamp
59
59
  private
60
60
 
61
61
  def declare_subcommand_parameters
62
- if @default_subcommand
62
+ if default_subcommand
63
63
  parameter "[SUBCOMMAND]", "subcommand",
64
64
  attribute_name: :subcommand_name,
65
- default: @default_subcommand,
65
+ default: default_subcommand,
66
66
  inheritable: false
67
67
  else
68
68
  parameter "SUBCOMMAND", "subcommand",
@@ -3,16 +3,13 @@
3
3
  module Clamp
4
4
  module Subcommand
5
5
 
6
- Definition = Struct.new(:name, :description, :subcommand_class) do
6
+ Definition = Struct.new(:names, :description, :subcommand_class) do
7
7
 
8
8
  def initialize(names, description, subcommand_class)
9
- @names = Array(names)
10
- @description = description
11
- @subcommand_class = subcommand_class
9
+ names = Array(names)
10
+ super
12
11
  end
13
12
 
14
- attr_reader :names, :description, :subcommand_class
15
-
16
13
  def is_called?(name)
17
14
  names.member?(name)
18
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clamp
4
- VERSION = "1.3.1".freeze
4
+ VERSION = "1.3.2".freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clamp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-11 00:00:00.000000000 Z
11
+ date: 2020-08-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Clamp provides an object-model for command-line utilities.
@@ -19,6 +19,7 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - ".autotest"
22
+ - ".editorconfig"
22
23
  - ".gitignore"
23
24
  - ".rspec"
24
25
  - ".rubocop.yml"
@@ -87,8 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  - !ruby/object:Gem::Version
88
89
  version: '0'
89
90
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 2.7.6
91
+ rubygems_version: 3.1.2
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: a minimal framework for command-line utilities