Hello community,

here is the log from the commit of package rubygem-slop for openSUSE:Factory 
checked in at 2015-12-01 09:18:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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        
2015-06-23 11:57:58.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-slop.new/rubygem-slop.changes   
2015-12-01 09:18:50.000000000 +0100
@@ -1,0 +2,21 @@
+Thu Nov 26 05:35:58 UTC 2015 - [email protected]
+
+- updated to version 4.2.1
+ see installed CHANGELOG.md
+
+  v4.2.1 (2015-11-25)
+  -------------------
+  
+  Features:
+    * Better handling of option names with multiple words. #169 (Tim Rogers)
+  
+  Minor enhancements:
+    * add ARGF notes to Arguments (README). #173 (Rick Hull)
+  
+  Bug fixes:
+    * Fix arguments removed with option arguments. #182 (Naoki Mizuno)
+    * Fix bug where true is passed to BoolOption block regardless
+      of --no- prefix. #184 (Ben Brady)
+    * only raise MissingArgument if not `default_value`. #163 (Ben Brady)
+
+-------------------------------------------------------------------

Old:
----
  slop-4.2.0.gem

New:
----
  slop-4.2.1.gem

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

Other differences:
------------------
++++++ rubygem-slop.spec ++++++
--- /var/tmp/diff_new_pack.uac0vT/_old  2015-12-01 09:18:51.000000000 +0100
+++ /var/tmp/diff_new_pack.uac0vT/_new  2015-12-01 09:18:51.000000000 +0100
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-slop
-Version:        4.2.0
+Version:        4.2.1
 Release:        0
 %define mod_name slop
 %define mod_full_name %{mod_name}-%{version}

++++++ slop-4.2.0.gem -> slop-4.2.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml     2015-06-18 16:44:52.000000000 +0200
+++ new/.travis.yml     2015-11-25 08:47:55.000000000 +0100
@@ -1,8 +1,15 @@
+cache: bundler
 rvm:
   - 2.0.0
   - 2.1
   - 2.2
   - rbx-2
+  - jruby-head
+  - ruby-head
+matrix:
+  allow_failures:
+    - rvm: ruby-head
+    - rvm: jruby-head
 notifications:
   email:
     on_success: change
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2015-06-18 16:44:52.000000000 +0200
+++ new/CHANGELOG.md    2015-11-25 08:47:55.000000000 +0100
@@ -1,6 +1,21 @@
 Changelog
 =========
 
+v4.2.1 (2015-11-25)
+-------------------
+
+Features:
+  * Better handling of option names with multiple words. #169 (Tim Rogers)
+
+Minor enhancements:
+  * add ARGF notes to Arguments (README). #173 (Rick Hull)
+
+Bug fixes:
+  * Fix arguments removed with option arguments. #182 (Naoki Mizuno)
+  * Fix bug where true is passed to BoolOption block regardless
+    of --no- prefix. #184 (Ben Brady)
+  * only raise MissingArgument if not `default_value`. #163 (Ben Brady)
+
 v4.2.0 (2015-04-18)
 -------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2015-06-18 16:44:52.000000000 +0200
+++ new/README.md       2015-11-25 08:47:55.000000000 +0100
@@ -101,6 +101,21 @@
 p opts.arguments #=> ["connect", "GET"] # also aliased to `args`
 ```
 
+This is particularly useful when writing scripts with `ARGF`:
+
+```ruby
+opts = Slop.parse do |blah|
+  # ...
+end
+
+# make sure sloptions aren't consumed by ARGF
+ARGV.replace opts.arguments
+
+ARGF.each { |line|
+  # ...
+}
+```
+
 Arrays
 ------
 
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/slop/option.rb new/lib/slop/option.rb
--- old/lib/slop/option.rb      2015-06-18 16:44:52.000000000 +0200
+++ new/lib/slop/option.rb      2015-11-25 08:47:55.000000000 +0100
@@ -47,11 +47,16 @@
     def ensure_call(value)
       @count += 1
 
-      if value.nil? && expects_argument? && !suppress_errors?
-        raise Slop::MissingArgument.new("missing argument for #{flag}", flags)
+      if value.nil? && expects_argument?
+        if default_value
+          @value = default_value
+        elsif !suppress_errors?
+          raise Slop::MissingArgument.new("missing argument for #{flag}", 
flags)
+        end
+      else
+        @value = call(value)
       end
 
-      @value = call(value)
       block.call(@value) if block.respond_to?(:call)
     end
 
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      2015-06-18 16:44:52.000000000 +0200
+++ new/lib/slop/parser.rb      2015-11-25 08:47:55.000000000 +0100
@@ -53,6 +53,7 @@
         end
 
         # support `foo=bar`
+        orig_flag = flag.dup
         if flag.include?("=")
           flag, arg = flag.split("=")
         end
@@ -60,8 +61,15 @@
         if opt = try_process(flag, arg)
           # since the option was parsed, we remove it from our
           # arguments (plus the arg if necessary)
-          arguments.delete(flag)
-          arguments.delete(arg) if opt.expects_argument?
+          # delete argument first while we can find its index.
+          if opt.expects_argument?
+            arguments.each_with_index do |argument, i|
+              if argument == orig_flag && !orig_flag.include?("=")
+                arguments.delete_at(i + 1)
+              end
+            end
+          end
+          arguments.delete(orig_flag)
         end
       end
 
@@ -94,7 +102,7 @@
         process(option, arg)
       elsif flag.start_with?("--no-") && option = 
matching_option(flag.sub("no-", ""))
         process(option, false)
-      elsif flag =~ /\A-[^-]/ && flag.size > 2
+      elsif flag =~ /\A-[^-]{2,}/
         # try and process as a set of grouped short flags. drop(1) removes
         # the prefixed -, then we add them back to each flag separately.
         flags = flag.split("").drop(1).map { |f| "-#{f}" }
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       2015-06-18 16:44:52.000000000 +0200
+++ new/lib/slop/types.rb       2015-11-25 08:47:55.000000000 +0100
@@ -16,7 +16,7 @@
 
     def call(value)
       self.explicit_value = value
-      true
+      !force_false?
     end
 
     def value
@@ -92,5 +92,4 @@
       true
     end
   end
-
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/slop.rb new/lib/slop.rb
--- old/lib/slop.rb     2015-06-18 16:44:52.000000000 +0200
+++ new/lib/slop.rb     2015-11-25 08:47:55.000000000 +0100
@@ -6,7 +6,7 @@
 require 'slop/error'
 
 module Slop
-  VERSION = '4.2.0'
+  VERSION = '4.2.1'
 
   # 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        2015-06-18 16:44:52.000000000 +0200
+++ new/metadata        2015-11-25 08:47:55.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: slop
 version: !ruby/object:Gem::Version
-  version: 4.2.0
+  version: 4.2.1
 platform: ruby
 authors:
 - Lee Jarvis
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-06-18 00:00:00.000000000 Z
+date: 2015-11-25 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     2015-06-18 16:44:52.000000000 +0200
+++ new/test/parser_test.rb     2015-11-25 08:47:55.000000000 +0100
@@ -66,5 +66,15 @@
       @parser.parse %w(-v -- --name lee)
       assert_equal %w(--name lee), @parser.arguments
     end
+
+    it "correctly removes the option argument" do
+      @parser.parse %w(lee --name lee lee)
+      assert_equal %w(lee lee), @parser.arguments
+    end
+
+    it "correctly removes options that use =" do
+      @parser.parse %w(lee --name=lee lee)
+      assert_equal %w(lee lee), @parser.arguments
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/result_test.rb new/test/result_test.rb
--- old/test/result_test.rb     2015-06-18 16:44:52.000000000 +0200
+++ new/test/result_test.rb     2015-11-25 08:47:55.000000000 +0100
@@ -32,6 +32,9 @@
     @options.string("--foo", default: "bar")
     @result.parser.parse %w()
     assert_equal "bar", @result[:foo]
+
+    @result.parser.parse %w(--foo)
+    assert_equal "bar", @result[:foo]
   end
 
   it "handles custom finishing" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/types_test.rb new/test/types_test.rb
--- old/test/types_test.rb      2015-06-18 16:44:52.000000000 +0200
+++ new/test/types_test.rb      2015-11-25 08:47:55.000000000 +0100
@@ -6,7 +6,9 @@
     @verbose  = @options.bool "--verbose"
     @quiet    = @options.bool "--quiet"
     @inversed = @options.bool "--inversed", default: true
-    @result   = @options.parse %w(--verbose --no-inversed)
+    @bloc     = @options.bool("--bloc"){|val| (@bloc_val ||= []) << val}
+    @result   = @options.parse %w(--verbose --no-inversed
+                                  --bloc --no-bloc)
   end
 
   it "returns true if used" do
@@ -20,6 +22,10 @@
   it "can be inversed via --no- prefix" do
     assert_equal false, @result[:inversed]
   end
+
+  it "will invert the value passed to &block via --no- prefix" do
+    assert_equal [true, false], @bloc_val
+  end
 end
 
 describe Slop::IntegerOption do


Reply via email to