Hello community, here is the log from the commit of package rubygem-timers for openSUSE:Factory checked in at 2020-10-05 19:34:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-timers (Old) and /work/SRC/openSUSE:Factory/.rubygem-timers.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-timers" Mon Oct 5 19:34:10 2020 rev:6 rq:838089 version:4.3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-timers/rubygem-timers.changes 2019-06-19 21:01:24.630138997 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-timers.new.4249/rubygem-timers.changes 2020-10-05 19:34:15.297266416 +0200 @@ -1,0 +2,6 @@ +Fri Sep 25 15:01:54 UTC 2020 - Stephan Kulow <co...@suse.com> + +updated to version 4.3.2 + no changelog found + +------------------------------------------------------------------- Old: ---- timers-4.3.0.gem New: ---- timers-4.3.2.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-timers.spec ++++++ --- /var/tmp/diff_new_pack.6zQhKd/_old 2020-10-05 19:34:17.829268889 +0200 +++ /var/tmp/diff_new_pack.6zQhKd/_new 2020-10-05 19:34:17.829268889 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-timers # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,15 +24,15 @@ # Name: rubygem-timers -Version: 4.3.0 +Version: 4.3.2 Release: 0 %define mod_name timers %define mod_full_name %{mod_name}-%{version} BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: %{ruby >= 2.2.1} BuildRequires: %{rubygem gem2rpm} +BuildRequires: %{ruby} BuildRequires: ruby-macros >= 5 -Url: https://github.com/socketry/timers +URL: https://github.com/socketry/timers Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml Summary: Pure Ruby one-shot and periodic timers @@ -40,8 +40,7 @@ Group: Development/Languages/Ruby %description -Schedule procs to run after a certain time, or at periodic intervals, using -any API that accepts a timeout. +Pure Ruby one-shot and periodic timers. %prep @@ -49,7 +48,6 @@ %install %gem_install \ - --doc-files="README.md" \ -f %gem_packages ++++++ timers-4.3.0.gem -> timers-4.3.2.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.editorconfig new/.editorconfig --- old/.editorconfig 2019-01-21 04:05:25.000000000 +0100 +++ new/.editorconfig 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -root = true - -[*] -indent_style = tab -indent_size = 2 - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 2019-01-21 04:05:25.000000000 +0100 +++ new/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -*.gem -*.rbc -.bundle -.config -.yardoc -Gemfile.lock -InstalledFiles -_yardoc -coverage -doc/ -lib/bundler/man -pkg -rdoc -spec/reports -test/tmp -test/version_tmp -tmp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.rspec new/.rspec --- old/.rspec 2019-01-21 04:05:25.000000000 +0100 +++ new/.rspec 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ ---format documentation ---warnings ---require spec_helper \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2019-01-21 04:05:25.000000000 +0100 +++ new/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ -language: ruby -dist: xenial -cache: bundler - -matrix: - include: - - rvm: 2.3 - - rvm: 2.4 - - rvm: 2.5 - - rvm: 2.6 - - rvm: jruby-head - env: JRUBY_OPTS="--debug -X+O" - - rvm: truffleruby - - rvm: ruby-head - - rvm: rbx-3 - allow_failures: - - rvm: ruby-head - - rvm: jruby-head - - rvm: rbx-3 - - rvm: truffleruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 2019-01-21 04:05:25.000000000 +0100 +++ new/Gemfile 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -source 'https://rubygems.org' - -gemspec - -group :development do - gem 'pry' -end - -group :test do - gem 'benchmark-ips' - - gem "ruby-prof", platform: :mri - gem 'simplecov', platform: :mri - gem 'coveralls', platform: :mri -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2019-01-21 04:05:25.000000000 +0100 +++ new/README.md 1970-01-01 01:00:00.000000000 +0100 @@ -1,149 +0,0 @@ -# Timers - -Collections of one-shot and periodic timers, intended for use with event loops such as [async]. - -[![Build Status](https://secure.travis-ci.org/socketry/timers.svg)](https://travis-ci.org/socketry/timers) -[![Code Climate](https://codeclimate.com/github/socketry/timers.svg)](https://codeclimate.com/github/socketry/timers) -[![Coverage Status](https://coveralls.io/repos/socketry/timers/badge.svg)](https://coveralls.io/r/socketry/timers) - -[async]: https://github.com/socketry/async - -## Installation - -Add this line to your application's Gemfile: - -```ruby -gem 'timers' -``` - -And then execute: - - $ bundle - -Or install it yourself as: - - $ gem install timers - -## Usage - -Create a new timer group with `Timers::Group.new`: - -```ruby -require 'timers' - -timers = Timers::Group.new -``` - -Schedule a proc to run after 5 seconds with `Timers::Group#after`: - -```ruby -five_second_timer = timers.after(5) { puts "Take five" } -``` - -The `five_second_timer` variable is now bound to a Timers::Timer object. To -cancel a timer, use `Timers::Timer#cancel` - -Once you've scheduled a timer, you can wait until the next timer fires with `Timers::Group#wait`: - -```ruby -# Waits 5 seconds -timers.wait - -# The script will now print "Take five" -``` - -You can schedule a block to run periodically with `Timers::Group#every`: - -```ruby -every_five_seconds = timers.every(5) { puts "Another 5 seconds" } - -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`: - -```ruby -loop do - interval = timers.wait_interval - ready_readers, ready_writers = select readers, writers, nil, interval - - if ready_readers || ready_writers - # Handle IO - ... - else - # Timeout! - timers.fire - end -end -``` - -You can also pause and continue individual timers, or all timers: - -```ruby -paused_timer = timers.every(5) { puts "I was paused" } - -paused_timer.pause -10.times { timers.wait } # will not fire paused timer - -paused_timer.resume -10.times { timers.wait } # will fire timer - -timers.pause -10.times { timers.wait } # will not fire any timers - -timers.resume -10.times { timers.wait } # will fire all timers -``` - -## Contributing - -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request - -## License - -Released under the MIT license. - -Copyright, 2018, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams). -Copyright, 2016, by [Tony Arcieri](basc...@gmail.com). -Copyright, 2016, by Jeremy Hinegardner. -Copyright, 2016, by Sean Gregory. -Copyright, 2016, by Chuck Remes. -Copyright, 2016, by Utenmiki. -Copyright, 2016, by Ron Evans. -Copyright, 2016, by Larry Lv. -Copyright, 2016, by Bruno Enten. -Copyright, 2016, by Jesse Cooke. -Copyright, 2016, by Nicholas Evans. -Copyright, 2016, by Dimitrij Denissenko. -Copyright, 2016, by Ryan LeCompte. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2019-01-21 04:05:25.000000000 +0100 +++ new/Rakefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -require "bundler/gem_tasks" -require "rspec/core/rake_task" - -RSpec::Core::RakeTask.new(:test) - -task :default => :test Binary 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 2019-01-21 04:05:25.000000000 +0100 +++ new/lib/timers/events.rb 2020-09-04 08:35:48.000000000 +0200 @@ -1,9 +1,24 @@ # frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# + +# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. require_relative "timer" 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 2019-01-21 04:05:25.000000000 +0100 +++ new/lib/timers/group.rb 2020-09-04 08:35:48.000000000 +0200 @@ -1,9 +1,24 @@ # frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# + +# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. require "set" require "forwardable" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/timers/interval.rb new/lib/timers/interval.rb --- old/lib/timers/interval.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/lib/timers/interval.rb 2020-09-04 08:35:48.000000000 +0200 @@ -1,9 +1,24 @@ # frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# + +# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. module Timers # A collection of timers which may fire at different times diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/timers/timer.rb new/lib/timers/timer.rb --- old/lib/timers/timer.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/lib/timers/timer.rb 2020-09-04 08:35:48.000000000 +0200 @@ -1,9 +1,24 @@ # frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# + +# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. module Timers # An individual timer set to fire a given proc at a given time. A timer is 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 2019-01-21 04:05:25.000000000 +0100 +++ new/lib/timers/version.rb 2020-09-04 08:35:48.000000000 +0200 @@ -1,10 +1,25 @@ # frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# + +# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. module Timers - VERSION = "4.3.0" + VERSION = "4.3.2" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/timers/wait.rb new/lib/timers/wait.rb --- old/lib/timers/wait.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/lib/timers/wait.rb 2020-09-04 08:35:48.000000000 +0200 @@ -1,9 +1,24 @@ # frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# + +# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. require_relative "interval" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/timers.rb new/lib/timers.rb --- old/lib/timers.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/lib/timers.rb 2020-09-04 08:35:48.000000000 +0200 @@ -1,11 +1,26 @@ # frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# -require "timers/version" +# Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. -require "timers/group" -require "timers/wait" +require_relative "timers/version" + +require_relative "timers/group" +require_relative "timers/wait" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2019-01-21 04:05:25.000000000 +0100 +++ new/metadata 2020-09-04 08:35:48.000000000 +0200 @@ -1,15 +1,15 @@ --- !ruby/object:Gem::Specification name: timers version: !ruby/object:Gem::Version - version: 4.3.0 + version: 4.3.2 platform: ruby authors: - Samuel Williams - Tony Arcieri -autorequire: +autorequire: bindir: bin cert_chain: [] -date: 2019-01-21 00:00:00.000000000 Z +date: 2020-09-04 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler @@ -26,49 +26,39 @@ - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency - name: rspec + name: covered requirement: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" - !ruby/object:Gem::Version - version: '3.6' + version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" - !ruby/object:Gem::Version - version: '3.6' + version: '0' - !ruby/object:Gem::Dependency - name: rake + name: rspec requirement: !ruby/object:Gem::Requirement requirements: - - - ">=" + - - "~>" - !ruby/object:Gem::Version - version: '0' + version: '3.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - ">=" + - - "~>" - !ruby/object:Gem::Version - version: '0' -description: Schedule procs to run after a certain time, or at periodic intervals, - using any API that accepts a timeout. + version: '3.0' +description: email: -- sam...@codeotaku.com -- basc...@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: -- ".editorconfig" -- ".gitignore" -- ".rspec" -- ".travis.yml" -- Gemfile -- README.md -- Rakefile - lib/timers.rb - lib/timers/events.rb - lib/timers/group.rb @@ -76,20 +66,11 @@ - lib/timers/timer.rb - lib/timers/version.rb - lib/timers/wait.rb -- spec/spec_helper.rb -- spec/timers/cancel_spec.rb -- spec/timers/events_spec.rb -- spec/timers/every_spec.rb -- spec/timers/group_spec.rb -- spec/timers/performance_spec.rb -- spec/timers/strict_spec.rb -- spec/timers/wait_spec.rb -- timers.gemspec homepage: https://github.com/socketry/timers licenses: - MIT metadata: {} -post_install_message: +post_install_message: rdoc_options: [] require_paths: - lib @@ -97,23 +78,15 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: 2.2.1 + version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.0.1 -signing_key: +rubygems_version: 3.1.2 +signing_key: specification_version: 4 -summary: Pure Ruby one-shot and periodic timers -test_files: -- spec/spec_helper.rb -- spec/timers/cancel_spec.rb -- spec/timers/events_spec.rb -- spec/timers/every_spec.rb -- spec/timers/group_spec.rb -- spec/timers/performance_spec.rb -- spec/timers/strict_spec.rb -- spec/timers/wait_spec.rb +summary: Pure Ruby one-shot and periodic timers. +test_files: [] 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 2019-01-21 04:05:25.000000000 +0100 +++ new/spec/spec_helper.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,40 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -# Level of accuracy enforced by tests (50ms) -TIMER_QUANTUM = 0.05 - -if ENV['COVERAGE'] || ENV['TRAVIS'] - begin - require 'simplecov' - - SimpleCov.start do - add_filter "/spec/" - end - - if ENV['TRAVIS'] - require 'coveralls' - Coveralls.wear! - end - rescue LoadError - warn "Could not load simplecov: #{$!}" - end -end - -require 'bundler/setup' -Bundler.require(:test) - -require 'timers' - -RSpec.configure do |config| - # Enable flags like --only-failures and --next-failure - config.example_status_persistence_file_path = ".rspec_status" - - config.expect_with :rspec do |c| - c.syntax = :expect - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/timers/cancel_spec.rb new/spec/timers/cancel_spec.rb --- old/spec/timers/cancel_spec.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/spec/timers/cancel_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,50 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -RSpec.describe Timers::Group do - it "should be able to cancel twice" do - fired = false - - timer = subject.after(0.1) { fired = true } - - 2.times do - timer.cancel - subject.wait - end - - expect(fired).to be false - end - - it "should be possble to reset after cancel" do - fired = false - - timer = subject.after(0.1) { fired = true } - timer.cancel - - subject.wait - - timer.reset - - subject.wait - - expect(fired).to be true - end - - it "should cancel and remove one shot timers after they fire" do - x = 0 - - Timers::Wait.for(2) do |_remaining| - timer = subject.every(0.2) { x += 1 } - subject.after(0.1) { timer.cancel } - - subject.wait - end - - expect(subject.timers).to be_empty - expect(x).to be == 0 - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/timers/events_spec.rb new/spec/timers/events_spec.rb --- old/spec/timers/events_spec.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/spec/timers/events_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,61 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -RSpec.describe Timers::Events do - it "should register an event" do - fired = false - - callback = proc do |_time| - fired = true - end - - subject.schedule(0.1, callback) - - expect(subject.size).to be == 1 - - subject.fire(0.15) - - expect(subject.size).to be == 0 - - expect(fired).to be true - end - - it "should register events in order" do - fired = [] - - times = [0.95, 0.1, 0.3, 0.5, 0.4, 0.2, 0.01, 0.9] - - times.each do |requested_time| - callback = proc do |_time| - fired << requested_time - end - - subject.schedule(requested_time, callback) - end - - subject.fire(0.5) - expect(fired).to be == times.sort.first(6) - - subject.fire(1.0) - expect(fired).to be == times.sort - end - - it "should fire events with the time they were fired at" do - fired_at = :not_fired - - callback = proc do |time| - # The time we actually were fired at: - fired_at = time - end - - subject.schedule(0.5, callback) - - subject.fire(1.0) - - expect(fired_at).to be == 1.0 - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/timers/every_spec.rb new/spec/timers/every_spec.rb --- old/spec/timers/every_spec.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/spec/timers/every_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -RSpec.describe Timers::Group do - it "should fire several times" do - result = [] - - subject.every(0.7) { result << :a } - subject.every(2.3) { result << :b } - subject.every(1.3) { result << :c } - subject.every(2.4) { result << :d } - - Timers::Wait.for(2.5) do |remaining| - subject.wait if subject.wait_interval < remaining - end - - 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/timers/group_spec.rb new/spec/timers/group_spec.rb --- old/spec/timers/group_spec.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/spec/timers/group_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,260 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -RSpec.describe Timers::Group do - describe "#wait" do - it "calls the wait block with nil" do - called = false - - subject.wait do |interval| - expect(interval).to be_nil - called = true - end - - expect(called).to be true - end - - it "calls the wait block with an interval" do - called = false - fired = false - - subject.after(0.1) { fired = true } - - subject.wait do |interval| - expect(interval).to be_within(TIMER_QUANTUM).of(0.1) - called = true - sleep 0.2 - end - - expect(called).to be true - expect(fired).to be true - end - end - - it "sleeps until the next timer" do - interval = TIMER_QUANTUM * 2 - started_at = Time.now - - fired = false - subject.after(interval) { fired = true } - subject.wait - - expect(fired).to be true - expect(Time.now - started_at).to be_within(TIMER_QUANTUM).of interval - end - - it "fires instantly when next timer is in the past" do - fired = false - subject.after(TIMER_QUANTUM) { fired = true } - sleep(TIMER_QUANTUM * 2) - subject.wait - - expect(fired).to be true - end - - it "calculates the interval until the next timer should fire" do - interval = 0.1 - - subject.after(interval) - expect(subject.wait_interval).to be_within(TIMER_QUANTUM).of interval - - sleep(interval) - expect(subject.wait_interval).to be <= 0 - end - - it "fires timers in the correct order" do - result = [] - - subject.after(TIMER_QUANTUM * 2) { result << :two } - subject.after(TIMER_QUANTUM * 3) { result << :three } - subject.after(TIMER_QUANTUM * 1) { result << :one } - - sleep TIMER_QUANTUM * 4 - subject.fire - - expect(result).to eq [:one, :two, :three] - end - - it "raises TypeError if given an invalid time" do - expect do - subject.after(nil) { nil } - end.to raise_exception(TypeError) - end - - describe "recurring timers" do - it "continues to fire the timers at each interval" do - result = [] - - subject.every(TIMER_QUANTUM * 2) { result << :foo } - - sleep TIMER_QUANTUM * 3 - subject.fire - expect(result).to eq [:foo] - - sleep TIMER_QUANTUM * 5 - subject.fire - expect(result).to eq [:foo, :foo] - end - end - - it "calculates the proper interval to wait until firing" do - interval_ms = 25 - - subject.after(interval_ms / 1000.0) - - expect(subject.wait_interval).to be_within(TIMER_QUANTUM).of(interval_ms / 1000.0) - end - - describe "pause and continue timers" do - before(:each) do - @interval = TIMER_QUANTUM * 2 - - @fired = false - @timer = subject.after(@interval) { @fired = true } - @fired2 = false - @timer2 = subject.after(@interval) { @fired2 = true } - end - - it "does not fire when paused" do - @timer.pause - subject.wait - expect(@fired).to be false - end - - it "fires when continued after pause" do - @timer.pause - subject.wait - @timer.resume - - sleep @timer.interval - subject.wait - - expect(@fired).to be true - end - - it "can pause all timers at once" do - subject.pause - subject.wait - expect(@fired).to be false - expect(@fired2).to be false - end - - it "can continue all timers at once" do - subject.pause - subject.wait - subject.resume - - # We need to wait until we are sure both timers will fire, otherwise highly accurate clocks - # (e.g. JVM)may only fire the first timer, but not the second, because they are actually - # schedueled at different times. - sleep TIMER_QUANTUM * 2 - subject.wait - - expect(@fired).to be true - expect(@fired2).to be true - end - - it "can fire the timer directly" do - fired = false - timer = subject.after(TIMER_QUANTUM * 1) { fired = true } - timer.pause - subject.wait - expect(fired).not_to be true - timer.resume - expect(fired).not_to be true - timer.fire - expect(fired).to be true - end - end - - describe "delay timer" do - it "adds appropriate amount of time to timer" do - timer = subject.after(10) - timer.delay(5) - expect(timer.offset - subject.current_offset).to be_within(TIMER_QUANTUM).of(15) - end - end - - describe "delay timer collection" do - it "delay on set adds appropriate amount of time to all timers" do - timer = subject.after(10) - timer2 = subject.after(20) - subject.delay(5) - expect(timer.offset - subject.current_offset).to be_within(TIMER_QUANTUM).of(15) - expect(timer2.offset - subject.current_offset).to be_within(TIMER_QUANTUM).of(25) - end - end - - describe "on delaying a timer" do - it "fires timers in the correct order" do - result = [] - - subject.after(TIMER_QUANTUM * 2) { result << :two } - subject.after(TIMER_QUANTUM * 3) { result << :three } - first = subject.after(TIMER_QUANTUM * 1) { result << :one } - first.delay(TIMER_QUANTUM * 3) - - sleep TIMER_QUANTUM * 5 - subject.fire - - expect(result).to eq [:two, :three, :one] - end - end - - describe "#inspect" do - it "before firing" do - fired = false - timer = subject.after(TIMER_QUANTUM * 5) { fired = true } - timer.pause - expect(fired).not_to be true - expect(timer.inspect).to match(/\A#<Timers::Timer:0x[\da-f]+ fires in [-\.\de]+ seconds>\Z/) - end - - it "after firing" do - fired = false - timer = subject.after(TIMER_QUANTUM) { fired = true } - - subject.wait - - expect(fired).to be true - expect(timer.inspect).to match(/\A#<Timers::Timer:0x[\da-f]+ fired [-\.\de]+ seconds ago>\Z/) - end - - it "recurring firing" do - result = [] - timer = subject.every(TIMER_QUANTUM) { result << :foo } - - subject.wait - expect(result).not_to be_empty - regex = /\A#<Timers::Timer:0x[\da-f]+ fires in [-\.\de]+ seconds, recurs every #{format("%0.2f", TIMER_QUANTUM)}>\Z/ - expect(timer.inspect).to match(regex) - end - end - - describe "#fires_in" do - let(:interval) { TIMER_QUANTUM * 2 } - - it "calculates the interval until the next fire if it's recurring" do - timer = subject.every(interval) { true } - expect(timer.fires_in).to be_within(TIMER_QUANTUM).of(interval) - end - - context "when timer is not recurring" do - let!(:timer) { subject.after(interval) { true } } - - it "calculates the interval until the next fire if it hasn't already fired" do - expect(timer.fires_in).to be_within(TIMER_QUANTUM).of(interval) - end - - it "calculates the interval since last fire if already fired" do - subject.wait - sleep(interval) - expect(timer.fires_in).to be_within(TIMER_QUANTUM).of(0 - interval) - end - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/timers/performance_spec.rb new/spec/timers/performance_spec.rb --- old/spec/timers/performance_spec.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/spec/timers/performance_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,124 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -require "spec_helper" - -# Event based timers: - -# Serviced 31812 events in 2.39075272 seconds, 13306.320832794887 e/s. -# Thread ID: 7336700 -# Fiber ID: 30106340 -# Total: 2.384043 -# Sort by: self_time - -# %self total self wait child calls name -# 13.48 0.510 0.321 0.000 0.189 369133 Timers::Events::Handle#<=> -# 8.12 0.194 0.194 0.000 0.000 427278 Timers::Events::Handle#to_f -# 4.55 0.109 0.109 0.000 0.000 427278 Float#<=> -# 4.40 1.857 0.105 0.000 1.752 466376 *Timers::Events#bsearch -# 4.30 0.103 0.103 0.000 0.000 402945 Float#to_f -# 2.65 0.063 0.063 0.000 0.000 33812 Array#insert -# 2.64 1.850 0.063 0.000 1.787 33812 Timers::Events#schedule -# 2.40 1.930 0.057 0.000 1.873 33812 Timers::Timer#reset -# 1.89 1.894 0.045 0.000 1.849 31812 Timers::Timer#fire -# 1.69 1.966 0.040 0.000 1.926 31812 Timers::Events::Handle#fire -# 1.35 0.040 0.032 0.000 0.008 33812 Timers::Events::Handle#initialize -# 1.29 0.044 0.031 0.000 0.013 44451 Timers::Group#current_offset - -# SortedSet based timers: - -# Serviced 32516 events in 66.753277275 seconds, 487.1072288781219 e/s. -# Thread ID: 15995640 -# Fiber ID: 38731780 -# Total: 66.716394 -# Sort by: self_time - -# %self total self wait child calls name -# 54.73 49.718 36.513 0.000 13.205 57084873 Timers::Timer#<=> -# 23.74 65.559 15.841 0.000 49.718 32534 Array#sort! -# 19.79 13.205 13.205 0.000 0.000 57084873 Float#<=> - -# Max out events performance (on my computer): -# Serviced 1142649 events in 11.194903921 seconds, 102068.70405115146 e/s. - -RSpec.describe Timers::Group do - context "with profiler" 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 - 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 "runs efficiently" do - result = [] - range = (1..500) - duration = 2.0 - - total = 0 - range.each do |index| - offset = index.to_f / range.max - total += (duration / offset).floor - - subject.every(index.to_f / range.max, :strict) { result << index } - end - - subject.wait while result.size < total - - rate = result.size.to_f / subject.current_offset - puts "Serviced #{result.size} events in #{subject.current_offset} seconds, #{rate} e/s." - - expect(subject.current_offset).to be_within(20).percent_of(duration) - end - end - - it "runs efficiently at high volume" do - results = [] - range = (1..300) - groups = (1..20) - duration = 11 - - 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(20).percent_of(duration) - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/timers/strict_spec.rb new/spec/timers/strict_spec.rb --- old/spec/timers/strict_spec.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/spec/timers/strict_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,39 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -RSpec.describe Timers::Group do - it "should not diverge too much" do - fired = :not_fired_yet - count = 0 - quantum = 0.01 - - start_offset = subject.current_offset - Timers::Timer.new(subject, quantum, :strict, start_offset) do |offset| - fired = offset - count += 1 - end - - iterations = 1000 - subject.wait while count < iterations - - # In my testing on the JVM, without the :strict recurring, I noticed 60ms of error here. - expect(fired - start_offset).to be_within(quantum).of(iterations * quantum) - end - - it "should only fire 0-interval timer once per iteration" do - count = 0 - - start_offset = subject.current_offset - Timers::Timer.new(subject, 0, :strict, start_offset) do |offset, timer| - count += 1 - end - - subject.wait - - expect(count).to be == 1 - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/timers/wait_spec.rb new/spec/timers/wait_spec.rb --- old/spec/timers/wait_spec.rb 2019-01-21 04:05:25.000000000 +0100 +++ new/spec/timers/wait_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -require "spec_helper" -require "timers/wait" - -RSpec.describe Timers::Wait do - it "repeats until timeout expired" do - timeout = Timers::Wait.new(5) - count = 0 - - timeout.while_time_remaining do |remaining| - expect(remaining).to be_within(TIMER_QUANTUM).of(timeout.duration - count) - - count += 1 - sleep 1 - end - - expect(count).to eq(5) - end - - it "yields results as soon as possible" do - timeout = Timers::Wait.new(5) - - result = timeout.while_time_remaining do |_remaining| - break :done - end - - expect(result).to eq(:done) - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/timers.gemspec new/timers.gemspec --- old/timers.gemspec 2019-01-21 04:05:25.000000000 +0100 +++ new/timers.gemspec 1970-01-01 01:00:00.000000000 +0100 @@ -1,33 +0,0 @@ -# frozen_string_literal: true -# -# This file is part of the "timers" project and released under the MIT license. -# -# Copyright, 2018, by Samuel Williams. All rights reserved. -# - -require_relative 'lib/timers/version' - -Gem::Specification.new do |spec| - spec.name = "timers" - spec.version = Timers::VERSION - spec.authors = ["Samuel Williams", "Tony Arcieri"] - spec.email = ["sam...@codeotaku.com", "basc...@gmail.com"] - spec.licenses = ["MIT"] - spec.homepage = "https://github.com/socketry/timers" - spec.summary = "Pure Ruby one-shot and periodic timers" - spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ") - Schedule procs to run after a certain time, or at periodic intervals, - using any API that accepts a timeout. - DESCRIPTION - - spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR) - spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] - - spec.required_ruby_version = '>= 2.2.1' - - spec.add_development_dependency "bundler" - spec.add_development_dependency "rspec", "~> 3.6" - spec.add_development_dependency "rake" -end