oyster 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.txt +1 -1
- data/lib/oyster.rb +8 -7
- data/lib/oyster/specification.rb +11 -3
- data/test/test_oyster.rb +5 -0
- metadata +44 -10
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -197,7 +197,7 @@ otherwise you'll get a name collision in the output.
|
|
197
197
|
|
198
198
|
(The MIT License)
|
199
199
|
|
200
|
-
Copyright (c) 2008 James Coglan
|
200
|
+
Copyright (c) 2008-2010 James Coglan
|
201
201
|
|
202
202
|
Permission is hereby granted, free of charge, to any person obtaining
|
203
203
|
a copy of this software and associated documentation files (the
|
data/lib/oyster.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
module Oyster
|
2
|
-
VERSION = '0.9.
|
2
|
+
VERSION = '0.9.4'
|
3
3
|
|
4
|
-
LONG_NAME
|
5
|
-
|
4
|
+
LONG_NAME = /^--([a-z\[][a-z0-9\]\-]+)$/i
|
5
|
+
LONG_NAME_EQ = /^--([a-z\[][a-z0-9\]\-]+=.*)$/i
|
6
|
+
SHORT_NAME = /^-([a-z0-9]+)$/i
|
6
7
|
|
7
|
-
HELP_INDENT
|
8
|
-
HELP_WIDTH
|
8
|
+
HELP_INDENT = 7
|
9
|
+
HELP_WIDTH = 80
|
9
10
|
|
10
|
-
STOP_FLAG
|
11
|
-
NEGATOR
|
11
|
+
STOP_FLAG = '--'
|
12
|
+
NEGATOR = /^no-/
|
12
13
|
|
13
14
|
WINDOWS = RUBY_PLATFORM.split('-').any? { |part| part =~ /mswin\d*/i }
|
14
15
|
|
data/lib/oyster/specification.rb
CHANGED
@@ -58,10 +58,18 @@ module Oyster
|
|
58
58
|
|
59
59
|
option = command(token)
|
60
60
|
|
61
|
-
long, short =
|
62
|
-
long, short = [long, short].map { |s| s.flatten.first }
|
61
|
+
long, long_eq, short = *[LONG_NAME, LONG_NAME_EQ, SHORT_NAME].map { |re| token.scan(re).flatten.first }
|
63
62
|
|
64
|
-
|
63
|
+
if short and short.size > 1
|
64
|
+
input = short.scan(/./).map { |s| "-#{s}" } + input
|
65
|
+
next
|
66
|
+
end
|
67
|
+
|
68
|
+
if long_eq
|
69
|
+
parts = long_eq.split('=')
|
70
|
+
long = parts.shift
|
71
|
+
input.unshift(parts * '=')
|
72
|
+
end
|
65
73
|
|
66
74
|
negative = !!(long && long =~ NEGATOR)
|
67
75
|
long.sub!(NEGATOR, '') if negative
|
data/test/test_oyster.rb
CHANGED
@@ -124,6 +124,11 @@ class OysterTest < Test::Unit::TestCase
|
|
124
124
|
assert_equal 'help.txt, cmd.rb', opts[:files].join(', ')
|
125
125
|
end
|
126
126
|
|
127
|
+
def test_equals_separator
|
128
|
+
opts = @spec.parse %w(--user=danlucraft)
|
129
|
+
assert_equal 'danlucraft', opts[:user]
|
130
|
+
end
|
131
|
+
|
127
132
|
def test_strings
|
128
133
|
opts = @spec.parse %w(-v --user jcoglan something)
|
129
134
|
assert_equal 'jcoglan', opts[:user]
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oyster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 51
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 4
|
10
|
+
version: 0.9.4
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- James Coglan
|
@@ -9,19 +15,41 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-06-08 00:00:00 +01:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
22
|
+
name: rubyforge
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 0
|
33
|
+
- 4
|
34
|
+
version: 2.0.4
|
17
35
|
type: :development
|
18
|
-
|
19
|
-
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: hoe
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
20
42
|
requirements:
|
21
43
|
- - ">="
|
22
44
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
45
|
+
hash: 23
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 6
|
49
|
+
- 0
|
50
|
+
version: 2.6.0
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
25
53
|
description: ""
|
26
54
|
email:
|
27
55
|
- jcoglan@googlemail.com
|
@@ -62,21 +90,27 @@ rdoc_options:
|
|
62
90
|
require_paths:
|
63
91
|
- lib
|
64
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
65
94
|
requirements:
|
66
95
|
- - ">="
|
67
96
|
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
68
100
|
version: "0"
|
69
|
-
version:
|
70
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
71
103
|
requirements:
|
72
104
|
- - ">="
|
73
105
|
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
74
109
|
version: "0"
|
75
|
-
version:
|
76
110
|
requirements: []
|
77
111
|
|
78
112
|
rubyforge_project: oyster
|
79
|
-
rubygems_version: 1.3.
|
113
|
+
rubygems_version: 1.3.7
|
80
114
|
signing_key:
|
81
115
|
specification_version: 3
|
82
116
|
summary: ""
|