libclimate-ruby 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libclimate/climate.rb +5 -5
- data/lib/libclimate/version.rb +2 -2
- data/test/unit/tc_minimal.rb +0 -0
- data/test/unit/{tc_minimal_clasp.rb → tc_minimal_CLASP.rb} +0 -0
- data/test/unit/tc_test_aliases.rb +0 -0
- data/test/unit/tc_with_blocks.rb +2 -2
- data/test/unit/tc_with_blocks_CLASP.rb +53 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27265b86889e0e995ed67a48ac70e0ca19b8ab28
|
4
|
+
data.tar.gz: a2b1dd26135037da92619f215c7a354505b80281
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3f5ce33c1f5203f5783d1be2f9f4aa1ed276c6766977a792df82a61a230a694adbc00be941cb7813a69231a14aa7e9b98d7ba3b1ef0974b48fbf12b50c4bffa
|
7
|
+
data.tar.gz: efba7a53d812e26f729df04d9cc3a9032d7e74901ad0bace2655c22ead175187ab8f7e198be191d63a47267d5d8d8a820aa6894a3a6b80bd3d7e778dbf634446
|
data/lib/libclimate/climate.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: Definition of the ::LibCLImate::Climate class
|
6
6
|
#
|
7
7
|
# Created: 13th July 2015
|
8
|
-
# Updated:
|
8
|
+
# Updated: 18th June 2016
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/libCLImate.Ruby
|
11
11
|
#
|
@@ -442,9 +442,9 @@ class Climate
|
|
442
442
|
# - +:alias+::
|
443
443
|
# - +:aliases+::
|
444
444
|
# - +:extras+::
|
445
|
-
def add_flag(name, options={})
|
445
|
+
def add_flag(name, options={}, &block)
|
446
446
|
|
447
|
-
aliases << CLASP.Flag(name, **options)
|
447
|
+
aliases << CLASP.Flag(name, **options, &block)
|
448
448
|
end
|
449
449
|
|
450
450
|
#
|
@@ -455,9 +455,9 @@ class Climate
|
|
455
455
|
# - +:values_range+::
|
456
456
|
# - +:default_value+::
|
457
457
|
# - +:extras+::
|
458
|
-
def add_option(name, options={})
|
458
|
+
def add_option(name, options={}, &block)
|
459
459
|
|
460
|
-
aliases << CLASP.Option(name, **options)
|
460
|
+
aliases << CLASP.Option(name, **options, &block)
|
461
461
|
end
|
462
462
|
|
463
463
|
# Adds a flag to +aliases+
|
data/lib/libclimate/version.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Purpose: Version for libclimate.Ruby library
|
5
5
|
#
|
6
6
|
# Created: 13th July 2015
|
7
|
-
# Updated:
|
7
|
+
# Updated: 18th June 2016
|
8
8
|
#
|
9
9
|
# Home: http://github.com/synesissoftware/libCLImate.Ruby
|
10
10
|
#
|
@@ -40,7 +40,7 @@
|
|
40
40
|
module LibCLImate
|
41
41
|
|
42
42
|
# Current version of the libCLImate.Ruby library
|
43
|
-
VERSION = '0.5.
|
43
|
+
VERSION = '0.5.4'
|
44
44
|
|
45
45
|
private
|
46
46
|
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
data/test/unit/tc_minimal.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/test/unit/tc_with_blocks.rb
CHANGED
@@ -21,7 +21,7 @@ class Test_Climate_with_blocks < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
climate = LibCLImate::Climate.new do |climate|
|
23
23
|
|
24
|
-
climate.
|
24
|
+
climate.add_flag('--verbose') { is_verbose = true }
|
25
25
|
end
|
26
26
|
|
27
27
|
argv = %w{ --verbose }
|
@@ -37,7 +37,7 @@ class Test_Climate_with_blocks < Test::Unit::TestCase
|
|
37
37
|
|
38
38
|
climate = LibCLImate::Climate.new do |climate|
|
39
39
|
|
40
|
-
climate.
|
40
|
+
climate.add_option('--flavour') { |o| flavour = o.value }
|
41
41
|
end
|
42
42
|
|
43
43
|
argv = %w{ --flavour=blueberry }
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# test Recls entries
|
4
|
+
|
5
|
+
$:.unshift File.join(File.dirname(__FILE__), '../..', 'lib')
|
6
|
+
|
7
|
+
|
8
|
+
require 'libclimate'
|
9
|
+
|
10
|
+
require 'xqsr3/extensions/test/unit'
|
11
|
+
|
12
|
+
require 'test/unit'
|
13
|
+
|
14
|
+
require 'stringio'
|
15
|
+
|
16
|
+
class Test_Climate_with_blocks_CLASP < Test::Unit::TestCase
|
17
|
+
|
18
|
+
def test_flag_with_block
|
19
|
+
|
20
|
+
is_verbose = false
|
21
|
+
|
22
|
+
climate = LibCLImate::Climate.new do |climate|
|
23
|
+
|
24
|
+
climate.aliases << CLASP.Flag('--verbose') { is_verbose = true }
|
25
|
+
end
|
26
|
+
|
27
|
+
argv = %w{ --verbose }
|
28
|
+
|
29
|
+
climate.run argv
|
30
|
+
|
31
|
+
assert is_verbose, "block associated with flag '--verbose' was not executed"
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_option_with_block
|
35
|
+
|
36
|
+
flavour = nil
|
37
|
+
|
38
|
+
climate = LibCLImate::Climate.new do |climate|
|
39
|
+
|
40
|
+
climate.aliases << CLASP.Option('--flavour') { |o| flavour = o.value }
|
41
|
+
end
|
42
|
+
|
43
|
+
argv = %w{ --flavour=blueberry }
|
44
|
+
|
45
|
+
climate.run argv
|
46
|
+
|
47
|
+
assert_equal 'blueberry', flavour
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# ############################## end of file ############################# #
|
52
|
+
|
53
|
+
|
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.5.
|
4
|
+
version: 0.5.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
|
+
date: 2016-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clasp-ruby
|
@@ -66,9 +66,10 @@ files:
|
|
66
66
|
- test/scratch/blankzeroes.rb
|
67
67
|
- test/unit/tc_abort.rb
|
68
68
|
- test/unit/tc_minimal.rb
|
69
|
-
- test/unit/
|
69
|
+
- test/unit/tc_minimal_CLASP.rb
|
70
70
|
- test/unit/tc_test_aliases.rb
|
71
71
|
- test/unit/tc_with_blocks.rb
|
72
|
+
- test/unit/tc_with_blocks_CLASP.rb
|
72
73
|
- test/unit/ts_all.rb
|
73
74
|
homepage: http://www.libclimate.org/
|
74
75
|
licenses:
|