[DRE-commits] [ruby-slop] 01/05: Imported Upstream version 3.4.7
Jonas Genannt
jonas at brachium-system.net
Sun Dec 15 11:54:20 UTC 2013
This is an automated email from the git hooks/post-receive script.
hggh-guest pushed a commit to branch master
in repository ruby-slop.
commit c6bfbeb666bf165aada6a22bf4c9277a32d6344f
Author: Jonas Genannt <jonas at brachium-system.net>
Date: Sun Dec 15 12:39:20 2013 +0100
Imported Upstream version 3.4.7
---
CHANGES.md | 6 ++++++
README.md | 6 +++---
checksums.yaml.gz | Bin 268 -> 270 bytes
lib/slop.rb | 6 +++++-
lib/slop/commands.rb | 2 +-
metadata.yml | 6 +++---
slop.gemspec | 4 ++--
test/slop_test.rb | 10 ++++++++++
8 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index aa1e829..1eaf223 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,9 @@
+3.4.7 (2013-11-14)
+------------------
+
+* Ensure trash is cleared on every parse so you can parse multiple
+ times with the same instance (#130)
+
3.4.5 (2013-05-14)
------------------
diff --git a/README.md b/README.md
index 4650376..51a75ff 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,9 @@ Slop
====
Slop is a simple option parser with an easy to remember syntax and friendly API.
-API Documentation is available [here](http://injekt.github.com/rdoc/slop/).
+API Documentation is available [here](http://leejarvis.github.com/rdoc/slop/).
-[](http://travis-ci.org/injekt/slop)
+[](http://travis-ci.org/leejarvis/slop)
Usage
-----
@@ -123,7 +123,7 @@ opts = Slop.parse do
command 'add' do
on :v, :verbose, 'Enable verbose mode'
- on :name, 'Your name'
+ on :name=, 'Your name'
run do |opts, args|
puts "You ran 'add' with options #{opts.to_hash} and args: #{args.inspect}"
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
index 243b409..b5c18a8 100644
Binary files a/checksums.yaml.gz and b/checksums.yaml.gz differ
diff --git a/lib/slop.rb b/lib/slop.rb
index 3a5c9d0..e420f58 100644
--- a/lib/slop.rb
+++ b/lib/slop.rb
@@ -4,7 +4,7 @@ require 'slop/commands'
class Slop
include Enumerable
- VERSION = '3.4.6'
+ VERSION = '3.4.7'
# The main Error class, all Exception classes inherit from this class.
class Error < StandardError; end
@@ -226,6 +226,10 @@ class Slop
return items
end
+ # reset the trash so it doesn't carry over if you parse multiple
+ # times with the same instance
+ @trash.clear
+
if cmd = @commands[items[0]]
items.shift
return cmd.parse! items
diff --git a/lib/slop/commands.rb b/lib/slop/commands.rb
index e62ef17..cebb560 100644
--- a/lib/slop/commands.rb
+++ b/lib/slop/commands.rb
@@ -40,7 +40,7 @@ class Slop
@triggered_command = nil
warn "[DEPRECATED] Slop::Commands is deprecated and will be removed in "\
- "Slop version 4. Check out http://injekt.github.com/slop/#commands for "\
+ "Slop version 4. Check out http://leejarvis.github.io/slop/#commands for "\
"a new implementation of commands."
if block_given?
diff --git a/metadata.yml b/metadata.yml
index 307e8f5..36b019d 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: slop
version: !ruby/object:Gem::Version
- version: 3.4.6
+ version: 3.4.7
platform: ruby
authors:
- Lee Jarvis
autorequire:
bindir: bin
cert_chain: []
-date: 2013-07-25 00:00:00.000000000 Z
+date: 2013-11-14 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: rake
@@ -59,7 +59,7 @@ files:
- test/helper.rb
- test/option_test.rb
- test/slop_test.rb
-homepage: http://github.com/injekt/slop
+homepage: http://github.com/leejarvis/slop
licenses:
- MIT
metadata: {}
diff --git a/slop.gemspec b/slop.gemspec
index 9bb971e..44952bb 100644
--- a/slop.gemspec
+++ b/slop.gemspec
@@ -1,11 +1,11 @@
Gem::Specification.new do |s|
s.name = 'slop'
- s.version = '3.4.6'
+ s.version = '3.4.7'
s.summary = 'Simple Lightweight Option Parsing'
s.description = 'A simple DSL for gathering options and parsing the command line'
s.author = 'Lee Jarvis'
s.email = 'ljjarvis at gmail.com'
- s.homepage = 'http://github.com/injekt/slop'
+ s.homepage = 'http://github.com/leejarvis/slop'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- test/*`.split("\n")
s.license = 'MIT'
diff --git a/test/slop_test.rb b/test/slop_test.rb
index 1fd0955..3b630f5 100644
--- a/test/slop_test.rb
+++ b/test/slop_test.rb
@@ -505,4 +505,14 @@ class SlopTest < TestCase
assert_equal 'second', i
end
+ test "taking out the trash" do
+ args = []
+ opts = Slop.new { on :f, :foo }
+ opts.run { |_, a| args = a }
+ opts.parse! %w(--foo bar)
+ assert_equal %w(bar), args
+ opts.parse! %w(foo)
+ assert_equal %w(foo), args
+ end
+
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-slop.git
More information about the Pkg-ruby-extras-commits
mailing list