dry_option_parser 1.0.0

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: bb4ac599313f2cd2b9ea092d8445383dc8e50d9c
4
+ data.tar.gz: afea1a0ec1046c7c01f26f071fab2bc17ff3d646
5
+ SHA512:
6
+ metadata.gz: df699b0276b84447a9e6cd48061507f84455a95705b8e506fcde07baf9f93563ee798d1fb81d9973efaf4c2207c8bff3f32479d0a07f9e82f31bd7c3bdf1a8a2
7
+ data.tar.gz: 3dc3f49e41a18ff35ebc19a04ca618867a0c1d73280dbfb55de7aab0c16fad9c49302ff93597c3ef15bea0172c3dfa81705a40e7419dbef3411983633ed07fd3
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format doc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dry_option_parser.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Petr Skocik
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,67 @@
1
+ DRY OPTION PARSER
2
+ =================
3
+
4
+ *Makes OptionParser less verbose.*
5
+
6
+ Instead of
7
+
8
+ ```ruby
9
+ require 'optparse'
10
+
11
+ options = {}
12
+ OptionParser.new do |opts|
13
+ opts.banner = "Usage: example.rb [options]"
14
+
15
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
16
+ options[:verbose] = v
17
+ end
18
+ end.parse!
19
+
20
+ p options
21
+ p ARGV
22
+ ```
23
+
24
+ do
25
+
26
+ ```ruby
27
+ require 'dry_option_parser'
28
+ include DryOptionParser
29
+
30
+ opt_parser = DryOptionParsers.new({}) do
31
+ self.banner = "Usage: example.rb [options]"
32
+ assign(:verbose,"-v", "--[no-]verbose", "Run verbosely")
33
+ end.parse!
34
+
35
+ p opt_parses.options
36
+ p ARGV
37
+ ```
38
+
39
+ Basically, a `DryOptionParser` manages an `OptionParser` instance to which it delegates all instance method calls. Additionally it manages its own `options` object accessible via `:options` accessor methods.
40
+ (A total of 2 instance variables). Block arguments to new are `instance_eval`ed within the new `DryOptionParser` instance. `DryOptionParsers` also provides the `assign` private method, which simplifies option specs that simply do:
41
+
42
+ ```ruby
43
+ opts.on(...) do |value|
44
+ options[:attribute] = value
45
+ nd
46
+ ```
47
+
48
+ allowing you to replace them with:
49
+
50
+ ```ruby
51
+ assign(:attribute,...)
52
+ ```
53
+
54
+ Otherwise, all `OptionParser` documentation applies.
55
+
56
+ ###One More Thing:
57
+ By including `DryOptionParser` you also get the `cli_options` helper method which simplifies calling `DryOptionParser.new() {}`, allowing you to ultimately shorten the basic example to:
58
+
59
+ ```ruby
60
+ opt_parser = cli_options do
61
+ self.banner = "Usage: example.rb [options]"
62
+ assign(:verbose,"-v", "--[no-]verbose", "Run verbosely")
63
+ end.parse!
64
+ ```
65
+ ###The long example
66
+
67
+ Check out the **examples** directory to see how much you can shorten the long **OptionParser** example from http://www.ruby-doc.org/stdlib-2.1.3/libdoc/optparse/rdoc/OptionParser.html by using **DryOptionParser**.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
@@ -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 'dry_option_parser/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dry_option_parser"
8
+ spec.version = DryOptionParser::VERSION
9
+ spec.authors = ["Petr Skocik"]
10
+ spec.email = ["pskocik@gmail.com"]
11
+ spec.summary = %q{Save keystrokes with OptionParser while using more or less the same API.}
12
+ spec.description = %q{Save keystrokes with OptionParser while using more or less the same API.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require 'dry_option_parser'
5
+ require 'ostruct'
6
+ require 'optparse/time'
7
+ include DryOptionParser
8
+
9
+ options = OpenStruct.new
10
+ options.library = []
11
+ options.inplace = false
12
+ options.encoding = "utf8"
13
+ options.transfer_type = :auto
14
+ options.verbose = false
15
+
16
+ opt_parser = cli_options(options) do
17
+ codes = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
18
+ code_aliases = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
19
+
20
+ self.banner = "Usage: example.rb [@options]"
21
+
22
+ separator ""
23
+ separator "Specific @options:"
24
+
25
+ # Mandatory argument.
26
+ assign("library", "-r", "--require LIBRARY",
27
+ "Require the LIBRARY before executing your script") do |lib|
28
+ @options.library << lib
29
+ end
30
+
31
+ # Optional argument; multi-line description.
32
+ on("-i", "--inplace [EXTENSION]",
33
+ "Edit ARGV files in place",
34
+ " (make backup if EXTENSION supplied)") do |ext|
35
+ @options.inplace = true
36
+ @options.extension = ext || ''
37
+ @options.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot.
38
+ end
39
+
40
+ # Cast 'delay' argument to a Float.
41
+ assign("delay", "--delay N", Float, "Delay N seconds before executing")
42
+ # Cast 'time' argument to a Time object.
43
+ assign("time", "-t", "--time [TIME]", Time, "Begin execution at given time")
44
+
45
+ # Cast to octal integer.
46
+ assign("record_separator","-F", "--irs [OCTAL]", OptionParser::OctalInteger,
47
+ "Specify record separator (default \\0)")
48
+
49
+ # List of arguments.
50
+ assign("list","--list x,y,z", Array, "Example 'list' of arguments")
51
+
52
+ # Keyword completion. We are specifying a specific set of arguments (codes
53
+ # and code_aliases - notice the latter is a Hash), and the user may provide
54
+ # the shortest unambiguous text.
55
+ code_list = (code_aliases.keys + codes).join(',')
56
+ assign("encoding","--code CODE", codes, code_aliases, "Select encoding",
57
+ " (#{code_list})")
58
+
59
+ # Optional argument with keyword completion.
60
+ on("--type [TYPE]", [:text, :binary, :auto],
61
+ "Select transfer type (text, binary, auto)","transfer_type")
62
+
63
+ # Boolean switch.
64
+ on("-v", "--[no-]verbose", "Run verbosely", "verbose")
65
+
66
+ separator ""
67
+ separator "Common @options:"
68
+
69
+ # No argument, shows at tail. This will print an @options summary.
70
+ # Try it and see!
71
+ on_tail("-h", "--help", "Show this message") do
72
+ puts opts
73
+ exit
74
+ end
75
+
76
+ # Another typical switch to print the version.
77
+ on_tail("--version", "Show version") do
78
+ puts ::Version.join('.')
79
+ exit
80
+ end
81
+ end
82
+
83
+ opt_parser.parse!(ARGV)
84
+ options = opt_parser.options
85
+
@@ -0,0 +1,111 @@
1
+ require 'optparse'
2
+ require 'optparse/time'
3
+ require 'ostruct'
4
+ require 'pp'
5
+
6
+ class OptparseExample
7
+
8
+ CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
9
+ CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
10
+
11
+ #
12
+ # Return a structure describing the options.
13
+ #
14
+ def self.parse(args)
15
+ # The options specified on the command line will be collected in *options*.
16
+ # We set default values here.
17
+ options = OpenStruct.new
18
+ options.library = []
19
+ options.inplace = false
20
+ options.encoding = "utf8"
21
+ options.transfer_type = :auto
22
+ options.verbose = false
23
+
24
+ opt_parser = OptionParser.new do |opts|
25
+ opts.banner = "Usage: example.rb [options]"
26
+
27
+ opts.separator ""
28
+ opts.separator "Specific options:"
29
+
30
+ # Mandatory argument.
31
+ opts.on("-r", "--require LIBRARY",
32
+ "Require the LIBRARY before executing your script") do |lib|
33
+ options.library << lib
34
+ end
35
+
36
+ # Optional argument; multi-line description.
37
+ opts.on("-i", "--inplace [EXTENSION]",
38
+ "Edit ARGV files in place",
39
+ " (make backup if EXTENSION supplied)") do |ext|
40
+ options.inplace = true
41
+ options.extension = ext || ''
42
+ options.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot.
43
+ end
44
+
45
+ # Cast 'delay' argument to a Float.
46
+ opts.on("--delay N", Float, "Delay N seconds before executing") do |n|
47
+ options.delay = n
48
+ end
49
+
50
+ # Cast 'time' argument to a Time object.
51
+ opts.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
52
+ options.time = time
53
+ end
54
+
55
+ # Cast to octal integer.
56
+ opts.on("-F", "--irs [OCTAL]", OptionParser::OctalInteger,
57
+ "Specify record separator (default \\0)") do |rs|
58
+ options.record_separator = rs
59
+ end
60
+
61
+ # List of arguments.
62
+ opts.on("--list x,y,z", Array, "Example 'list' of arguments") do |list|
63
+ options.list = list
64
+ end
65
+
66
+ # Keyword completion. We are specifying a specific set of arguments (CODES
67
+ # and CODE_ALIASES - notice the latter is a Hash), and the user may provide
68
+ # the shortest unambiguous text.
69
+ code_list = (CODE_ALIASES.keys + CODES).join(',')
70
+ opts.on("--code CODE", CODES, CODE_ALIASES, "Select encoding",
71
+ " (#{code_list})") do |encoding|
72
+ options.encoding = encoding
73
+ end
74
+
75
+ # Optional argument with keyword completion.
76
+ opts.on("--type [TYPE]", [:text, :binary, :auto],
77
+ "Select transfer type (text, binary, auto)") do |t|
78
+ options.transfer_type = t
79
+ end
80
+
81
+ # Boolean switch.
82
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
83
+ options.verbose = v
84
+ end
85
+
86
+ opts.separator ""
87
+ opts.separator "Common options:"
88
+
89
+ # No argument, shows at tail. This will print an options summary.
90
+ # Try it and see!
91
+ opts.on_tail("-h", "--help", "Show this message") do
92
+ puts opts
93
+ exit
94
+ end
95
+
96
+ # Another typical switch to print the version.
97
+ opts.on_tail("--version", "Show version") do
98
+ puts ::Version.join('.')
99
+ exit
100
+ end
101
+ end
102
+
103
+ opt_parser.parse!(args)
104
+ options
105
+ end # parse()
106
+
107
+ end # class OptparseExample
108
+
109
+ options = OptparseExample.parse(ARGV)
110
+ pp options
111
+ pp ARGV
@@ -0,0 +1,3 @@
1
+ module DryOptionParser
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,30 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require "dry_option_parser/version"
4
+
5
+ require 'optparse'
6
+ require 'delegate'
7
+
8
+
9
+ module DryOptionParser
10
+ class DryOptionParser < SimpleDelegator
11
+
12
+ def initialize(options={},&blk)
13
+ super(OptionParser.new)
14
+ instance_eval &blk
15
+ @options = options
16
+ end
17
+
18
+ def assign(*args)
19
+ attribute = args.shift
20
+ on(*args) {|val| @options[attribute]=val}
21
+ end
22
+
23
+ attr_accessor :options
24
+ #
25
+ end # class OptparseExample
26
+
27
+ def cli_options(options={},&blk)
28
+ DryOptionParser.new(options,&blk)
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+ require 'dry_option_parser'
4
+
5
+ module DryOptionParser
6
+ describe DryOptionParser do
7
+ subject do
8
+ DryOptionParser.new({}) do
9
+ end
10
+ end
11
+ it { should_not be_nil }
12
+ it "should respond to all OptionParser's public methods" do
13
+ OptionParser.new.public_methods.each do |pubmeth|
14
+ should respond_to(pubmeth)
15
+ end
16
+ end
17
+ it {should respond_to(:options) }
18
+ it {should respond_to(:assign) }
19
+ end
20
+ end
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require 'dry_option_parser'
5
+ require 'ostruct'
6
+ require 'optparse/time'
7
+ include DryOptionParser
8
+
9
+ describe "DryOptionParser--the long OptionParser example" do
10
+ before do
11
+ @options = OpenStruct.new
12
+ @options.library = []
13
+ @options.inplace = false
14
+ @options.encoding = "utf8"
15
+ @options.transfer_type = :auto
16
+ @options.verbose = false
17
+ end
18
+
19
+ # Refactor the long optionparser example using DryOptionParser
20
+ subject do
21
+ @opt_parser = cli_options(@options) do
22
+ codes = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
23
+ code_aliases = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
24
+
25
+ self.banner = "Usage: example.rb [@options]"
26
+
27
+ separator ""
28
+ separator "Specific @options:"
29
+
30
+ # Mandatory argument.
31
+ assign("library", "-r", "--require LIBRARY",
32
+ "Require the LIBRARY before executing your script") do |lib|
33
+ @options.library << lib
34
+ end
35
+
36
+ # Optional argument; multi-line description.
37
+ on("-i", "--inplace [EXTENSION]",
38
+ "Edit ARGV files in place",
39
+ " (make backup if EXTENSION supplied)") do |ext|
40
+ @options.inplace = true
41
+ @options.extension = ext || ''
42
+ @options.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot.
43
+ end
44
+
45
+ # Cast 'delay' argument to a Float.
46
+ assign("delay", "--delay N", Float, "Delay N seconds before executing")
47
+ # Cast 'time' argument to a Time object.
48
+ assign("time", "-t", "--time [TIME]", Time, "Begin execution at given time")
49
+
50
+ # Cast to octal integer.
51
+ assign("record_separator","-F", "--irs [OCTAL]", OptionParser::OctalInteger,
52
+ "Specify record separator (default \\0)")
53
+
54
+ # List of arguments.
55
+ assign("list","--list x,y,z", Array, "Example 'list' of arguments")
56
+
57
+ # Keyword completion. We are specifying a specific set of arguments (codes
58
+ # and code_aliases - notice the latter is a Hash), and the user may provide
59
+ # the shortest unambiguous text.
60
+ code_list = (code_aliases.keys + codes).join(',')
61
+ assign("encoding","--code CODE", codes, code_aliases, "Select encoding",
62
+ " (#{code_list})")
63
+
64
+ # Optional argument with keyword completion.
65
+ on("--type [TYPE]", [:text, :binary, :auto],
66
+ "Select transfer type (text, binary, auto)","transfer_type")
67
+
68
+ # Boolean switch.
69
+ on("-v", "--[no-]verbose", "Run verbosely", "verbose")
70
+
71
+ separator ""
72
+ separator "Common @options:"
73
+
74
+ # No argument, shows at tail. This will print an @options summary.
75
+ # Try it and see!
76
+ on_tail("-h", "--help", "Show this message") do
77
+ puts opts
78
+ exit
79
+ end
80
+
81
+ # Another typical switch to print the version.
82
+ on_tail("--version", "Show version") do
83
+ puts ::Version.join('.')
84
+ exit
85
+ end
86
+ end
87
+ end
88
+ #End of refactored long example
89
+
90
+ #Some tests
91
+ it "should successfully evaluate the full example" do
92
+ should_not be_nil
93
+ end
94
+
95
+ context "parsing with various args" do
96
+ it "should return default options if no args given" do
97
+ subject.parse!([])
98
+ expect(subject.options.each_pair.all? {|k,v| @options[k]==v}).to be_truthy
99
+ end
100
+
101
+ it "-r something should add library" do
102
+ subject.parse!(%w[-r foo])
103
+ expect(subject.options[:library]).to include("foo")
104
+ end
105
+ it "--delay 7 should assign a delay of 7.0" do
106
+ subject.parse!(%w[--delay 7])
107
+ expect(subject.options[:delay]).to eq(7.0)
108
+ end
109
+ end
110
+
111
+
112
+ end
113
+
114
+
@@ -0,0 +1,91 @@
1
+ lib=File.expand_path('../../lib',__FILE__)
2
+ $:.unshift(lib) unless $:.include?(lib)
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
6
+ # file to always be loaded, without a need to explicitly require it in any files.
7
+ #
8
+ # Given that it is always loaded, you are encouraged to keep this file as
9
+ # light-weight as possible. Requiring heavyweight dependencies from this file
10
+ # will add to the boot time of your test suite on EVERY test run, even for an
11
+ # individual file that may not need all of that loaded. Instead, consider making
12
+ # a separate helper file that requires the additional dependencies and performs
13
+ # the additional setup, and require it from the spec files that actually need it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
54
+ # For more details, see:
55
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
56
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
57
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
58
+ config.disable_monkey_patching!
59
+
60
+ # This setting enables warnings. It's recommended, but in some cases may
61
+ # be too noisy due to issues in dependencies.
62
+ config.warnings = true
63
+
64
+ # Many RSpec users commonly either run the entire suite or an individual
65
+ # file, and it's useful to allow more verbose output when running an
66
+ # individual spec file.
67
+ if config.files_to_run.one?
68
+ # Use the documentation formatter for detailed output,
69
+ # unless a formatter has already been configured
70
+ # (e.g. via a command-line flag).
71
+ config.default_formatter = 'doc'
72
+ end
73
+
74
+ # Print the 10 slowest examples and example groups at the
75
+ # end of the spec run, to help surface which specs are running
76
+ # particularly slow.
77
+ config.profile_examples = 10
78
+
79
+ # Run specs in random order to surface order dependencies. If you find an
80
+ # order dependency and want to debug it, you can fix the order by providing
81
+ # the seed, which is printed after each run.
82
+ # --seed 1234
83
+ config.order = :random
84
+
85
+ # Seed global randomization in this process using the `--seed` CLI option.
86
+ # Setting this allows you to use `--seed` to deterministically reproduce
87
+ # test failures related to randomization by passing the same `--seed` value
88
+ # as the one that triggered the failure.
89
+ Kernel.srand config.seed
90
+ =end
91
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dry_option_parser
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Petr Skocik
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Save keystrokes with OptionParser while using more or less the same API.
56
+ email:
57
+ - pskocik@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - dry_option_parser.gemspec
69
+ - examples/dry_option_parser_example.rb
70
+ - examples/option_parser_example.rb
71
+ - lib/dry_option_parser.rb
72
+ - lib/dry_option_parser/version.rb
73
+ - spec/dry_option_parser_spec.rb
74
+ - spec/refactored_optionparser_spec.rb
75
+ - spec/spec_helper.rb
76
+ homepage: ''
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.2.1
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Save keystrokes with OptionParser while using more or less the same API.
100
+ test_files:
101
+ - spec/dry_option_parser_spec.rb
102
+ - spec/refactored_optionparser_spec.rb
103
+ - spec/spec_helper.rb