Hello community,

here is the log from the commit of package rubygem-cri for openSUSE:Factory 
checked in at 2017-12-22 12:18:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-cri (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-cri.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-cri"

Fri Dec 22 12:18:32 2017 rev:6 rq:554638 version:2.10.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-cri/rubygem-cri.changes  2017-06-15 
11:25:34.904863388 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-cri.new/rubygem-cri.changes     
2017-12-22 12:18:33.554957449 +0100
@@ -1,0 +2,20 @@
+Sun Dec  3 19:13:50 UTC 2017 - [email protected]
+
+- updated to version 2.10.1
+ see installed NEWS.md
+
+  ## 2.10.1
+  
+  Fixes:
+  
+  * Restored Ruby 2.1 compatibility (for now)
+  
+  ## 2.10.0
+  
+  Features:
+  
+  * Added support for skipping option parsing (#62) [Tim Sharpe]
+  
+  This release drops support for Ruby 2.1, which is no longer supported.
+
+-------------------------------------------------------------------

Old:
----
  cri-2.9.1.gem

New:
----
  cri-2.10.1.gem

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

Other differences:
------------------
++++++ rubygem-cri.spec ++++++
--- /var/tmp/diff_new_pack.NJITte/_old  2017-12-22 12:18:34.118929951 +0100
+++ /var/tmp/diff_new_pack.NJITte/_new  2017-12-22 12:18:34.118929951 +0100
@@ -24,17 +24,18 @@
 #
 
 Name:           rubygem-cri
-Version:        2.9.1
+Version:        2.10.1
 Release:        0
 %define mod_name cri
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildRequires:  %{ruby < 3}
+BuildRequires:  %{ruby => 2.1}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  %{rubygem rdoc > 3.10}
-BuildRequires:  %{ruby}
 BuildRequires:  ruby-macros >= 5
 Url:            http://stoneship.org/software/cri/
-Source:         http://rubygems.org/gems/%{mod_full_name}.gem
+Source:         https://rubygems.org/gems/%{mod_full_name}.gem
 Source1:        gem2rpm.yml
 Summary:        a library for building easy-to-use command-line tools
 License:        MIT

++++++ cri-2.9.1.gem -> cri-2.10.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CODE_OF_CONDUCT.md new/CODE_OF_CONDUCT.md
--- old/CODE_OF_CONDUCT.md      1970-01-01 01:00:00.000000000 +0100
+++ new/CODE_OF_CONDUCT.md      2017-10-28 08:56:08.000000000 +0200
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as 
contributors and maintainers pledge to making participation in our project and 
our community a harassment-free experience for everyone, regardless of age, 
body size, disability, ethnicity, gender identity and expression, level of 
experience, nationality, personal appearance, race, religion, or sexual 
identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment 
include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or 
advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic 
address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a 
professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable 
behavior and are expected to take appropriate and fair corrective action in 
response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or 
reject comments, commits, code, wiki edits, issues, and other contributions 
that are not aligned to this Code of Conduct, or to ban temporarily or 
permanently any contributor for other behaviors that they deem inappropriate, 
threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces 
when an individual is representing the project or its community. Examples of 
representing a project or community include using an official project e-mail 
address, posting via an official social media account, or acting as an 
appointed representative at an online or offline event. Representation of a 
project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be 
reported by contacting the project team at [email protected]. The 
project team will review and investigate all complaints, and will respond in a 
way that it deems appropriate to the circumstances. The project team is 
obligated to maintain confidentiality with regard to the reporter of an 
incident. Further details of specific enforcement policies may be posted 
separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good 
faith may face temporary or permanent repercussions as determined by other 
members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], 
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Gemfile.lock new/Gemfile.lock
--- old/Gemfile.lock    2017-06-03 12:45:27.000000000 +0200
+++ new/Gemfile.lock    2017-10-28 08:56:08.000000000 +0200
@@ -1,13 +1,13 @@
 PATH
   remote: .
   specs:
-    cri (2.9.1)
+    cri (2.10.1)
       colored (~> 1.2)
 
 GEM
   remote: https://rubygems.org/
   specs:
-    asciidoctor (1.5.5)
+    asciidoctor (1.5.6.1)
     ast (2.3.0)
     colored (1.2)
     coveralls (0.8.21)
@@ -18,32 +18,32 @@
       tins (~> 1.6)
     docile (1.1.5)
     json (2.1.0)
-    minitest (5.10.2)
-    parallel (1.11.2)
+    minitest (5.10.3)
+    parallel (1.12.0)
     parser (2.4.0.0)
       ast (~> 2.2)
     powerpack (0.1.1)
     rainbow (2.2.2)
       rake
-    rake (12.0.0)
-    rubocop (0.49.1)
+    rake (12.2.1)
+    rubocop (0.51.0)
       parallel (~> 1.10)
       parser (>= 2.3.3.1, < 3.0)
       powerpack (~> 0.1)
-      rainbow (>= 1.99.1, < 3.0)
+      rainbow (>= 2.2.2, < 3.0)
       ruby-progressbar (~> 1.7)
       unicode-display_width (~> 1.0, >= 1.0.1)
-    ruby-progressbar (1.8.1)
+    ruby-progressbar (1.9.0)
     simplecov (0.14.1)
       docile (~> 1.1.0)
       json (>= 1.8, < 3)
       simplecov-html (~> 0.10.0)
-    simplecov-html (0.10.1)
+    simplecov-html (0.10.2)
     term-ansicolor (1.6.0)
       tins (~> 1.0)
     thor (0.19.4)
-    tins (1.14.0)
-    unicode-display_width (1.2.1)
+    tins (1.15.0)
+    unicode-display_width (1.3.0)
     yard (0.9.9)
 
 PLATFORMS
@@ -60,4 +60,4 @@
   yard
 
 BUNDLED WITH
-   1.15.1
+   1.15.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/NEWS.md new/NEWS.md
--- old/NEWS.md 2017-06-03 12:45:27.000000000 +0200
+++ new/NEWS.md 2017-10-28 08:56:08.000000000 +0200
@@ -1,6 +1,20 @@
 Cri News
 ========
 
+## 2.10.1
+
+Fixes:
+
+* Restored Ruby 2.1 compatibility (for now)
+
+## 2.10.0
+
+Features:
+
+* Added support for skipping option parsing (#62) [Tim Sharpe]
+
+This release drops support for Ruby 2.1, which is no longer supported.
+
 ## 2.9.1
 
 Fixes:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.adoc new/README.adoc
--- old/README.adoc     2017-06-03 12:45:27.000000000 +0200
+++ new/README.adoc     2017-10-28 08:56:08.000000000 +0200
@@ -174,6 +174,33 @@
 flag :v, :verbose, 'be verbose (use up to three times)', multiple: true
 
--------------------------------------------------------------------------------
 
+==== Skipping option parsing ====
+
+If you want to skip option parsing for your command or subcommand, you can add
+the `skip_option_parsing` method to your command definition and everything on 
your
+command line after the command name will be passed to your command as 
arguments.
+
+[source,ruby]
+-------------------------------------------------------------------------------
+command = Cri::Command.define do
+  name        'dostuff'
+  usage       'dostuff [args]'
+  aliases     :ds, :stuff
+  summary     'does stuff'
+  description 'This command does a lot of stuff, but not option parsing.'
+
+  skip_option_parsing
+
+  run do |opts, args, cmd|
+    puts args.inspect
+  end
+end
+-------------------------------------------------------------------------------
+
+When executing this command with `dostuff --some=value -f yes`, the `opts` hash
+that is passed to your `run` block will be empty and the `args` array will be
+`["--some=value", "-f", "yes"]`.
+
 === The run block ===
 
 The last part of the command defines the execution itself:
@@ -226,8 +253,10 @@
 
 == Contributors ==
 
-* Toon Willems
+* Bart Mesuere
 * Ken Coar
+* Tim Sharpe
+* Toon Willems
 
 Thanks for Lee “injekt” Jarvis for link:https://github.com/injekt/slop[Slop],
 which has inspired the design of Cri 2.0.
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cri.gemspec new/cri.gemspec
--- old/cri.gemspec     2017-06-03 12:45:27.000000000 +0200
+++ new/cri.gemspec     2017-10-28 08:56:08.000000000 +0200
@@ -1,5 +1,3 @@
-# encoding: utf-8
-
 $LOAD_PATH.unshift(File.expand_path('../lib/', __FILE__))
 require 'cri/version'
 
@@ -17,6 +15,8 @@
   s.files = Dir['[A-Z]*'] + Dir['{lib,test}/**/*'] + ['cri.gemspec']
   s.require_paths = ['lib']
 
+  s.required_ruby_version = '~> 2.1'
+
   s.add_dependency('colored', '~> 1.2')
 
   s.add_development_dependency('bundler', '~> 1.6')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cri/command.rb new/lib/cri/command.rb
--- old/lib/cri/command.rb      2017-06-03 12:45:27.000000000 +0200
+++ new/lib/cri/command.rb      2017-10-28 08:56:08.000000000 +0200
@@ -92,6 +92,11 @@
     #   command (ignored for commands with subcommands)
     attr_accessor :block
 
+    # @return [Boolean] true if the command should skip option parsing and
+    # treat all options as arguments.
+    attr_accessor :all_opts_as_args
+    alias all_opts_as_args? all_opts_as_args
+
     # Creates a new command using the DSL. If a string is given, the command
     # will be defined using the string; if a block is given, the block will be
     # used instead.
@@ -233,11 +238,11 @@
       commands = commands_named(name)
 
       if commands.empty?
-        $stderr.puts "#{self.name}: unknown command '#{name}'\n"
+        warn "#{self.name}: unknown command '#{name}'\n"
         raise CriExitException.new(is_error: true)
       elsif commands.size > 1
-        $stderr.puts "#{self.name}: '#{name}' is ambiguous:"
-        $stderr.puts "  #{commands.map(&:name).sort.join(' ')}"
+        warn "#{self.name}: '#{name}' is ambiguous:"
+        warn "  #{commands.map(&:name).sort.join(' ')}"
         raise CriExitException.new(is_error: true)
       else
         commands[0]
@@ -271,7 +276,7 @@
           if default_subcommand_name
             subcmd_name = default_subcommand_name
           else
-            $stderr.puts "#{name}: no command given"
+            warn "#{name}: no command given"
             raise CriExitException.new(is_error: true)
           end
         end
@@ -299,17 +304,22 @@
     #
     # @return [void]
     def run_this(opts_and_args, parent_opts = {})
-      # Parse
-      parser = Cri::OptionParser.new(
-        opts_and_args, global_option_definitions
-      )
-      handle_parser_errors_while { parser.run }
-      local_opts  = parser.options
-      global_opts = parent_opts.merge(parser.options)
-      args = parser.arguments
+      if all_opts_as_args?
+        args = opts_and_args
+        global_opts = parent_opts
+      else
+        # Parse
+        parser = Cri::OptionParser.new(
+          opts_and_args, global_option_definitions
+        )
+        handle_parser_errors_while { parser.run }
+        local_opts  = parser.options
+        global_opts = parent_opts.merge(parser.options)
+        args = parser.arguments
 
-      # Handle options
-      handle_options(local_opts)
+        # Handle options
+        handle_options(local_opts)
+      end
 
       # Execute
       if block.nil?
@@ -352,6 +362,8 @@
     end
 
     def partition(opts_and_args)
+      return [{}, opts_and_args.first, opts_and_args] if all_opts_as_args?
+
       # Parse
       delegate = Cri::Command::OptionParserPartitioningDelegate.new
       parser = Cri::OptionParser.new(opts_and_args, global_option_definitions)
@@ -369,10 +381,10 @@
     def handle_parser_errors_while
       yield
     rescue Cri::OptionParser::IllegalOptionError => e
-      $stderr.puts "#{name}: illegal option -- #{e}"
+      warn "#{name}: illegal option -- #{e}"
       raise CriExitException.new(is_error: true)
     rescue Cri::OptionParser::OptionRequiresAnArgumentError => e
-      $stderr.puts "#{name}: option requires an argument -- #{e}"
+      warn "#{name}: option requires an argument -- #{e}"
       raise CriExitException.new(is_error: true)
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cri/command_dsl.rb new/lib/cri/command_dsl.rb
--- old/lib/cri/command_dsl.rb  2017-06-03 12:45:27.000000000 +0200
+++ new/lib/cri/command_dsl.rb  2017-10-28 08:56:08.000000000 +0200
@@ -98,6 +98,14 @@
       @command.hidden = true
     end
 
+    # Skips option parsing for the command. Allows option-like arguments to be
+    # passed in, avoiding the {Cri::OptionParser} validation.
+    #
+    # @return [void]
+    def skip_option_parsing
+      @command.all_opts_as_args = true
+    end
+
     # Adds a new option to the command. If a block is given, it will be
     # executed when the option is successfully parsed.
     #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cri/version.rb new/lib/cri/version.rb
--- old/lib/cri/version.rb      2017-06-03 12:45:27.000000000 +0200
+++ new/lib/cri/version.rb      2017-10-28 08:56:08.000000000 +0200
@@ -1,4 +1,4 @@
 module Cri
   # The current Cri version.
-  VERSION = '2.9.1'.freeze
+  VERSION = '2.10.1'.freeze
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2017-06-03 12:45:27.000000000 +0200
+++ new/metadata        2017-10-28 08:56:08.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: cri
 version: !ruby/object:Gem::Version
-  version: 2.9.1
+  version: 2.10.1
 platform: ruby
 authors:
 - Denis Defreyne
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2017-06-03 00:00:00.000000000 Z
+date: 2017-10-28 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: colored
@@ -48,6 +48,7 @@
 - README.adoc
 - NEWS.md
 files:
+- CODE_OF_CONDUCT.md
 - Gemfile
 - Gemfile.lock
 - LICENSE
@@ -92,9 +93,9 @@
 - lib
 required_ruby_version: !ruby/object:Gem::Requirement
   requirements:
-  - - ">="
+  - - "~>"
     - !ruby/object:Gem::Version
-      version: '0'
+      version: '2.1'
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="
@@ -102,7 +103,7 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.6.12
+rubygems_version: 2.6.14
 signing_key: 
 specification_version: 4
 summary: a library for building easy-to-use command-line tools
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/test_command.rb new/test/test_command.rb
--- old/test/test_command.rb    2017-06-03 12:45:27.000000000 +0200
+++ new/test/test_command.rb    2017-10-28 08:56:08.000000000 +0200
@@ -632,5 +632,46 @@
       end
       assert_equal "I am the subcommand!\n", out
     end
+
+    def test_skip_option_parsing
+      command = Cri::Command.define do
+        name 'super'
+        skip_option_parsing
+
+        run do |_opts, args, _c|
+          puts "args=#{args.join(',')}"
+        end
+      end
+
+      out, _err = capture_io_while do
+        command.run(['--test', '-a', 'arg'])
+      end
+
+      assert_equal "args=--test,-a,arg\n", out
+    end
+
+    def test_subcommand_skip_option_parsing
+      super_cmd = Cri::Command.define do
+        name 'super'
+
+        option :a, :aaa, 'opt a', argument: :optional
+      end
+
+      super_cmd.define_command do
+        name 'sub'
+
+        skip_option_parsing
+
+        run do |opts, args, _c|
+          puts "opts=#{opts.inspect} args=#{args.join(',')}"
+        end
+      end
+
+      out, _err = capture_io_while do
+        super_cmd.run(['--aaa', 'test', 'sub', '--test', 'value'])
+      end
+
+      assert_equal "opts={:aaa=>\"test\"} args=--test,value\n", out
+    end
   end
 end


Reply via email to