plain_option_parser 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZmQ2MTZkN2I4Njc2MjcyNTQxMzJkMTY1YmI0NGUyNTY1ZDU1MDVhYg==
5
+ data.tar.gz: !binary |-
6
+ NDhjMGIzM2NjNGMzNWIxZjgzNmFlN2U3ZmFmZTEwMDA5YWNlNzM0Mg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTY0ZmJiODk1ZDIxNTdhZGEwMzk5OTc4MGFkNjBhMjUwNDg0ZWU3N2EyNTVj
10
+ ZTVmNzkxNDk4NDNlYmZiODc2YjQwODZjYWU5ZDRkYjRlZmVkNDhiMmU2ODY5
11
+ MjhhNDEzNDczNzE2OGRiYjVmOTkxMWJjYWY4MmZiMTMwYTc4ZGI=
12
+ data.tar.gz: !binary |-
13
+ Zjg5ZGY2NzA2NDBhNTExZmJiODQ3ZTU5YzgxYmViODkwYmMyNDYyYmE0MjZm
14
+ MDk3YzE1MmFlMmEzZWI2NWNmNjQyYzQzZTAyYjgwYTM0ODdhZmI1NDIzMWUy
15
+ NmQ4NTRmZTM5NzRmYTZmMzk4Mzg1MDQxYzBhYTUzNDk5ODk3OGI=
data/Rakefile CHANGED
@@ -1,24 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "plain_option_parser"
8
- gem.summary = %Q{a heroku-like option parser}
9
- gem.description = %Q{Parse command-line options in style}
10
- gem.email = "kyle@kylemaxwell.com"
11
- gem.homepage = "http://github.com/fizx/plain_option_parser"
12
- gem.authors = ["Kyle Maxwell"]
13
- gem.add_development_dependency "rspec", ">= 0"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
19
- end
20
-
21
3
  require 'spec/rake/spectask'
4
+
22
5
  Spec::Rake::SpecTask.new(:spec) do |spec|
23
6
  spec.libs << 'lib' << 'spec'
24
7
  spec.spec_files = FileList['spec/**/*_spec.rb']
@@ -30,11 +13,9 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
30
13
  spec.rcov = true
31
14
  end
32
15
 
33
- task :spec => :check_dependencies
34
-
35
16
  task :default => :spec
36
17
 
37
- require 'rake/rdoctask'
18
+ require 'rdoc/task'
38
19
  Rake::RDocTask.new do |rdoc|
39
20
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
21
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -83,10 +83,11 @@ private
83
83
  args.each_with_index do |arg, i|
84
84
  @commands.each do |cmd|
85
85
  name, desc, additional, block = cmd
86
- viable.delete(cmd) if name[i] != arg
86
+ viable.delete(cmd) if name[i] != arg && !name[i].to_s.start_with?("[")
87
87
  end
88
88
  if viable.length == 1
89
- return [viable, args[viable[0][0].length, args.length]]
89
+ non_placeholder = viable[0][0].reject{|s| s.start_with?("[")}.size
90
+ return [viable, args[non_placeholder, args.length]]
90
91
  end
91
92
  end
92
93
  return [viable, []]
@@ -1,11 +1,7 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
1
 
6
2
  Gem::Specification.new do |s|
7
3
  s.name = %q{plain_option_parser}
8
- s.version = "0.1.2"
4
+ s.version = "0.2.0"
9
5
 
10
6
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
7
  s.authors = ["Kyle Maxwell"]
@@ -11,14 +11,33 @@ $pop = PlainOptionParser.new do
11
11
  cmd "test unset abc" do
12
12
  $abc = false
13
13
  end
14
+
15
+ desc "with placeholder"
16
+ cmd "test with [placeholder]" do |value|
17
+ $placeholder = value
18
+ end
14
19
  end
15
20
 
16
21
  describe "PlainOptionParser" do
22
+ before do
23
+ $abc = nil
24
+ end
25
+
26
+ it "should set placeholder" do
27
+ $pop.start %w[test with 123]
28
+ $placeholder.should == "123"
29
+ end
30
+
17
31
  it "should set abc" do
18
32
  $pop.start %w[test set abc 123]
19
33
  $abc.should == "123"
20
34
  end
21
35
 
36
+ it "should not match partial paths" do
37
+ $pop.start %w[test set]
38
+ $abc.should be_nil
39
+ end
40
+
22
41
  it "should unset abc" do
23
42
  $pop.start %w[test unset abc]
24
43
  $abc.should be_false
metadata CHANGED
@@ -1,47 +1,37 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: plain_option_parser
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Kyle Maxwell
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-03-12 00:00:00 -08:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2011-03-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
33
20
  type: :development
34
- version_requirements: *id001
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
35
27
  description: Parse command-line options in style
36
28
  email: kyle@kylemaxwell.com
37
29
  executables: []
38
-
39
30
  extensions: []
40
-
41
- extra_rdoc_files:
31
+ extra_rdoc_files:
42
32
  - LICENSE
43
33
  - README.rdoc
44
- files:
34
+ files:
45
35
  - .document
46
36
  - LICENSE
47
37
  - README.rdoc
@@ -51,40 +41,29 @@ files:
51
41
  - plain_option_parser.gemspec
52
42
  - spec/plain_option_parser_spec.rb
53
43
  - spec/spec_helper.rb
54
- has_rdoc: true
55
44
  homepage: http://github.com/fizx/plain_option_parser
56
45
  licenses: []
57
-
46
+ metadata: {}
58
47
  post_install_message:
59
48
  rdoc_options: []
60
-
61
- require_paths:
49
+ require_paths:
62
50
  - lib
63
- required_ruby_version: !ruby/object:Gem::Requirement
64
- none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- hash: 3
69
- segments:
70
- - 0
71
- version: "0"
72
- required_rubygems_version: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- hash: 3
78
- segments:
79
- - 0
80
- version: "0"
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
81
61
  requirements: []
82
-
83
62
  rubyforge_project:
84
- rubygems_version: 1.5.0
63
+ rubygems_version: 2.2.1
85
64
  signing_key:
86
65
  specification_version: 3
87
66
  summary: a heroku-like option parser
88
- test_files:
67
+ test_files:
89
68
  - spec/plain_option_parser_spec.rb
90
69
  - spec/spec_helper.rb