libclimate-ruby 0.2.3 → 0.2.4

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: 02794e536b229ccb6f52ec08d7899389dd749dab
4
- data.tar.gz: 28d0b8f7d6243ed083c8cfd85e1f7536bca6b7c5
3
+ metadata.gz: 11f0e8e0239a415d2c396a07c97b040db5bc29c3
4
+ data.tar.gz: 9fd775fe9b0e5c64c0507d6fdb76a2208889a35a
5
5
  SHA512:
6
- metadata.gz: f6778014e31bfa9ce3024a4e09fdc59197091fd65ef85c75928ecda9cc0b4f5d67cd681b91f1e801f4d9a7a5f2dcbcd5807bfafc2bd4f39bf218ee8af6290d0c
7
- data.tar.gz: 3d165c6a9f529123f3816bd719ce5dcd1bf9da583cdb9cc81c51aab89cbfef4e503e4de8611919e7e2cd8ef2131a66aa18808175e833307a1afc58ee26a5bfa3
6
+ metadata.gz: cdefc270711e796b5e26bf9e436ef44cddfe309a1120cc77aa463f0fb2f0ed36015bc75b2bd7cc35093f33b80d279ee49939c8b276dea862ee9b3660af62635a
7
+ data.tar.gz: fa9c99fc53a11004a1525771ab9cf51f25693abf685f076b8bb14260674ab11f0af89a9ce3f39af329ee03ebc402c88b9520d151051d461cdba1db61ced7a746
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # libCLImate.Ruby
2
2
  libCLImate for Ruby
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/libclimate-ruby.svg)](https://badge.fury.io/rb/libclimate-ruby)
5
+
4
6
  ## Installation & usage
5
7
 
6
8
  Install using `gem install libclimate-ruby` or add it to your `Gemfile`.
@@ -5,7 +5,7 @@
5
5
  # Purpose: Definition of the ::LibCLImate::Climate class
6
6
  #
7
7
  # Created: 13th July 2015
8
- # Updated: 11th June 2016
8
+ # Updated: 13th June 2016
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/libCLImate.Ruby
11
11
  #
@@ -48,7 +48,7 @@ if !defined? Colcon
48
48
  begin
49
49
 
50
50
  require 'colcon'
51
- rescue LoadError => x
51
+ rescue LoadError #=> x
52
52
 
53
53
  warn "could not load colcon library" if $DEBUG
54
54
  end
@@ -56,9 +56,15 @@ end
56
56
 
57
57
  module LibCLImate
58
58
 
59
+ # Class used to gather together the CLI specification, and execute it
60
+ #
61
+ #
62
+ #
59
63
  class Climate
60
64
 
61
- private
65
+ #:stopdoc:
66
+
67
+ private
62
68
  def show_usage_
63
69
 
64
70
  options = {}
@@ -74,8 +80,23 @@ class Climate
74
80
  CLASP.show_version aliases, stream: stdout, program_name: program_name, version: version, exit: exit_on_usage ? 0 : nil
75
81
  end
76
82
 
77
- public
78
- def initialize(options={})
83
+ #:startdoc:
84
+
85
+ public
86
+
87
+ # Creates an instance of the Climate class.
88
+ #
89
+ # === Signature
90
+ #
91
+ # * *Parameters*:
92
+ # - +options:+:: An options hash, containing any of the following options.
93
+ #
94
+ # * *Options*:
95
+ # - +:no_help_flag+:: Prevents the use of the CLASP::Flag.Help flag-alias
96
+ # - +:no_version_flag+:: Prevents the use of the CLASP::Version.Help flag-alias
97
+ #
98
+ # * *Block*:: An optional block which receives the constructing instance, allowing the user to modify the attributes.
99
+ def initialize(options={}) # :yields: climate
79
100
 
80
101
  options ||= {}
81
102
 
@@ -100,21 +121,33 @@ class Climate
100
121
  @aliases << CLASP::Flag.Help(handle: proc { show_usage_ }) unless options[:no_help_flag]
101
122
  @aliases << CLASP::Flag.Version(handle: proc { show_version_ }) unless options[:no_version_flag]
102
123
 
103
- raise ArgumentError, "block is required" unless block_given?
104
-
105
- yield self
124
+ yield self if block_given?
106
125
  end
107
126
 
108
- attr_accessor :aliases
127
+ # An array of aliases attached to the climate instance, whose contents should be modified by adding (or removing) CLASP aliases
128
+ # @return [Array] The aliases
129
+ attr_reader :aliases
130
+ # Indicates whether exit will be called (with non-zero exit code) when an unknown command-line flag or option is encountered
131
+ # @return [Boolean]
132
+ # @return *true* exit(1) will be called
133
+ # @return *false* exit will not be called
109
134
  attr_accessor :exit_on_unknown
135
+ # @return [Boolean] Indicates whether exit will be called (with zero exit code) when usage/version is requested on the command-line
110
136
  attr_accessor :exit_on_usage
137
+ # @return [Array] Optional array of string of program-information that will be written before the rest of the usage block when usage is requested on the command-line
111
138
  attr_accessor :info_lines
139
+ # @return [String] A program name; defaults to the name of the executing script
112
140
  attr_accessor :program_name
141
+ # @return [IO] The output stream for normative output; defaults to $stdout
113
142
  attr_accessor :stdout
143
+ # @return [IO] The output stream for contingent output; defaults to $stderr
114
144
  attr_accessor :stderr
145
+ # @return [String] Optional string to describe the program values, eg \<xyz "[ { <<directory> | &lt;file> } ]"
115
146
  attr_accessor :usage_values
147
+ # @return [String, Array] A version string or an array of integers representing the version components
116
148
  attr_accessor :version
117
149
 
150
+ # Executes the prepared Climate instance
118
151
  def run argv = ARGV
119
152
 
120
153
  raise ArgumentError, "argv may not be nil" if argv.nil?
@@ -156,13 +189,13 @@ class Climate
156
189
 
157
190
  selector = :unhandled
158
191
 
159
- ex = f.extras
192
+ ex = al.extras
160
193
 
161
- case f.extras
194
+ case ex
162
195
  when ::Hash
163
- if f.extras.has_key? :handle
196
+ if ex.has_key? :handle
164
197
 
165
- f.extras[:handle].call(f, al)
198
+ ex[:handle].call(f, al)
166
199
 
167
200
  selector = :handled
168
201
  end
@@ -4,7 +4,7 @@
4
4
  # Purpose: Main file for libclimate.Ruby library
5
5
  #
6
6
  # Created: 13th July 2015
7
- # Updated: 14th May 2016
7
+ # Updated: 12th June 2016
8
8
  #
9
9
  # Home: http://github.com/synesissoftware/libCLImate.Ruby
10
10
  #
@@ -40,6 +40,7 @@
40
40
  require 'libclimate/climate'
41
41
  require 'libclimate/version'
42
42
 
43
+ # Main module for libCLImate.Ruby library
43
44
  module LibCLImate
44
45
 
45
46
 
@@ -4,7 +4,7 @@
4
4
  # Purpose: Version for libclimate.Ruby library
5
5
  #
6
6
  # Created: 13th July 2015
7
- # Updated: 11th June 2016
7
+ # Updated: 13th June 2016
8
8
  #
9
9
  # Home: http://github.com/synesissoftware/libCLImate.Ruby
10
10
  #
@@ -37,11 +37,10 @@
37
37
  # ######################################################################## #
38
38
 
39
39
 
40
- # Main module for libCLImate.Ruby library
41
40
  module LibCLImate
42
41
 
43
42
  # Current version of the libCLImate.Ruby library
44
- VERSION = '0.2.3'
43
+ VERSION = '0.2.4'
45
44
 
46
45
  private
47
46
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -52,7 +51,6 @@ module LibCLImate
52
51
  VERSION_MINOR = VERSION_PARTS_[1] # :nodoc:
53
52
  # # Revision version of the libCLImate.Ruby library
54
53
  VERSION_REVISION = VERSION_PARTS_[2] # :nodoc:
55
- #
56
54
 
57
55
  end # module LibCLImate
58
56
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libclimate-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-11 00:00:00.000000000 Z
11
+ date: 2016-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clasp-ruby
@@ -36,7 +36,7 @@ dependencies:
36
36
  requirements:
37
37
  - - '>='
38
38
  - !ruby/object:Gem::Version
39
- version: 0.8.3
39
+ version: 0.8.4
40
40
  - - <
41
41
  - !ruby/object:Gem::Version
42
42
  version: '1.0'
@@ -46,7 +46,7 @@ dependencies:
46
46
  requirements:
47
47
  - - '>='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.8.3
49
+ version: 0.8.4
50
50
  - - <
51
51
  - !ruby/object:Gem::Version
52
52
  version: '1.0'