Hello community,

here is the log from the commit of package rubygem-timers for openSUSE:Factory 
checked in at 2015-12-01 09:18:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-timers (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-timers.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-timers"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-timers/rubygem-timers.changes    
2014-11-10 22:15:29.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-timers.new/rubygem-timers.changes       
2015-12-01 09:18:56.000000000 +0100
@@ -1,0 +2,15 @@
+Tue Nov 24 08:38:58 UTC 2015 - co...@suse.com
+
+- updated to version 4.1.1
+ see installed CHANGES.md
+
+  4.1.1 (2015-08-21)
+  ------------------
+  * Remove `RubyProf` from Gemfile and a test, due to it providing no 
substantial benefit while increasing problems building bundles under Rubinius.
+  
+  4.1.0 (2015-08-16)
+  ------------------
+  * Addition of `now_and_every` method; fires block immediately, then sets 
recurring timer.
+  * Includes `now_and_after` method; does the same as above for one-shot 
timers: essentially a "two-shot" timer.
+
+-------------------------------------------------------------------

Old:
----
  timers-4.0.1.gem

New:
----
  gem2rpm.yml
  timers-4.1.1.gem

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

Other differences:
------------------
++++++ rubygem-timers.spec ++++++
--- /var/tmp/diff_new_pack.dJCv5B/_old  2015-12-01 09:18:57.000000000 +0100
+++ /var/tmp/diff_new_pack.dJCv5B/_new  2015-12-01 09:18:57.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-timers
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -15,17 +15,26 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+
+#
+# This file was generated with a gem2rpm.yml and not just plain gem2rpm.
+# All sections marked as MANUAL, license headers, summaries and descriptions
+# can be maintained in that file. Please consult this file before editing any
+# of those fields
+#
+
 Name:           rubygem-timers
-Version:        4.0.1
+Version:        4.1.1
 Release:        0
 %define mod_name timers
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  ruby-macros >= 5
-BuildRequires:  %{ruby}
 BuildRequires:  %{rubygem gem2rpm}
+BuildRequires:  %{ruby}
+BuildRequires:  ruby-macros >= 5
 Url:            https://github.com/celluloid/timers
 Source:         http://rubygems.org/gems/%{mod_full_name}.gem
+Source1:        gem2rpm.yml
 Summary:        Schedule procs to run after a certain time, or at periodic
 License:        MIT
 Group:          Development/Languages/Ruby

++++++ gem2rpm.yml ++++++
# ---
# ## used by gem2rpm
# :summary: this is a custom summary
# ## used by gem2rpm
# :description: |-
#   this is a custom description
#
#   it can be multiline
# ## used by gem2rpm
# :license: MIT or Ruby
# ## used by gem2rpm and gem_packages
# :version_suffix: -x_y
# ## used by gem2rpm and gem_packages
# :disable_docs: true
# ## used by gem2rpm
# :disable_automatic_rdoc_dep: true
# ## used by gem2rpm
# :preamble: |-
#   BuildRequires: foobar
#   Requires: foobar
# ## used by gem2rpm
# :patches:
#   foo.patch: -p1
#   bar.patch: 
# ## used by gem2rpm
:sources:
# - foo.desktop
# - bar.desktop
# :gem_install_args: '....'
# ## used by gem2rpm
# :pre_install: |-
#   %if 0%{?use_system_libev}
#   export USE_VENDORED_LIBEV="no"
#   %endif
# ## used by gem2rpm
# :post_install: |-
#   # delete custom files here or do other fancy stuff
#   install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse
# ## used by gem2rpm
# :testsuite_command: |-
#   (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test)
# ## used by gem2rpm
# :filelist: |-
#   /usr/bin/gem2rpm-opensuse
# ## used by gem2rpm
# :scripts:
#   :post: |-
#     /bin/echo foo
# ## used by gem_packages
# :main:
#   :preamble: |-
#     Requires: util-linux
#     Recommends: pwgen
#   :filelist: |-
#     /usr/bin/gem2rpm-opensuse
# ## used by gem_packages
# :custom:
#   apache:
#     :preamble: |-
#       Requires: .....
#     :filelist: |-
#       /etc/apache2/conf.d/passenger.conf
#     :summary: Custom summary is optional
#     :description: |-
#       Custom description is optional
#
#       bar
#     :post: |-
#       /bin/echo foo
#
++++++ timers-4.0.1.gem -> timers-4.1.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml     2014-09-10 17:42:56.000000000 +0200
+++ new/.travis.yml     2015-08-21 17:45:11.000000000 +0200
@@ -8,6 +8,7 @@
   - rbx-2
 
 matrix:
+  fast_finish: true
   allow_failures:
     - rvm: ruby-head
     - rvm: jruby-head
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGES.md new/CHANGES.md
--- old/CHANGES.md      2014-09-10 17:42:56.000000000 +0200
+++ new/CHANGES.md      2015-08-21 17:45:11.000000000 +0200
@@ -1,3 +1,12 @@
+4.1.1 (2015-08-21)
+------------------
+* Remove `RubyProf` from Gemfile and a test, due to it providing no 
substantial benefit while increasing problems building bundles under Rubinius.
+
+4.1.0 (2015-08-16)
+------------------
+* Addition of `now_and_every` method; fires block immediately, then sets 
recurring timer.
+* Includes `now_and_after` method; does the same as above for one-shot timers: 
essentially a "two-shot" timer.
+
 4.0.1 (2014-09-10)
 ------------------
 * Memory leak fixes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 2014-09-10 17:42:56.000000000 +0200
+++ new/Gemfile 2015-08-21 17:45:11.000000000 +0200
@@ -4,7 +4,3 @@
 
 # Specify your gem's dependencies in timers.gemspec
 gemspec
-
-unless RUBY_PLATFORM =~ /java/ 
-  gem "ruby-prof", :group => :development
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2014-09-10 17:42:56.000000000 +0200
+++ new/README.md       2015-08-21 17:45:11.000000000 +0200
@@ -50,6 +50,13 @@
 loop { timers.wait }
 ```
 
+You can also schedule a block to run immediately and periodically with 
`Timers::Group#now_and_every`:
+```ruby
+now_and_every_five_seconds = timers.now_and_every(5) { puts "Now and in 
another 5 seconds" }
+
+loop { timers.wait }
+```
+
 If you'd like another method to do the waiting for you, e.g. `Kernel.select`,
 you can use `Timers::Group#wait_interval` to obtain the amount of time to 
wait. When
 a timeout is encountered, you can fire all pending timers with 
`Timers::Group#fire`:
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/timers/events.rb new/lib/timers/events.rb
--- old/lib/timers/events.rb    2014-09-10 17:42:56.000000000 +0200
+++ new/lib/timers/events.rb    2015-08-21 17:45:11.000000000 +0200
@@ -72,6 +72,7 @@
           return handle
         end
       end
+      # @sequence.reverse.find { |handle| !handle.cancelled? }
     end
     
     # Returns the number of pending (possibly cancelled) events.
@@ -93,7 +94,7 @@
     def pop(time)
       index = bisect_left(@sequence, time)
       
-      return @sequence.pop(@sequence.size - index)
+      @sequence.pop(@sequence.size - index)
     end
     
     # Return the left-most index where to insert item e, in a list a, assuming 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/timers/group.rb new/lib/timers/group.rb
--- old/lib/timers/group.rb     2014-09-10 17:42:56.000000000 +0200
+++ new/lib/timers/group.rb     2015-08-21 17:45:11.000000000 +0200
@@ -38,12 +38,26 @@
       Timer.new(self, interval, false, &block)
     end
 
+    # Call the given block immediately, and then after the given interval. The 
first
+    # argument will be the time at which the group was asked to fire timers 
for.
+    def now_and_after(interval, &block)
+      block.call
+      after(interval, &block)
+    end
+
     # Call the given block periodically at the given interval. The first 
     # argument will be the time at which the group was asked to fire timers 
for.
     def every(interval, recur = true, &block)
       Timer.new(self, interval, recur, &block)
     end
 
+    # Call the given block immediately, and then periodically at the given 
interval. The first
+    # argument will be the time at which the group was asked to fire timers 
for.
+    def now_and_every(interval, recur = true, &block)
+      block.call
+      every(interval, recur, &block)
+    end
+
     # Wait for the next timer and fire it. Can take a block, which should 
behave
     # like sleep(n), except that n may be nil (sleep forever) or a negative
     # number (fire immediately after return).
@@ -61,7 +75,7 @@
         end
       end
 
-      fire
+      return fire
     end
 
     # Interval to wait until when the next timer will fire.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/timers/version.rb new/lib/timers/version.rb
--- old/lib/timers/version.rb   2014-09-10 17:42:56.000000000 +0200
+++ new/lib/timers/version.rb   2015-08-21 17:45:11.000000000 +0200
@@ -1,3 +1,3 @@
 module Timers
-  VERSION = "4.0.1"
+  VERSION = "4.1.1"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2014-09-10 17:42:56.000000000 +0200
+++ new/metadata        2015-08-21 17:45:11.000000000 +0200
@@ -1,53 +1,53 @@
 --- !ruby/object:Gem::Specification
 name: timers
 version: !ruby/object:Gem::Version
-  version: 4.0.1
+  version: 4.1.1
 platform: ruby
 authors:
 - Tony Arcieri
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2014-09-10 00:00:00.000000000 Z
+date: 2015-08-21 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
-  name: hitimes
-  requirement: !ruby/object:Gem::Requirement
+  version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
         version: '0'
+  name: hitimes
   type: :runtime
   prerelease: false
-  version_requirements: !ruby/object:Gem::Requirement
+  requirement: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
         version: '0'
 - !ruby/object:Gem::Dependency
-  name: rake
-  requirement: !ruby/object:Gem::Requirement
+  version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
         version: '0'
+  name: rake
   type: :development
   prerelease: false
-  version_requirements: !ruby/object:Gem::Requirement
+  requirement: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
         version: '0'
 - !ruby/object:Gem::Dependency
-  name: rspec
-  requirement: !ruby/object:Gem::Requirement
+  version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
         version: 3.0.0
+  name: rspec
   type: :development
   prerelease: false
-  version_requirements: !ruby/object:Gem::Requirement
+  requirement: !ruby/object:Gem::Requirement
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
@@ -104,7 +104,7 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.2.2
+rubygems_version: 2.4.8
 signing_key: 
 specification_version: 4
 summary: Schedule procs to run after a certain time, or at periodic intervals, 
using
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/every_spec.rb new/spec/every_spec.rb
--- old/spec/every_spec.rb      2014-09-10 17:42:56.000000000 +0200
+++ new/spec/every_spec.rb      2015-08-21 17:45:11.000000000 +0200
@@ -16,4 +16,19 @@
 
     expect(result).to be == [:a, :c, :a, :a, :b, :d]
   end
+
+  it "should fire immediately and then several times later" do
+    result = []
+
+    subject.every(0.7) { result << :a }
+    subject.every(2.3) { result << :b }
+    subject.now_and_every(1.3) { result << :c }
+    subject.now_and_every(2.4) { result << :d }
+
+    Timers::Wait.for(2.5) do |remaining|
+      subject.wait if subject.wait_interval < remaining
+    end
+
+    expect(result).to be == [:c, :d, :a, :c, :a, :a, :b, :d]
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/performance_spec.rb new/spec/performance_spec.rb
--- old/spec/performance_spec.rb        2014-09-10 17:42:56.000000000 +0200
+++ new/spec/performance_spec.rb        2015-08-21 17:45:11.000000000 +0200
@@ -1,6 +1,4 @@
-
 require 'spec_helper'
-require 'ruby-prof' unless RUBY_PLATFORM =~ /java/
 
 # Event based timers:
 
@@ -41,26 +39,8 @@
 # Serviced 1142649 events in 11.194903921 seconds, 102068.70405115146 e/s.
 
 RSpec.describe Timers::Group do
-  if defined? RubyProf
-    before(:each) do
-      # Running RubyProf makes the code slightly slower.
-      RubyProf.start
-      puts "*** Running with RubyProf reduces performance ***"
-    end
 
-    after(:each) do |arg|
-      if RubyProf.running?
-        # file = arg.metadata[:description].gsub(/\s+/, '-')
-      
-        result = RubyProf.stop
-      
-        printer = RubyProf::FlatPrinter.new(result)
-        printer.print($stderr, min_percent: 1.0)
-      end
-    end
-  end
-  
-  it "run efficiently" do
+  it "runs efficiently" do
     result = []
     range = (1..500)
     duration = 2.0
@@ -80,4 +60,41 @@
     
     expect(subject.current_offset).to be_within(TIMER_QUANTUM).of(duration)
   end
+
+=begin
+  it "runs efficiently at high volume" do
+    results = []
+    range = (1..300)
+    groups = (1..20)
+    duration = 101
+
+    timers = []
+    @mutex = Mutex.new
+    start = Time.now
+    groups.each do |gi|
+      timers << Thread.new {
+        result = []
+        timer = Timers::Group.new
+        total = 0
+        range.each do |ri|
+          offset = ri.to_f / range.max
+          total += (duration / offset).floor
+          timer.every(ri.to_f / range.max, :strict) { result << ri }
+        end
+        timer.wait while result.size < total
+        @mutex.synchronize { results += result }
+        
+      }
+    end
+    timers.each { |t| t.join }
+    finish = Time.now
+    
+    rate = results.size.to_f / ( runtime = finish - start )
+    
+    puts "Serviced #{results.size} events in #{runtime} seconds, #{rate} e/s; 
across #{groups.max} timers."
+    
+    expect(runtime).to be_within(TIMER_QUANTUM).of(duration)
+  end
+=end
+
 end


Reply via email to