Hello community,

here is the log from the commit of package rubygem-slop for openSUSE:Factory 
checked in at 2016-09-12 13:26:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-slop (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-slop.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-slop"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-slop/rubygem-slop.changes        
2016-03-26 18:14:34.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-slop.new/rubygem-slop.changes   
2016-09-12 13:26:30.000000000 +0200
@@ -1,0 +2,15 @@
+Tue Aug 16 04:33:56 UTC 2016 - [email protected]
+
+- updated to version 4.4.0
+ see installed CHANGELOG.md
+
+  v4.4.0 (2016-08-15)
+  -------------------
+  
+  Features
+    * Support parsing arguments prefixed with dashes. #192 (Andrew Clemons)
+  
+  Bug fixes:
+    * Retain sort order inside tail sort. #193 (Caio Chassot)
+
+-------------------------------------------------------------------

Old:
----
  slop-4.3.0.gem

New:
----
  slop-4.4.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-slop.spec ++++++
--- /var/tmp/diff_new_pack.dH7jr1/_old  2016-09-12 13:26:31.000000000 +0200
+++ /var/tmp/diff_new_pack.dH7jr1/_new  2016-09-12 13:26:31.000000000 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-slop
-Version:        4.3.0
+Version:        4.4.0
 Release:        0
 %define mod_name slop
 %define mod_full_name %{mod_name}-%{version}

++++++ slop-4.3.0.gem -> slop-4.4.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2016-03-19 11:25:22.000000000 +0100
+++ new/CHANGELOG.md    2016-08-15 11:18:08.000000000 +0200
@@ -1,6 +1,15 @@
 Changelog
 =========
 
+v4.4.0 (2016-08-15)
+-------------------
+
+Features
+  * Support parsing arguments prefixed with dashes. #192 (Andrew Clemons)
+
+Bug fixes:
+  * Retain sort order inside tail sort. #193 (Caio Chassot)
+
 v4.3.0 (2016-03-19)
 -------------------
 
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/slop/options.rb new/lib/slop/options.rb
--- old/lib/slop/options.rb     2016-03-19 11:25:22.000000000 +0100
+++ new/lib/slop/options.rb     2016-08-15 11:18:08.000000000 +0200
@@ -101,7 +101,7 @@
       str = config[:banner] ? "#{banner}\n" : ""
       len = longest_flag_length
 
-      options.select(&:help?).sort_by(&:tail).each_with_index do |opt, i|
+      options.select(&:help?).each_with_index.sort_by{ |o,i| [o.tail, i] 
}.each do |opt, i|
         # use the index to fetch an associated separator
         if sep = separators[i]
           str << "#{sep}\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/slop/parser.rb new/lib/slop/parser.rb
--- old/lib/slop/parser.rb      2016-03-19 11:25:22.000000000 +0100
+++ new/lib/slop/parser.rb      2016-08-15 11:18:08.000000000 +0200
@@ -43,7 +43,8 @@
 
       @arguments = strings.dup
 
-      pairs.each do |flag, arg|
+      pairs.each_with_index do |pair, idx|
+        flag, arg = pair
         break if !flag
 
         # ignore everything after '--', flag or not
@@ -54,6 +55,7 @@
 
         # support `foo=bar`
         orig_flag = flag.dup
+        orig_arg = arg
         if flag.include?("=")
           flag, arg = flag.split("=")
         end
@@ -63,6 +65,12 @@
           # arguments (plus the arg if necessary)
           # delete argument first while we can find its index.
           if opt.expects_argument?
+
+            # if we consumed the argument, remove the next pair
+            if orig_arg == opt.value.to_s
+              pairs.delete_at(idx + 1)
+            end
+
             arguments.each_with_index do |argument, i|
               if argument == orig_flag && !orig_flag.include?("=")
                 arguments.delete_at(i + 1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/slop/types.rb new/lib/slop/types.rb
--- old/lib/slop/types.rb       2016-03-19 11:25:22.000000000 +0100
+++ new/lib/slop/types.rb       2016-08-15 11:18:08.000000000 +0200
@@ -44,7 +44,7 @@
   # Cast the option argument to an Integer.
   class IntegerOption < Option
     def call(value)
-      value =~ /\A\d+\z/ && value.to_i
+      value =~ /\A-?\d+\z/ && value.to_i
     end
   end
   IntOption = IntegerOption
@@ -53,7 +53,7 @@
   class FloatOption < Option
     def call(value)
       # TODO: scientific notation, etc.
-      value =~ /\A\d*\.*\d+\z/ && value.to_f
+      value =~ /\A-?\d*\.*\d+\z/ && value.to_f
     end
   end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/slop.rb new/lib/slop.rb
--- old/lib/slop.rb     2016-03-19 11:25:22.000000000 +0100
+++ new/lib/slop.rb     2016-08-15 11:18:08.000000000 +0200
@@ -6,7 +6,7 @@
 require 'slop/error'
 
 module Slop
-  VERSION = '4.3.0'
+  VERSION = '4.4.0'
 
   # Parse an array of options (defaults to ARGV). Accepts an
   # optional hash of configuration options and block.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2016-03-19 11:25:22.000000000 +0100
+++ new/metadata        2016-08-15 11:18:08.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: slop
 version: !ruby/object:Gem::Version
-  version: 4.3.0
+  version: 4.4.0
 platform: ruby
 authors:
 - Lee Jarvis
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2016-03-19 00:00:00.000000000 Z
+date: 2016-08-15 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rake
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/parser_test.rb new/test/parser_test.rb
--- old/test/parser_test.rb     2016-03-19 11:25:22.000000000 +0100
+++ new/test/parser_test.rb     2016-08-15 11:18:08.000000000 +0200
@@ -22,6 +22,27 @@
     assert_equal 123, @result[:port]
   end
 
+  it "parses arg with leading -" do
+    @options.string "-t", "--text"
+    @result.parser.parse %w(--name=bob --text --sometext)
+    assert_equal "bob", @result[:name]
+    assert_equal "--sometext", @result[:text]
+  end
+
+  it "parses negative integer" do
+    @options.integer "-p", "--port"
+    @result.parser.parse %w(--name=bob --port -123)
+    assert_equal "bob", @result[:name]
+    assert_equal(-123, @result[:port])
+  end
+
+  it "parses negative float" do
+    @options.float "-m", "--multiple"
+    @result.parser.parse %w(--name=bob -m -123.987)
+    assert_equal "bob", @result[:name]
+    assert_equal(-123.987, @result[:multiple])
+  end
+
   describe "parsing grouped short flags" do
     before do
       @options.bool "-q", "--quiet"


Reply via email to