Hello community,

here is the log from the commit of package rubygem-slop for openSUSE:Factory 
checked in at 2015-06-23 11:57:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-04-25 11:25:44.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-slop.new/rubygem-slop.changes   
2015-06-23 11:57:58.000000000 +0200
@@ -1,0 +2,15 @@
+Fri Jun 19 04:34:15 UTC 2015 - [email protected]
+
+- updated to version 4.2.0
+ see installed CHANGELOG.md
+
+  v4.2.0 (2015-04-18)
+  -------------------
+  
+  Features:
+    * Support for Regexp option type #167 (Laurent Arnoud)
+    * Support prefixed `--no-` for explicitly setting boolean options
+      to `false` #168
+    * Better handling of flags with multiple words #169 (Tim Rogers)
+
+-------------------------------------------------------------------

Old:
----
  slop-4.1.0.gem

New:
----
  slop-4.2.0.gem

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

Other differences:
------------------
++++++ rubygem-slop.spec ++++++
--- /var/tmp/diff_new_pack.yEhLPH/_old  2015-06-23 11:58:01.000000000 +0200
+++ /var/tmp/diff_new_pack.yEhLPH/_new  2015-06-23 11:58:01.000000000 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-slop
-Version:        4.1.0
+Version:        4.2.0
 Release:        0
 %define mod_name slop
 %define mod_full_name %{mod_name}-%{version}

++++++ slop-4.1.0.gem -> slop-4.2.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2015-04-18 12:21:36.000000000 +0200
+++ new/CHANGELOG.md    2015-06-18 16:44:52.000000000 +0200
@@ -1,6 +1,15 @@
 Changelog
 =========
 
+v4.2.0 (2015-04-18)
+-------------------
+
+Features:
+  * Support for Regexp option type #167 (Laurent Arnoud)
+  * Support prefixed `--no-` for explicitly setting boolean options
+    to `false` #168
+  * Better handling of flags with multiple words #169 (Tim Rogers)
+
 v4.1.0 (2015-04-18)
 -------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2015-04-18 12:21:36.000000000 +0200
+++ new/README.md       2015-06-18 16:44:52.000000000 +0200
@@ -6,7 +6,7 @@
 Version 4 of Slop is aimed at Ruby 2.0 or later. Please use
 [Version 3](https://github.com/leejarvis/slop/tree/v3) for Ruby 1.9 support.
 
-[![Build 
Status](https://travis-ci.org/leejarvis/slop.png?branch=master)](http://travis-ci.org/leejarvis/slop)
+[![Build 
Status](https://travis-ci.org/leejarvis/slop.svg?branch=master)](http://travis-ci.org/leejarvis/slop)
 
 Installation
 ------------
@@ -22,19 +22,21 @@
   o.integer '--port', 'custom port', default: 80
   o.bool '-v', '--verbose', 'enable verbose mode'
   o.bool '-q', '--quiet', 'suppress output (quiet mode)'
+  o.bool '-c', '--check-ssl-certificate', 'check SSL certificate for host'
   o.on '--version', 'print the version' do
     puts Slop::VERSION
     exit
   end
 end
 
-ARGV #=> -v --host 192.168.0.1
+ARGV #=> -v --host 192.168.0.1 --check-ssl-certificate
 
-opts[:host]   #=> 192.168.0.1
-opts.verbose? #=> true
-opts.quiet?   #=> false
+opts[:host]                 #=> 192.168.0.1
+opts.verbose?               #=> true
+opts.quiet?                 #=> false
+opts.check_ssl_certificate? #=> true
 
-opts.to_hash  #=> { host: "192.168.0.1", port: 80, verbose: true, quiet: false 
}
+opts.to_hash  #=> { host: "192.168.0.1", port: 80, verbose: true, quiet: 
false, check_ssl_certificate: true }
 ```
 
 Option types
@@ -48,6 +50,7 @@
 o.integer #=> Slop::IntegerOption, expects an argument, aliased to IntOption
 o.float   #=> Slop::FloatOption, expects an argument
 o.array   #=> Slop::ArrayOption, expects an argument
+o.regexp  #=> Slop::RegexpOption, expects an argument
 o.null    #=> Slop::NullOption, no argument and ignored from `to_hash`
 o.on      #=> alias for o.null
 ```
@@ -71,10 +74,10 @@
 opts.separator ""
 opts.separator "Extra options:"
 opts.array "--files", "a list of files to import"
-opts.bool "-v", "--verbose", "enable verbose mode"
+opts.bool "-v", "--verbose", "enable verbose mode", default: true
 
 parser = Slop::Parser.new(opts)
-result = parser.parse(["--hostname", "192.168.0.1"])
+result = parser.parse(["--hostname", "192.168.0.1", "--no-verbose"])
 
 result.to_hash #=> { hostname: "192.168.0.1", port: 80,
                  #     files: [], verbose: false }
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-04-18 12:21:36.000000000 +0200
+++ new/lib/slop/option.rb      2015-06-18 16:44:52.000000000 +0200
@@ -102,7 +102,7 @@
 
     # Returns the last key as a symbol. Used in Options.to_hash.
     def key
-      (config[:key] || flags.last.sub(/\A--?/, '')).to_sym
+      (config[:key] || flags.last.sub(/\A--?/, '')).tr("-", "_").to_sym
     end
 
     # Returns true if this option should be displayed in help text.
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-04-18 12:21:36.000000000 +0200
+++ new/lib/slop/parser.rb      2015-06-18 16:44:52.000000000 +0200
@@ -92,6 +92,8 @@
     def try_process(flag, arg)
       if option = matching_option(flag)
         process(option, arg)
+      elsif flag.start_with?("--no-") && option = 
matching_option(flag.sub("no-", ""))
+        process(option, false)
       elsif flag =~ /\A-[^-]/ && flag.size > 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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/slop/result.rb new/lib/slop/result.rb
--- old/lib/slop/result.rb      2015-04-18 12:21:36.000000000 +0200
+++ new/lib/slop/result.rb      2015-06-18 16:44:52.000000000 +0200
@@ -33,7 +33,7 @@
 
     # Returns an Option if it exists. Ignores any prefixed hyphens.
     def option(flag)
-      cleaned = -> (f) { f.to_s.sub(/\A--?/, '') }
+      cleaned = -> (f) { f.to_s.sub(/\A--?/, '').tr('_', '-') }
       options.find do |o|
         o.flags.any? { |f| cleaned.(f) == cleaned.(flag) }
       end
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-04-18 12:21:36.000000000 +0200
+++ new/lib/slop/types.rb       2015-06-18 16:44:52.000000000 +0200
@@ -8,12 +8,29 @@
 
   # Cast the option argument to true or false.
   # Override default_value to default to false instead of nil.
-  # This option type does not expect an argument.
+  # This option type does not expect an argument. However, the API
+  # supports value being passed. This is to ensure it can capture
+  # an explicit false value
   class BoolOption < Option
-    def call(_value)
+    attr_accessor :explicit_value
+
+    def call(value)
+      self.explicit_value = value
       true
     end
 
+    def value
+      if force_false?
+        false
+      else
+        super
+      end
+    end
+
+    def force_false?
+      explicit_value == false
+    end
+
     def default_value
       config[:default] || false
     end
@@ -61,6 +78,13 @@
     end
   end
 
+  # Cast the option argument to a Regexp.
+  class RegexpOption < Option
+    def call(value)
+      Regexp.new(value)
+    end
+  end
+
   # An option that discards the return value, inherits from Bool
   # since it does not expect an argument.
   class NullOption < BoolOption
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/slop.rb new/lib/slop.rb
--- old/lib/slop.rb     2015-04-18 12:21:36.000000000 +0200
+++ new/lib/slop.rb     2015-06-18 16:44:52.000000000 +0200
@@ -6,7 +6,7 @@
 require 'slop/error'
 
 module Slop
-  VERSION = '4.1.0'
+  VERSION = '4.2.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        2015-04-18 12:21:36.000000000 +0200
+++ new/metadata        2015-06-18 16:44:52.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: slop
 version: !ruby/object:Gem::Version
-  version: 4.1.0
+  version: 4.2.0
 platform: ruby
 authors:
 - Lee Jarvis
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-04-18 00:00:00.000000000 Z
+date: 2015-06-18 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rake
@@ -98,3 +98,4 @@
 - test/result_test.rb
 - test/test_helper.rb
 - test/types_test.rb
+has_rdoc: 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/option_test.rb new/test/option_test.rb
--- old/test/option_test.rb     2015-04-18 12:21:36.000000000 +0200
+++ new/test/option_test.rb     2015-06-18 16:44:52.000000000 +0200
@@ -17,6 +17,10 @@
       assert_equal :foo, option(%w(-f --foo), nil).key
     end
 
+    it "converts dashes to underscores to make multi-word options 
symbol-friendly" do
+      assert_equal :foo_bar, option(%w(-f --foo-bar), nil).key
+    end
+
     it "can be overridden" do
       assert_equal :bar, option(%w(-f --foo), nil, key: "bar").key
     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-04-18 12:21:36.000000000 +0200
+++ new/test/result_test.rb     2015-06-18 16:44:52.000000000 +0200
@@ -12,16 +12,18 @@
 
 describe Slop::Result do
   before do
-    @options = Slop::Options.new
-    @verbose = @options.bool "-v", "--verbose"
-    @name    = @options.string "--name"
-    @unused  = @options.string "--unused"
-    @result  = @options.parse %w(foo -v --name lee argument)
+    @options     = Slop::Options.new
+    @verbose     = @options.bool "-v", "--verbose"
+    @name        = @options.string "--name"
+    @unused      = @options.string "--unused"
+    @long_option = @options.string "--long-option"
+    @result      = @options.parse %w(foo -v --name lee --long-option bar 
argument)
   end
 
   it "increments option count" do
     # test this here so it's more "full stack"
     assert_equal 1, @verbose.count
+    assert_equal 1, @long_option.count
     @result.parser.parse %w(-v --verbose)
     assert_equal 2, @verbose.count
   end
@@ -51,6 +53,9 @@
       assert_equal "lee", @result["name"]
       assert_equal "lee", @result[:name]
       assert_equal "lee", @result["--name"]
+      assert_equal "bar", @result["long_option"]
+      assert_equal "bar", @result[:long_option]
+      assert_equal "bar", @result["--long-option"]
     end
   end
 
@@ -72,6 +77,7 @@
     it "checks if options have been used" do
       assert_equal true, @result.verbose?
       assert_equal false, @result.unused?
+      assert_equal true, @result.long_option?
     end
   end
 
@@ -79,6 +85,7 @@
     it "returns an option by flag" do
       assert_equal @verbose, @result.option("--verbose")
       assert_equal @verbose, @result.option("-v")
+      assert_equal @long_option, @result.option("--long-option")
     end
 
     it "ignores prefixed hyphens" do
@@ -93,7 +100,8 @@
 
   describe "#to_hash" do
     it "returns option keys and values" do
-      assert_equal({ verbose: true, name: "lee", unused: nil }, 
@result.to_hash)
+      assert_equal({ verbose: true, name: "lee", unused: nil, long_option: 
"bar" },
+                   @result.to_hash)
     end
   end
 end
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-04-18 12:21:36.000000000 +0200
+++ new/test/types_test.rb      2015-06-18 16:44:52.000000000 +0200
@@ -2,10 +2,11 @@
 
 describe Slop::BoolOption do
   before do
-    @options = Slop::Options.new
-    @age     = @options.bool "--verbose"
-    @age     = @options.bool "--quiet"
-    @result  = @options.parse %w(--verbose)
+    @options  = Slop::Options.new
+    @verbose  = @options.bool "--verbose"
+    @quiet    = @options.bool "--quiet"
+    @inversed = @options.bool "--inversed", default: true
+    @result   = @options.parse %w(--verbose --no-inversed)
   end
 
   it "returns true if used" do
@@ -15,6 +16,10 @@
   it "returns false if not used" do
     assert_equal false, @result[:quiet]
   end
+
+  it "can be inversed via --no- prefix" do
+    assert_equal false, @result[:inversed]
+  end
 end
 
 describe Slop::IntegerOption do
@@ -100,3 +105,16 @@
     assert_equal({}, @result.to_hash)
   end
 end
+
+describe Slop::RegexpOption do
+  before do
+    @options       = Slop::Options.new
+    @exclude       = @options.regexp "--exclude"
+    @exclude_value = "redirect|news"
+    @result        = @options.parse %W(--exclude #{@exclude_value})
+  end
+
+  it "returns the value as a Regexp" do
+    assert_equal Regexp.new(@exclude_value), @result[:exclude]
+  end
+end


Reply via email to