getopt-declare 1.30 → 1.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 32dd881f507e3cc2dc55780ba052ca6b09789396
4
+ data.tar.gz: 19e4fc6b1ece3315fbd9383b4ac5f0fd86d65427
5
+ SHA512:
6
+ metadata.gz: 0b5d5c07014591e5e929c6f6026a16dde339cde8c4adbfb4f8ade9e48c6cf2cd90cfc2aa4640e9c8571119495b281228f0a8aff3253b1046cc35bfe65111dda1
7
+ data.tar.gz: e1c8b0a43a262962aa16a3e21eeb80d0eaf6b12e698d76ab86dd2e71f35670698e256ca508aaa7c66734ce9191ccc49b41e0d8055c6812910c53eae0a987a8dc
@@ -1,23 +1,24 @@
1
1
  require "rubygems"
2
2
 
3
- spec = Gem::Specification.new do |spec|
3
+ sp = Gem::Specification.new do |spec|
4
4
  spec.name = "getopt-declare"
5
- spec.version = '1.30'
5
+ spec.version = '1.31'
6
6
  spec.author = "Gonzalo Garramuno"
7
7
  spec.email = 'ggarra13@gmail.com'
8
8
  spec.homepage = 'http://www.rubyforge.org/projects/getoptdeclare/'
9
9
  spec.summary = 'A regex command-line parsing library.'
10
+ spec.license = 'GPL'
10
11
  spec.require_path = "lib"
11
12
  spec.files =
12
13
  ['getopt-declare.gemspec'] +
13
14
  Dir.glob("lib/Getopt/*.rb") +
14
15
  Dir.glob("samples/*.rb") + Dir.glob("test/*.rb")
15
- spec.description = <<-EOF
16
- A command-line parser using regular expressions.
17
- EOF
18
16
  spec.extra_rdoc_files = ["Manifest.txt", "README.txt"] +
19
17
  Dir.glob("docs/*/*")
20
18
  spec.has_rdoc = true
21
19
  spec.rubyforge_project = 'getopt-declare'
22
20
  spec.required_ruby_version = '>= 1.8.0'
21
+ spec.description = <<-EOF
22
+ A command-line parser using regular expressions.
23
+ EOF
23
24
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: iso-8859-1 -*-
1
2
  #
2
3
  # Getopt::Declare - Declaratively Expressed Command-Line Arguments via Regular Expressions
3
4
  #
@@ -306,44 +307,44 @@ EOS
306
307
  end
307
308
 
308
309
  code << " #{@name} = _VAL_\n"
309
- end
310
+ end
310
311
 
311
312
  # Based on parameter type, default conversion to apply
312
- def conversion
313
- pat = @@stdtype[@type] ? @@stdtype[@type][:pattern] : ''
314
- [ @type, pat ].each { |t|
315
- case t
316
- when /^\:0?(\+)?i$/
317
- return '.to_i'
318
- when /^\:0?(\+)?n$/
319
- return '.to_f'
320
- end
321
- }
322
- return nil
323
- end
324
-
325
- # Return string with code to cache argument in Getopt::Declare's cache
326
- def cachecode(ownerflag, itemcount)
327
- if itemcount > 1
328
- " @cache['#{ownerflag}']['<#{@name}>'] = #{@name}\n"
329
- else
330
- " @cache['#{ownerflag}'] = #{@name}\n"
331
- end
332
- end
333
-
334
- # Helps build regex that matches parameters of flags
335
- def trailer
336
- nil # MEANS TRAILING PARAMETER VARIABLE (in Perl,was '')
337
- end
338
-
339
- # Helps build regex that matches parameters of flags
340
- # Wraps parameter passed for #$1, etc. matching
341
- def ows(g)
342
- return '[\s|\0]*(' + g + ')' unless @nows
343
- '('+ g +')'
344
- end
345
-
346
- end # ScalarArg
313
+ def conversion
314
+ pat = @@stdtype[@type] ? @@stdtype[@type][:pattern] : ''
315
+ [ @type, pat ].each { |t|
316
+ case t
317
+ when /^\:0?(\+)?i$/
318
+ return '.to_i'
319
+ when /^\:0?(\+)?n$/
320
+ return '.to_f'
321
+ end
322
+ }
323
+ return nil
324
+ end
325
+
326
+ # Return string with code to cache argument in Getopt::Declare's cache
327
+ def cachecode(ownerflag, itemcount)
328
+ if itemcount > 1
329
+ " @cache['#{ownerflag}']['<#{@name}>'] = #{@name}\n"
330
+ else
331
+ " @cache['#{ownerflag}'] = #{@name}\n"
332
+ end
333
+ end
334
+
335
+ # Helps build regex that matches parameters of flags
336
+ def trailer
337
+ nil # MEANS TRAILING PARAMETER VARIABLE (in Perl,was '')
338
+ end
339
+
340
+ # Helps build regex that matches parameters of flags
341
+ # Wraps parameter passed for #$1, etc. matching
342
+ def ows(g)
343
+ return '[\s|\0]*(' + g + ')' unless @nows
344
+ return '(' + g + ')'
345
+ end
346
+
347
+ end # ScalarArg
347
348
 
348
349
 
349
350
  # Class used to handle array arguments
@@ -644,12 +645,12 @@ EOS
644
645
  code << ' and !_lastprefix'
645
646
  end
646
647
 
647
- code <<'
648
+ code << '
648
649
  begin
649
650
  catch(:param) do
650
651
  _pos = _nextpos if _args
651
652
  _PUNCT_ = {}
652
- '
653
+ '
653
654
 
654
655
  if flag != ''
655
656
  # This boundary is to handle -- option, so that if user uses
@@ -684,20 +685,20 @@ EOS
684
685
  if @args
685
686
  code << "\n"+' _args && _pos = gindex( _args, /\G'
686
687
 
687
- @args.each_with_index { |arg, i|
688
- code << arg.ows(arg.matcher(trailer[i]))
688
+ @args.each_with_index { |arg, j|
689
+ code << arg.ows(arg.matcher(trailer[j]))
689
690
  }
690
691
 
691
692
  code << '/x' + nocasei + ", _pos ) or throw(:paramout)\n"
692
693
  end # if @args
693
694
 
694
- @args.each_with_index { |arg, i|
695
- code << arg.code(i,mod) #, $flag ????
695
+ @args.each_with_index { |arg, j|
696
+ code << arg.code(j,mod) #, $flag ????
696
697
  }
697
698
 
698
699
  if flag
699
700
  mutexlist = owner.mutex[flag] ?
700
- ( owner.mutex[flag].map {|i| "'#{i}'"} ).join(',') : ''
701
+ ( owner.mutex[flag].map {|j| "'#{j}'"} ).join(',') : ''
701
702
 
702
703
  code << "
703
704
  if _invalid.has_key?('#{flag}')
@@ -872,8 +873,6 @@ EOS
872
873
  if desc =~ /\[\s*no\s*case\s*\]/i
873
874
  if arg
874
875
  arg.nocase = true
875
- else
876
- nocase = true
877
876
  end
878
877
  end
879
878
 
@@ -1101,10 +1100,10 @@ EOS
1101
1100
 
1102
1101
  # Check for GNU spec line like: -d, --debug
1103
1102
  arg = nil
1104
- if spec =~ /(-[\w_\d]+),\s+(--?[\w_\d]+)(\s+.*)?/
1103
+ if spec =~ /(-[\w]+),\s+(--?[\w]+)(\s+.*)?/
1105
1104
  specs = ["#$1#$3", "#$2#$3"]
1106
- specs.each { |spec|
1107
- arg = Arg.new(spec,desc,ditto)
1105
+ specs.each { |sp|
1106
+ arg = Arg.new(sp,desc,ditto)
1108
1107
  _args.push( arg )
1109
1108
  _infer(desc, arg, _mutex)
1110
1109
  ditto = arg
@@ -1430,7 +1429,7 @@ EOS
1430
1429
 
1431
1430
  header << "Options:\n" unless decfirst && decfirst == 1
1432
1431
 
1433
- usage.sub!(/[\s\n]+\Z/m, '')
1432
+ usage.sub!(/[\s]+\Z/m, '')
1434
1433
 
1435
1434
  pager = $stdout
1436
1435
 
@@ -1656,7 +1655,7 @@ end
1656
1655
  ## cannot just assign unused to ARGV in ruby
1657
1656
  unless @source != ''
1658
1657
  ARGV.clear
1659
- @unused.map { |i| ARGV.push(i) }
1658
+ @unused.map { |j| ARGV.push(j) }
1660
1659
  end
1661
1660
 
1662
1661
  unless _errors > 0
@@ -1734,6 +1733,6 @@ end
1734
1733
  attr :clump
1735
1734
  attr :source
1736
1735
 
1737
- end # class Declare
1736
+ end # class Declare
1738
1737
 
1739
1738
  end # module Getopt
@@ -109,6 +109,7 @@ class DelimScanner
109
109
  def self.def_casting_delegators( *methods )
110
110
  methods.each {|methodName|
111
111
  class_eval( <<-EOF, "(--def_casting_delegators--)", 1 )
112
+ undef :#{methodName}
112
113
  def #{methodName}( pattern )
113
114
  pattern = pattern.to_s.to_re unless pattern.is_a?( Regexp )
114
115
  @scanner.#{methodName}( pattern )
@@ -731,7 +732,7 @@ class DelimScanner
731
732
  failmode.inspect, bad.inspect, ignore.inspect
732
733
 
733
734
  rdelspec = ''
734
- openTagPos, textPos, paraPos, closeTagPos, endPos = ([nil] * 5)
735
+ openTagPos, textPos, paraPos, closeTagPos, = ([nil] * 5)
735
736
  match = nil
736
737
 
737
738
  # Look for the prefix
@@ -854,7 +855,7 @@ class DelimScanner
854
855
  startPos, prefix.inspect, matchRawRegex.inspect
855
856
 
856
857
  # Init position markers
857
- rval = oppos = preldpos = ldpos = strpos = rdpos = modpos = nil
858
+ rval = oppos = ldpos = strpos = rdpos = modpos = nil
858
859
 
859
860
  # Look for the prefix
860
861
  raise MatchFailure, "Did not find prefix: /#{prefix.inspect}/" unless
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ require "Getopt/Declare"
5
+
6
+
7
+ spec = Getopt::Declare.new <<EOF
8
+ -i <iterations:+i> iteration count
9
+ -q add new task [requires: -i]
10
+ EOF
11
+
metadata CHANGED
@@ -1,103 +1,83 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: getopt-declare
3
- version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease:
6
- segments:
7
- - 1
8
- - 30
9
- version: "1.30"
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.31'
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Gonzalo Garramuno
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2013-09-17 00:00:00 Z
11
+ date: 2014-01-26 00:00:00.000000000 Z
18
12
  dependencies: []
19
-
20
13
  description: "\tA command-line parser using regular expressions.\n"
21
14
  email: ggarra13@gmail.com
22
15
  executables: []
23
-
24
16
  extensions: []
25
-
26
- extra_rdoc_files:
17
+ extra_rdoc_files:
18
+ - Manifest.txt
19
+ - README.txt
20
+ files:
27
21
  - Manifest.txt
28
22
  - README.txt
29
- files:
30
23
  - getopt-declare.gemspec
31
24
  - lib/Getopt/Declare.rb
32
- - lib/Getopt/DelimScanner.rb
33
25
  - lib/Getopt/Declare2.rb
26
+ - lib/Getopt/DelimScanner.rb
27
+ - samples/cmdline_array.rb
34
28
  - samples/cmdline_basic.rb
35
- - samples/cmdline_usage.rb
36
- - samples/cmdline_regex.rb
37
- - samples/demo_cmdline.rb
38
29
  - samples/cmdline_code.rb
39
- - samples/demo_csv.rb
40
- - samples/demo_shell.rb
41
- - samples/cmdline_pvtype.rb
42
- - samples/demo_interp.rb
30
+ - samples/cmdline_defer.rb
31
+ - samples/cmdline_file.rb
32
+ - samples/cmdline_finish.rb
33
+ - samples/cmdline_inlines.rb
34
+ - samples/cmdline_mid.rb
43
35
  - samples/cmdline_noargv.rb
44
36
  - samples/cmdline_parameters.rb
37
+ - samples/cmdline_pvtype.rb
45
38
  - samples/cmdline_pvtype2.rb
46
- - samples/cmdline_inlines.rb
47
- - samples/cmdline_file.rb
48
- - samples/cmdline_defer.rb
49
- - samples/cmdline_array.rb
50
- - samples/cmdline_mid.rb
39
+ - samples/cmdline_regex.rb
51
40
  - samples/cmdline_singles.rb
52
- - samples/cmdline_finish.rb
53
- - test/test_cmdline_mid.rb
54
- - test/test_cmdline_pvtype.rb
55
- - test/test_cmdline_basic.rb
41
+ - samples/cmdline_usage.rb
42
+ - samples/demo_cmdline.rb
43
+ - samples/demo_csv.rb
44
+ - samples/demo_interp.rb
45
+ - samples/demo_shell.rb
46
+ - samples/requires.rb
56
47
  - test/test_cluster_singles.rb
57
- - test/test_cmdline_regex.rb
58
- - test/test_cmdline_require.rb
59
- - test/test_cmdline_pvtype2.rb
60
48
  - test/test_cmdline_array.rb
49
+ - test/test_cmdline_basic.rb
61
50
  - test/test_cmdline_cmdline.rb
62
- - test/test_demo_csv.rb
63
51
  - test/test_cmdline_finish.rb
52
+ - test/test_cmdline_mid.rb
64
53
  - test/test_cmdline_parameters.rb
65
- - Manifest.txt
66
- - README.txt
54
+ - test/test_cmdline_pvtype.rb
55
+ - test/test_cmdline_pvtype2.rb
56
+ - test/test_cmdline_regex.rb
57
+ - test/test_cmdline_require.rb
58
+ - test/test_demo_csv.rb
67
59
  homepage: http://www.rubyforge.org/projects/getoptdeclare/
68
- licenses: []
69
-
60
+ licenses:
61
+ - GPL
62
+ metadata: {}
70
63
  post_install_message:
71
64
  rdoc_options: []
72
-
73
- require_paths:
65
+ require_paths:
74
66
  - lib
75
- required_ruby_version: !ruby/object:Gem::Requirement
76
- none: false
77
- requirements:
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
78
69
  - - ">="
79
- - !ruby/object:Gem::Version
80
- hash: 55
81
- segments:
82
- - 1
83
- - 8
84
- - 0
70
+ - !ruby/object:Gem::Version
85
71
  version: 1.8.0
86
- required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
89
74
  - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
95
77
  requirements: []
96
-
97
78
  rubyforge_project: getopt-declare
98
- rubygems_version: 1.8.15
79
+ rubygems_version: 2.2.0
99
80
  signing_key:
100
- specification_version: 3
81
+ specification_version: 4
101
82
  summary: A regex command-line parsing library.
102
83
  test_files: []
103
-