optparse_ex 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in optparse_ex.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Masa
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # OptparseEx
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'optparse_ex'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install optparse_ex
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,32 @@
1
+ require "optparse_ex/version"
2
+
3
+ require 'optparse'
4
+ module OptparseEx
5
+
6
+ class ::OptionParser
7
+ attr_reader :p
8
+ alias :_on :on
9
+ def on(attr, *args, &block)
10
+ if attr.is_a?(Symbol)
11
+ self.class.class_eval do
12
+ unless method_defined?(attr)
13
+ attr_accessor attr
14
+ else
15
+ raise "Method #{attr.to_s} is already defined in OptionParser class"
16
+ end
17
+ end
18
+ unless args.first =~ /^\-/
19
+ self.send(attr.to_s+"=", args.shift)
20
+ end
21
+ _on(*args) do |i|
22
+ self.send(attr.to_s+"=", i)
23
+ block.call(i) if block
24
+ end
25
+ else
26
+ args.unshift attr
27
+ _on(*args, block)
28
+ end
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,3 @@
1
+ module OptparseEx
2
+ VERSION = "0.0.4"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'optparse_ex/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "optparse_ex"
8
+ spec.version = OptparseEx::VERSION
9
+ spec.authors = ["Masa"]
10
+ spec.email = ["masaomi.hatakeyama@gmail.com"]
11
+ spec.description = %q{This extension allows us to use optparse library more simply to add accessor method.}
12
+ spec.summary = %q{A small extension of optparse library.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ #spec.files = `git ls-files`.split($/)
17
+ spec.files = `bzr ls --versioned --recursive`.split($/).select{|file| !File.directory?(file)}
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optparse_ex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -50,7 +50,14 @@ email:
50
50
  executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
- files: []
53
+ files:
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - lib/optparse_ex/version.rb
59
+ - lib/optparse_ex.rb
60
+ - optparse_ex.gemspec
54
61
  homepage: ''
55
62
  licenses:
56
63
  - MIT