oyster 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ === 0.9.5 / 2011-07-19
2
+
3
+ * Remove dependency on Hoe and Rubyforge.
4
+
5
+
1
6
  === 0.9.4 / 2010-06-08
2
7
 
3
8
  * Make Dan happy and support '=' as an argument separator.
@@ -21,7 +26,7 @@
21
26
 
22
27
  === 0.9.0 / 2008-07-17
23
28
 
24
- * Initial release. Includes option parsing for flags, strings, ints,
25
- floats, globs, files, shortcuts and subcommands. Automatically
26
- renders man-page-style help to stdout with the -h flag.
29
+ * Initial release. Includes option parsing for flags, strings, ints, floats,
30
+ globs, files, shortcuts and subcommands. Automatically renders man-page-style
31
+ help to stdout with the -h flag.
27
32
 
@@ -2,15 +2,10 @@
2
2
 
3
3
  * http://github.com/jcoglan/oyster
4
4
 
5
- Oyster is a command-line input parser that doesn't hate you. It provides a simple
6
- API that you use to write a spec for the user interface to your program, and it
7
- handles mapping the input to a hash for you. It supports both long and short option
8
- names, subcommands, and various types of input data.
9
-
10
-
11
- === Installation
12
-
13
- sudo gem install oyster
5
+ Oyster is a command-line input parser that doesn't hate you. It provides a
6
+ simple API that you use to write a spec for the user interface to your program,
7
+ and it handles mapping the input to a hash for you. It supports both long and
8
+ short option names, subcommands, and various types of input data.
14
9
 
15
10
 
16
11
  === Features
@@ -29,11 +24,10 @@ names, subcommands, and various types of input data.
29
24
 
30
25
  You begin your command-line script by writing a spec for its options, layed out
31
26
  like a Unix manual page. This spec will be used to parse input and to generate
32
- help text using the <tt>--help</tt> flag. This example demonstrates a wide range of
33
- the spec API. You can use as much or as little of it as you like, none of the fields
34
- are required.
27
+ help text using the <tt>--help</tt> flag. This example demonstrates a wide range
28
+ of the spec API. You can use as much or as little of it as you like, none of the
29
+ fields are required.
35
30
 
36
- require 'rubygems'
37
31
  require 'oyster'
38
32
 
39
33
  spec = Oyster.spec do
@@ -94,17 +88,17 @@ are required.
94
88
  end
95
89
 
96
90
  Having defined your spec, you can use it to parse user input. Input is specified
97
- as an array of string tokens, and defaults to +ARGV+. If the program is invoked using
98
- <tt>--help</tt>, Oyster will throw a <tt>Oyster::HelpRendered</tt> exception that you can
99
- use to halt your program if necessary. An example taking input from the command
100
- line:
91
+ as an array of string tokens, and defaults to +ARGV+. If the program is invoked
92
+ using <tt>--help</tt>, Oyster will throw a <tt>Oyster::HelpRendered</tt>
93
+ exception that you can use to halt your program if necessary. An example taking
94
+ input from the command line:
101
95
 
102
96
  begin; opts = spec.parse
103
97
  rescue Oyster::HelpRendered; exit
104
98
  end
105
99
 
106
- <tt>spec.parse</tt> will return a <tt>Hash</tt> containing the values of the options
107
- as specified by the user. For example:
100
+ <tt>spec.parse</tt> will return a <tt>Hash</tt> containing the values of the
101
+ options as specified by the user. For example:
108
102
 
109
103
  Input: --verbose
110
104
  Output: opts[:verbose] == true
@@ -197,23 +191,21 @@ otherwise you'll get a name collision in the output.
197
191
 
198
192
  (The MIT License)
199
193
 
200
- Copyright (c) 2008-2010 James Coglan
201
-
202
- Permission is hereby granted, free of charge, to any person obtaining
203
- a copy of this software and associated documentation files (the
204
- 'Software'), to deal in the Software without restriction, including
205
- without limitation the rights to use, copy, modify, merge, publish,
206
- distribute, sublicense, and/or sell copies of the Software, and to
207
- permit persons to whom the Software is furnished to do so, subject to
208
- the following conditions:
209
-
210
- The above copyright notice and this permission notice shall be
211
- included in all copies or substantial portions of the Software.
212
-
213
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
214
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
215
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
216
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
217
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
218
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
219
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
194
+ Copyright (c) 2008-2011 James Coglan
195
+
196
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
197
+ this software and associated documentation files (the 'Software'), to deal in
198
+ the Software without restriction, including without limitation the rights to use,
199
+ copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
200
+ Software, and to permit persons to whom the Software is furnished to do so,
201
+ subject to the following conditions:
202
+
203
+ The above copyright notice and this permission notice shall be included in all
204
+ copies or substantial portions of the Software.
205
+
206
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
207
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
208
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
209
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
210
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
211
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,6 +1,4 @@
1
1
  module Oyster
2
- VERSION = '0.9.4'
3
-
4
2
  LONG_NAME = /^--([a-z\[][a-z0-9\]\-]+)$/i
5
3
  LONG_NAME_EQ = /^--([a-z\[][a-z0-9\]\-]+=.*)$/i
6
4
  SHORT_NAME = /^-([a-z0-9]+)$/i
@@ -13,7 +11,7 @@ module Oyster
13
11
 
14
12
  WINDOWS = RUBY_PLATFORM.split('-').any? { |part| part =~ /mswin\d*/i }
15
13
 
16
- class HelpRendered < StandardError; end
14
+ class HelpRendered < StandardError ; end
17
15
 
18
16
  def self.spec(*args, &block)
19
17
  spec = Specification.new
@@ -25,20 +23,18 @@ module Oyster
25
23
  def self.is_name?(string)
26
24
  !string.nil? and !!(string =~ LONG_NAME || string =~ SHORT_NAME || string == STOP_FLAG)
27
25
  end
26
+
27
+ ROOT = File.expand_path('..', __FILE__)
28
+
29
+ require ROOT + '/oyster/specification'
30
+ require ROOT + '/oyster/option'
31
+ require ROOT + '/oyster/options/flag'
32
+ require ROOT + '/oyster/options/string'
33
+ require ROOT + '/oyster/options/integer'
34
+ require ROOT + '/oyster/options/float'
35
+ require ROOT + '/oyster/options/file'
36
+ require ROOT + '/oyster/options/array'
37
+ require ROOT + '/oyster/options/glob'
38
+ require ROOT + '/oyster/options/shortcut'
39
+ require ROOT + '/oyster/options/subcommand'
28
40
  end
29
-
30
- [ 'specification',
31
- 'option',
32
- 'options/flag',
33
- 'options/string',
34
- 'options/integer',
35
- 'options/float',
36
- 'options/file',
37
- 'options/array',
38
- 'options/glob',
39
- 'options/shortcut',
40
- 'options/subcommand'
41
- ].each do |file|
42
- require File.dirname(__FILE__) + '/oyster/' + file
43
- end
44
-
@@ -1,5 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
1
3
  require 'test/unit'
2
- require 'oyster'
4
+
5
+ require File.dirname(__FILE__) + '/../lib/oyster'
3
6
 
4
7
  class OysterTest < Test::Unit::TestCase
5
8
 
@@ -180,7 +183,7 @@ class OysterTest < Test::Unit::TestCase
180
183
 
181
184
  def test_globs
182
185
  opts = @spec.parse %w(add --filelist ./*.txt)
183
- assert_equal './History.txt, ./Manifest.txt, ./README.txt', opts[:add][:filelist].sort.join(', ')
186
+ assert_equal './History.txt', opts[:add][:filelist].sort.join(', ')
184
187
  end
185
188
 
186
189
  def test_subcommands
@@ -199,8 +202,8 @@ class OysterTest < Test::Unit::TestCase
199
202
  end
200
203
 
201
204
  def test_file
202
- opts = @spec.parse %w(--path Rakefile)
203
- assert opts[:path] =~ /Hoe/
205
+ opts = @spec.parse %w(--path README.rdoc)
206
+ assert opts[:path] =~ /License/
204
207
  end
205
208
 
206
209
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oyster
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 9
9
- - 4
10
- version: 0.9.4
4
+ prerelease:
5
+ version: 0.9.5
11
6
  platform: ruby
12
7
  authors:
13
8
  - James Coglan
@@ -15,59 +10,30 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-06-08 00:00:00 +01:00
19
- default_executable:
13
+ date: 2011-07-19 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
- name: rubyforge
16
+ name: test-unit
23
17
  prerelease: false
24
18
  requirement: &id001 !ruby/object:Gem::Requirement
25
19
  none: false
26
20
  requirements:
27
21
  - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 2
32
- - 0
33
- - 4
34
- version: 2.0.4
23
+ version: "0"
35
24
  type: :development
36
25
  version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: hoe
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 23
46
- segments:
47
- - 2
48
- - 6
49
- - 0
50
- version: 2.6.0
51
- type: :development
52
- version_requirements: *id002
53
- description: ""
54
- email:
55
- - jcoglan@googlemail.com
26
+ description:
27
+ email: jcoglan@gmail.com
56
28
  executables: []
57
29
 
58
30
  extensions: []
59
31
 
60
32
  extra_rdoc_files:
61
- - History.txt
62
- - Manifest.txt
63
- - README.txt
33
+ - README.rdoc
64
34
  files:
65
35
  - History.txt
66
- - Manifest.txt
67
- - README.txt
68
- - Rakefile
69
- - lib/oyster.rb
70
- - lib/oyster/specification.rb
36
+ - README.rdoc
71
37
  - lib/oyster/option.rb
72
38
  - lib/oyster/options/array.rb
73
39
  - lib/oyster/options/file.rb
@@ -78,15 +44,16 @@ files:
78
44
  - lib/oyster/options/shortcut.rb
79
45
  - lib/oyster/options/string.rb
80
46
  - lib/oyster/options/subcommand.rb
47
+ - lib/oyster/specification.rb
48
+ - lib/oyster.rb
81
49
  - test/test_oyster.rb
82
- has_rdoc: true
83
50
  homepage: http://github.com/jcoglan/oyster
84
51
  licenses: []
85
52
 
86
53
  post_install_message:
87
54
  rdoc_options:
88
55
  - --main
89
- - README.txt
56
+ - README.rdoc
90
57
  require_paths:
91
58
  - lib
92
59
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -94,25 +61,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
61
  requirements:
95
62
  - - ">="
96
63
  - !ruby/object:Gem::Version
97
- hash: 3
98
- segments:
99
- - 0
100
64
  version: "0"
101
65
  required_rubygems_version: !ruby/object:Gem::Requirement
102
66
  none: false
103
67
  requirements:
104
68
  - - ">="
105
69
  - !ruby/object:Gem::Version
106
- hash: 3
107
- segments:
108
- - 0
109
70
  version: "0"
110
71
  requirements: []
111
72
 
112
- rubyforge_project: oyster
113
- rubygems_version: 1.3.7
73
+ rubyforge_project:
74
+ rubygems_version: 1.8.5
114
75
  signing_key:
115
76
  specification_version: 3
116
- summary: ""
117
- test_files:
118
- - test/test_oyster.rb
77
+ summary: Command-line input parser that doesn't hate you
78
+ test_files: []
79
+
@@ -1,17 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
4
- Rakefile
5
- lib/oyster.rb
6
- lib/oyster/specification.rb
7
- lib/oyster/option.rb
8
- lib/oyster/options/array.rb
9
- lib/oyster/options/file.rb
10
- lib/oyster/options/flag.rb
11
- lib/oyster/options/float.rb
12
- lib/oyster/options/glob.rb
13
- lib/oyster/options/integer.rb
14
- lib/oyster/options/shortcut.rb
15
- lib/oyster/options/string.rb
16
- lib/oyster/options/subcommand.rb
17
- test/test_oyster.rb
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'rubygems'
4
- require 'hoe'
5
- require './lib/oyster.rb'
6
-
7
- Hoe.spec('oyster') do |p|
8
- p.developer('James Coglan', 'jcoglan@googlemail.com')
9
- end
10
-
11
- # vim: syntax=Ruby