Hello community,

here is the log from the commit of package rubygem-childprocess for 
openSUSE:Factory checked in at 2017-06-08 15:01:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-childprocess (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-childprocess.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-childprocess"

Thu Jun  8 15:01:51 2017 rev:21 rq:497720 version:0.7.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/rubygem-childprocess/rubygem-childprocess.changes    
    2017-04-11 09:33:25.148620973 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-childprocess.new/rubygem-childprocess.changes
   2017-06-08 15:01:51.764679824 +0200
@@ -1,0 +2,10 @@
+Tue May 23 09:45:59 UTC 2017 - [email protected]
+
+- updated to version 0.7.0
+ see installed CHANGELOG.md
+
+  ### Version 0.7.0 / 2017-05-07
+  
+  * Debugging information now uses a Logger, which can be configured.
+
+-------------------------------------------------------------------

Old:
----
  childprocess-0.6.3.gem

New:
----
  childprocess-0.7.0.gem

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

Other differences:
------------------
++++++ rubygem-childprocess.spec ++++++
--- /var/tmp/diff_new_pack.BcRKTG/_old  2017-06-08 15:01:52.352596851 +0200
+++ /var/tmp/diff_new_pack.BcRKTG/_new  2017-06-08 15:01:52.352596851 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-childprocess
-Version:        0.6.3
+Version:        0.7.0
 Release:        0
 %define mod_name childprocess
 %define mod_full_name %{mod_name}-%{version}

++++++ childprocess-0.6.3.gem -> childprocess-0.7.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2017-03-25 04:06:44.000000000 +0100
+++ new/CHANGELOG.md    2017-05-08 02:43:19.000000000 +0200
@@ -1,3 +1,8 @@
+### Version 0.7.0 / 2017-05-07
+
+* Debugging information now uses a Logger, which can be configured.
+
+
 ### Version 0.6.3 / 2017-03-24
 
 See beta release notes.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2017-03-25 04:06:44.000000000 +0100
+++ new/README.md       2017-05-08 02:43:19.000000000 +0200
@@ -154,6 +154,16 @@
 ChildProcess.build("ruby", "-S", "bundle")
 ```
 
+#### Log to file
+
+Errors and debugging information are logged to `$stderr` by default but a 
custom logger can be used instead. 
+
+```ruby
+logger = Logger.new('logfile.log')
+logger.level = Logger::DEBUG
+ChildProcess.logger = logger
+```
+
 ## Caveats
 
 * With JRuby on Unix, modifying `ENV["PATH"]` before using childprocess could 
lead to 'Command not found' errors, since JRuby is unable to modify the 
environemnt used for PATH searches in `java.lang.ProcessBuilder`. This can be 
avoided by setting `ChildProcess.posix_spawn = true`.
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/childprocess/abstract_process.rb 
new/lib/childprocess/abstract_process.rb
--- old/lib/childprocess/abstract_process.rb    2017-03-25 04:06:44.000000000 
+0100
+++ new/lib/childprocess/abstract_process.rb    2017-05-08 02:43:19.000000000 
+0200
@@ -176,7 +176,7 @@
     end
 
     def log(*args)
-      $stderr.puts "#{self.inspect} : #{args.inspect}" if $DEBUG
+      ChildProcess.logger.debug "#{self.inspect} : #{args.inspect}"
     end
 
     def assert_started
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/childprocess/jruby/pump.rb 
new/lib/childprocess/jruby/pump.rb
--- old/lib/childprocess/jruby/pump.rb  2017-03-25 04:06:44.000000000 +0100
+++ new/lib/childprocess/jruby/pump.rb  2017-05-08 02:43:19.000000000 +0200
@@ -44,7 +44,8 @@
 
         @output.flush
       rescue java.io.IOException => ex
-        $stderr.puts ex.message, ex.backtrace if $DEBUG
+        ChildProcess.logger.debug ex.message
+        ChildProcess.logger.debug ex.backtrace
       end
 
     end # Pump
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/childprocess/version.rb 
new/lib/childprocess/version.rb
--- old/lib/childprocess/version.rb     2017-03-25 04:06:44.000000000 +0100
+++ new/lib/childprocess/version.rb     2017-05-08 02:43:19.000000000 +0200
@@ -1,3 +1,3 @@
 module ChildProcess
-  VERSION = '0.6.3'
+  VERSION = '0.7.0'
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/childprocess.rb new/lib/childprocess.rb
--- old/lib/childprocess.rb     2017-03-25 04:06:44.000000000 +0100
+++ new/lib/childprocess.rb     2017-05-08 02:43:19.000000000 +0200
@@ -3,12 +3,15 @@
 require 'childprocess/abstract_process'
 require 'childprocess/abstract_io'
 require "fcntl"
+require 'logger'
 
 module ChildProcess
 
   @posix_spawn = false
 
   class << self
+    attr_writer :logger
+
     def new(*args)
       case os
       when :macosx, :linux, :solaris, :bsd, :cygwin, :aix
@@ -27,6 +30,15 @@
     end
     alias_method :build, :new
 
+    def logger
+      return @logger if @logger
+
+      @logger = Logger.new($stderr)
+      @logger.level = $DEBUG ? Logger::DEBUG : Logger::INFO
+
+      @logger
+    end
+
     def platform
       if RUBY_PLATFORM == "java"
         :jruby
@@ -164,7 +176,7 @@
 
       unless @warnings[msg]
         @warnings[msg] = true
-        $stderr.puts msg
+        logger.warn msg
       end
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2017-03-25 04:06:44.000000000 +0100
+++ new/metadata        2017-05-08 02:43:19.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: childprocess
 version: !ruby/object:Gem::Version
-  version: 0.6.3
+  version: 0.7.0
 platform: ruby
 authors:
 - Jari Bakken
@@ -9,7 +9,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2017-03-25 00:00:00.000000000 Z
+date: 2017-05-08 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: ffi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/childprocess_spec.rb 
new/spec/childprocess_spec.rb
--- old/spec/childprocess_spec.rb       2017-03-25 04:06:44.000000000 +0100
+++ new/spec/childprocess_spec.rb       2017-05-08 02:43:19.000000000 +0200
@@ -288,4 +288,80 @@
 
     expect(proc).to be_exited
   end
+
+
+  it 'has a logger' do
+    expect(ChildProcess).to respond_to(:logger)
+  end
+
+  it 'can change its logger' do
+    expect(ChildProcess).to respond_to(:logger=)
+
+    original_logger = ChildProcess.logger
+    begin
+      ChildProcess.logger = :some_other_logger
+      expect(ChildProcess.logger).to eq(:some_other_logger)
+    ensure
+      ChildProcess.logger = original_logger
+    end
+  end
+
+
+  describe 'logger' do
+
+    before(:each) do
+      ChildProcess.logger = logger
+    end
+
+    after(:all) do
+      ChildProcess.logger = nil
+    end
+
+
+    context 'with the default logger' do
+
+      let(:logger) { nil }
+
+
+      it 'logs at INFO level by default' do
+        expect(ChildProcess.logger.level).to eq(Logger::INFO)
+      end
+
+      it 'logs at DEBUG level by default if $DEBUG is on' do
+        original_debug = $DEBUG
+
+        begin
+          $DEBUG = true
+
+          expect(ChildProcess.logger.level).to eq(Logger::DEBUG)
+        ensure
+          $DEBUG = original_debug
+        end
+      end
+
+      it "logs to stderr by default" do
+        cap = capture_std { generate_log_messages }
+
+        expect(cap.stdout).to be_empty
+        expect(cap.stderr).to_not be_empty
+      end
+
+    end
+
+    context 'with a custom logger' do
+
+      let(:logger) { Logger.new($stdout) }
+
+
+      it "logs to configured logger" do
+        cap = capture_std { generate_log_messages }
+
+        expect(cap.stdout).to_not be_empty
+        expect(cap.stderr).to be_empty
+      end
+
+    end
+
+  end
+
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb
--- old/spec/spec_helper.rb     2017-03-25 04:06:44.000000000 +0100
+++ new/spec/spec_helper.rb     2017-05-08 02:43:19.000000000 +0200
@@ -233,6 +233,14 @@
     STDERR.reopen orig_err
   end
 
+  def generate_log_messages
+    ChildProcess.logger.level = Logger::DEBUG
+
+    process = exit_with(0).start
+    process.wait
+    process.poll_for_exit(0.1)
+  end
+
 end # ChildProcessSpecHelper
 
 Thread.abort_on_exception = true


Reply via email to