Hello community, here is the log from the commit of package rubygem-ruby-dbus for openSUSE:Factory checked in at 2018-07-13 10:14:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-ruby-dbus (Old) and /work/SRC/openSUSE:Factory/.rubygem-ruby-dbus.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-ruby-dbus" Fri Jul 13 10:14:01 2018 rev:21 rq:621033 version:0.15.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-ruby-dbus/rubygem-ruby-dbus.changes 2017-10-23 16:37:00.618403785 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-ruby-dbus.new/rubygem-ruby-dbus.changes 2018-07-13 10:14:03.781936674 +0200 @@ -1,0 +2,25 @@ +Mon Apr 30 16:14:23 UTC 2018 - factory-a...@kulow.org + +- updated to version 0.15.0 + see installed NEWS.md + + ## Ruby D-Bus 0.15.0 - 2018-04-30 + + API: + * Accessing an unknown interface will raise instead of returning nil ([#74]). + + Bug fixes: + * Fixed a conflict with activesupport 5.2 ([#71]) + + [#71]: https://github.com/mvidner/ruby-dbus/issues/71 + [#74]: https://github.com/mvidner/ruby-dbus/pull/74 + +------------------------------------------------------------------- +Fri Jan 5 14:37:21 UTC 2018 - mvid...@suse.com + +- 0.14.1 + Bug fixes: + * Allow registering signal handlers while a signal is being handled + (gh#mvidner/ruby-dbus#70, Jan Biniok). + +------------------------------------------------------------------- Old: ---- ruby-dbus-0.14.0.gem New: ---- ruby-dbus-0.15.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-ruby-dbus.spec ++++++ --- /var/tmp/diff_new_pack.CsewjE/_old 2018-07-13 10:14:04.189937153 +0200 +++ /var/tmp/diff_new_pack.CsewjE/_new 2018-07-13 10:14:04.189937153 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-ruby-dbus # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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 @@ -24,7 +24,7 @@ # Name: rubygem-ruby-dbus -Version: 0.14.0 +Version: 0.15.0 Release: 0 %define mod_name ruby-dbus %define mod_full_name %{mod_name}-%{version} @@ -40,11 +40,11 @@ BuildRequires: %{ruby >= 2.0.0} BuildRequires: %{rubygem gem2rpm} BuildRequires: ruby-macros >= 5 -Url: https://trac.luon.net/ruby-dbus +Url: https://github.com/mvidner/ruby-dbus Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml Summary: Ruby module for interaction with D-Bus -License: LGPL-2.1 +License: LGPL-2.1-only Group: Development/Languages/Ruby %description ++++++ ruby-dbus-0.14.0.gem -> ruby-dbus-0.15.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/NEWS.md new/NEWS.md --- old/NEWS.md 2017-10-13 14:51:28.000000000 +0200 +++ new/NEWS.md 2018-04-30 17:10:48.000000000 +0200 @@ -2,6 +2,25 @@ ## Unreleased +## Ruby D-Bus 0.15.0 - 2018-04-30 + +API: + * Accessing an unknown interface will raise instead of returning nil ([#74]). + +Bug fixes: + * Fixed a conflict with activesupport 5.2 ([#71]) + +[#71]: https://github.com/mvidner/ruby-dbus/issues/71 +[#74]: https://github.com/mvidner/ruby-dbus/pull/74 + +## Ruby D-Bus 0.14.1 - 2018-01-05 + +Bug fixes: + * Allow registering signal handlers while a signal is being handled + ([#70][], Jan Biniok). + +[#70]: https://github.com/mvidner/ruby-dbus/pull/70 + ## Ruby D-Bus 0.14.0 - 2017-10-13 Bug fixes: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2017-10-13 14:51:28.000000000 +0200 +++ new/README.md 2018-04-30 17:10:48.000000000 +0200 @@ -18,7 +18,7 @@ [Coverage Status]: https://coveralls.io/r/mvidner/ruby-dbus [GV img]: https://badge.fury.io/rb/ruby-dbus.png -[BS img]: https://travis-ci.org/mvidner/ruby-dbus.png +[BS img]: https://travis-ci.org/mvidner/ruby-dbus.png?branch=master [DS img]: https://gemnasium.com/mvidner/ruby-dbus.png [CC img]: https://codeclimate.com/github/mvidner/ruby-dbus.png [CS img]: https://coveralls.io/repos/mvidner/ruby-dbus/badge.png?branch=master diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2017-10-13 14:51:28.000000000 +0200 +++ new/Rakefile 2018-04-30 17:10:48.000000000 +0200 @@ -29,7 +29,7 @@ RSpec::Core::RakeTask.new("bare:spec") -%w(spec).each do |tname| +["spec"].each do |tname| desc "Run bare:#{tname} in the proper environment" task tname do |_t| cd "spec/tools" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/VERSION new/VERSION --- old/VERSION 2017-10-13 14:51:28.000000000 +0200 +++ new/VERSION 2018-04-30 17:10:48.000000000 +0200 @@ -1 +1 @@ -0.14.0 +0.15.0 Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/gdbus/gdbus new/examples/gdbus/gdbus --- old/examples/gdbus/gdbus 2017-10-13 14:51:28.000000000 +0200 +++ new/examples/gdbus/gdbus 2018-04-30 17:10:48.000000000 +0200 @@ -226,7 +226,7 @@ def introspect_services(model, bus) el = @introspect_array.shift - if !(el =~ /^:/) + if el !~ /^:/ iter = model.append(nil) iter[0] = el puts "introspecting: #{el}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/auth.rb new/lib/dbus/auth.rb --- old/lib/dbus/auth.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/auth.rb 2018-04-30 17:10:48.000000000 +0200 @@ -73,7 +73,7 @@ path = File.join(ENV["HOME"], ".dbus-keyrings", context) DBus.logger.debug "path: #{path.inspect}" File.foreach(path) do |line| - if line.index(id) == 0 + if line.index(id).zero? # Right line of file, read cookie cookie = line.split(" ")[2].chomp DBus.logger.debug "cookie: #{cookie.inspect}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/bus.rb new/lib/dbus/bus.rb --- old/lib/dbus/bus.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/bus.rb 2018-04-30 17:10:48.000000000 +0200 @@ -387,7 +387,7 @@ # introspect in synchronous ! data = introspect_data(dest, path) pof = DBus::ProxyObjectFactory.new(data, self, dest, path) - return pof.build + pof.build else introspect_data(dest, path) do |async_data| yield(DBus::ProxyObjectFactory.new(async_data, self, dest, path).build) @@ -538,7 +538,8 @@ end when DBus::Message::SIGNAL # the signal can match multiple different rules - @signal_matchrules.each do |mrs, slot| + # clone to allow new signale handlers to be registered + @signal_matchrules.dup.each do |mrs, slot| if DBus::MatchRule.new.from_s(mrs).match(m) slot.call(m) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/core_ext/array/extract_options.rb new/lib/dbus/core_ext/array/extract_options.rb --- old/lib/dbus/core_ext/array/extract_options.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/core_ext/array/extract_options.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,31 +0,0 @@ -# copied from activesupport/core_ext from Rails, MIT license -# https://github.com/rails/rails/tree/5aa869861c192daceafe3a3ee50eb93f5a2b7bd2/activesupport/lib/active_support/core_ext -class Hash - # By default, only instances of Hash itself are extractable. - # Subclasses of Hash may implement this method and return - # true to declare themselves as extractable. If a Hash - # is extractable, Array#extract_options! pops it from - # the Array when it is the last element of the Array. - def extractable_options? - instance_of?(Hash) - end -end - -class Array - # Extracts options from a set of arguments. Removes and returns the last - # element in the array if it's a hash, otherwise returns a blank hash. - # - # def options(*args) - # args.extract_options! - # end - # - # options(1, 2) # => {} - # options(1, 2, a: :b) # => {:a=>:b} - def extract_options! - if last.is_a?(Hash) && last.extractable_options? - pop - else - {} - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/core_ext/class/attribute.rb new/lib/dbus/core_ext/class/attribute.rb --- old/lib/dbus/core_ext/class/attribute.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/core_ext/class/attribute.rb 2018-04-30 17:10:48.000000000 +0200 @@ -1,15 +1,17 @@ +# frozen_string_literal: true # copied from activesupport/core_ext from Rails, MIT license -# https://github.com/rails/rails/tree/5aa869861c192daceafe3a3ee50eb93f5a2b7bd2/activesupport/lib/active_support/core_ext -require 'dbus/core_ext/kernel/singleton_class' -require 'dbus/core_ext/module/remove_method' -require 'dbus/core_ext/array/extract_options' +# https://github.com/rails/rails/tree/9794e85351243cac6d4e78adaba634b8e4ecad0a/activesupport/lib/active_support/core_ext + +require "dbus/core_ext/module/redefine_method" class Class # Declare a class-level attribute whose value is inheritable by subclasses. # Subclasses can change their own value and it will not impact parent class. # + # ==== Examples + # # class Base - # class_attribute :setting + # my_class_attribute :setting # end # # class Subclass < Base @@ -22,14 +24,14 @@ # Base.setting # => true # # In the above case as long as Subclass does not assign a value to setting - # by performing <tt>Subclass.setting = _something_ </tt>, <tt>Subclass.setting</tt> + # by performing <tt>Subclass.setting = _something_</tt>, <tt>Subclass.setting</tt> # would read value assigned to parent class. Once Subclass assigns a value then # the value assigned by Subclass would be returned. # # This matches normal Ruby method inheritance: think of writing an attribute # on a subclass as overriding the reader method. However, you need to be aware # when using +class_attribute+ with mutable structures as +Array+ or +Hash+. - # In such cases, you don't want to do changes in places but use setters: + # In such cases, you don't want to do changes in place. Instead use setters: # # Base.setting = [] # Base.setting # => [] @@ -59,39 +61,25 @@ # object.setting = false # object.setting # => false # Base.setting # => true - # - # To opt out of the instance reader method, pass <tt>instance_reader: false</tt>. - # - # object.setting # => NoMethodError - # object.setting? # => NoMethodError - # - # To opt out of the instance writer method, pass <tt>instance_writer: false</tt>. - # - # object.setting = false # => NoMethodError - # - # To opt out of both instance methods, pass <tt>instance_accessor: false</tt>. - def class_attribute(*attrs) - options = attrs.extract_options! - instance_reader = options.fetch(:instance_accessor, true) && options.fetch(:instance_reader, true) - instance_writer = options.fetch(:instance_accessor, true) && options.fetch(:instance_writer, true) - instance_predicate = options.fetch(:instance_predicate, true) + def my_class_attribute(*attrs) + instance_reader = true + instance_writer = true attrs.each do |name| + singleton_class.silence_redefinition_of_method(name) define_singleton_method(name) { nil } - define_singleton_method("#{name}?") { !!public_send(name) } if instance_predicate - ivar = "@#{name}" + ivar = "@#{name}".to_sym + singleton_class.silence_redefinition_of_method("#{name}=") define_singleton_method("#{name}=") do |val| singleton_class.class_eval do - remove_possible_method(name) - define_method(name) { val } + redefine_method(name) { val } end if singleton_class? class_eval do - remove_possible_method(name) - define_method(name) do + redefine_method(name) do if instance_variable_defined? ivar instance_variable_get ivar else @@ -104,26 +92,20 @@ end if instance_reader - remove_possible_method name - define_method(name) do + redefine_method(name) do if instance_variable_defined?(ivar) instance_variable_get ivar else self.class.public_send name end end - define_method("#{name}?") { !!public_send(name) } if instance_predicate end - attr_writer name if instance_writer - end - end - - private - - unless respond_to?(:singleton_class?) - def singleton_class? - ancestors.first != self + if instance_writer + redefine_method("#{name}=") do |val| + instance_variable_set ivar, val + end end end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/core_ext/kernel/singleton_class.rb new/lib/dbus/core_ext/kernel/singleton_class.rb --- old/lib/dbus/core_ext/kernel/singleton_class.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/core_ext/kernel/singleton_class.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -# copied from activesupport/core_ext from Rails, MIT license -# https://github.com/rails/rails/tree/5aa869861c192daceafe3a3ee50eb93f5a2b7bd2/activesupport/lib/active_support/core_ext -module Kernel - # class_eval on an object acts like singleton_class.class_eval. - def class_eval(*args, &block) - singleton_class.class_eval(*args, &block) - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/core_ext/module/redefine_method.rb new/lib/dbus/core_ext/module/redefine_method.rb --- old/lib/dbus/core_ext/module/redefine_method.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/dbus/core_ext/module/redefine_method.rb 2018-04-30 17:10:48.000000000 +0200 @@ -0,0 +1,51 @@ +# frozen_string_literal: true +# copied from activesupport/core_ext from Rails, MIT license +# https://github.com/rails/rails/tree/a713fdae4eb4f7ccd34932edc61561a96b8d9f35/activesupport/lib/active_support/core_ext/module + +class Module + if RUBY_VERSION >= "2.3" + # Marks the named method as intended to be redefined, if it exists. + # Suppresses the Ruby method redefinition warning. Prefer + # #redefine_method where possible. + def silence_redefinition_of_method(method) + if method_defined?(method) || private_method_defined?(method) + # This suppresses the "method redefined" warning; the self-alias + # looks odd, but means we don't need to generate a unique name + alias_method method, method + end + end + else + def silence_redefinition_of_method(method) + if method_defined?(method) || private_method_defined?(method) + alias_method :__rails_redefine, method + remove_method :__rails_redefine + end + end + end + + # Replaces the existing method definition, if there is one, with the passed + # block as its body. + def redefine_method(method, &block) + visibility = method_visibility(method) + silence_redefinition_of_method(method) + define_method(method, &block) + send(visibility, method) + end + + # Replaces the existing singleton method definition, if there is one, with + # the passed block as its body. + def redefine_singleton_method(method, &block) + singleton_class.redefine_method(method, &block) + end + + def method_visibility(method) # :nodoc: + case + when private_method_defined?(method) + :private + when protected_method_defined?(method) + :protected + else + :public + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/core_ext/module/remove_method.rb new/lib/dbus/core_ext/module/remove_method.rb --- old/lib/dbus/core_ext/module/remove_method.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/core_ext/module/remove_method.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -# copied from activesupport/core_ext from Rails, MIT license -# https://github.com/rails/rails/tree/5aa869861c192daceafe3a3ee50eb93f5a2b7bd2/activesupport/lib/active_support/core_ext -class Module - def remove_possible_method(method) - if method_defined?(method) || private_method_defined?(method) - undef_method(method) - end - end - - def redefine_method(method, &block) - remove_possible_method(method) - define_method(method, &block) - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/export.rb new/lib/dbus/export.rb --- old/lib/dbus/export.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/export.rb 2018-04-30 17:10:48.000000000 +0200 @@ -9,6 +9,7 @@ # See the file "COPYING" for the exact licensing terms. require "thread" +require "dbus/core_ext/class/attribute" module DBus # Exported object type @@ -20,7 +21,7 @@ # The path of the object. attr_reader :path # The interfaces that the object supports. Hash: String => Interface - class_attribute :intfs + my_class_attribute :intfs self.intfs = {} # The service that the object is exported by. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/introspect.rb new/lib/dbus/introspect.rb --- old/lib/dbus/introspect.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/introspect.rb 2018-04-30 17:10:48.000000000 +0200 @@ -50,9 +50,9 @@ raise InvalidIntrospectionData if name.bytesize > 255 raise InvalidIntrospectionData if name =~ /^\./ || name =~ /\.$/ raise InvalidIntrospectionData if name =~ /\.\./ - raise InvalidIntrospectionData if !(name =~ /\./) + raise InvalidIntrospectionData if name !~ /\./ name.split(".").each do |element| - raise InvalidIntrospectionData if !(element =~ INTERFACE_ELEMENT_RE) + raise InvalidIntrospectionData if element !~ INTERFACE_ELEMENT_RE end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/marshall.rb new/lib/dbus/marshall.rb --- old/lib/dbus/marshall.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/marshall.rb 2018-04-30 17:10:48.000000000 +0200 @@ -69,6 +69,7 @@ def align(a) case a when 1 + nil when 2, 4, 8 bits = a - 1 @idx = @idx + bits & ~bits diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/proxy_object.rb new/lib/dbus/proxy_object.rb --- old/lib/dbus/proxy_object.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/proxy_object.rb 2018-04-30 17:10:48.000000000 +0200 @@ -54,7 +54,9 @@ # @return [ProxyObjectInterface] def [](intfname) introspect unless introspected - @interfaces[intfname] + ifc = @interfaces[intfname] + raise DBus::Error, "no such interface `#{intfname}' on object `#{@path}'" unless ifc + ifc end # Maps the given interface name _intfname_ to the given interface _intf. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus/xml.rb new/lib/dbus/xml.rb --- old/lib/dbus/xml.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus/xml.rb 2018-04-30 17:10:48.000000000 +0200 @@ -41,21 +41,17 @@ # required methods # returns node attribute value - def [](key) - end + def [](key); end # yields child nodes which match xpath of type AbstractXML::Node - def each(xpath) - end + def each(xpath); end end # required methods # initialize parser with xml string - def initialize(xml) - end + def initialize(xml); end # yields nodes which match xpath of type AbstractXML::Node - def each(xpath) - end + def each(xpath); end end class NokogiriParser < AbstractXML diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/dbus.rb new/lib/dbus.rb --- old/lib/dbus.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/lib/dbus.rb 2018-04-30 17:10:48.000000000 +0200 @@ -11,7 +11,6 @@ require_relative "dbus/api_options" require_relative "dbus/auth" require_relative "dbus/bus" -require_relative "dbus/core_ext/class/attribute" require_relative "dbus/error" require_relative "dbus/export" require_relative "dbus/introspect" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2017-10-13 14:51:29.000000000 +0200 +++ new/metadata 2018-04-30 17:10:48.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: ruby-dbus version: !ruby/object:Gem::Version - version: 0.14.0 + version: 0.15.0 platform: ruby authors: - Ruby DBus Team autorequire: bindir: bin cert_chain: [] -date: 2017-10-13 00:00:00.000000000 Z +date: 2018-04-30 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: coveralls @@ -95,7 +95,7 @@ - !ruby/object:Gem::Version version: '0' description: Pure Ruby module for interaction with D-Bus IPC system -email: ruby-dbus-de...@lists.luon.net +email: martin.git...@vidner.net executables: [] extensions: [] extra_rdoc_files: [] @@ -127,10 +127,8 @@ - lib/dbus/api_options.rb - lib/dbus/auth.rb - lib/dbus/bus.rb -- lib/dbus/core_ext/array/extract_options.rb - lib/dbus/core_ext/class/attribute.rb -- lib/dbus/core_ext/kernel/singleton_class.rb -- lib/dbus/core_ext/module/remove_method.rb +- lib/dbus/core_ext/module/redefine_method.rb - lib/dbus/error.rb - lib/dbus/export.rb - lib/dbus/introspect.rb @@ -172,7 +170,7 @@ - spec/type_spec.rb - spec/value_spec.rb - spec/variant_spec.rb -homepage: https://trac.luon.net/ruby-dbus +homepage: https://github.com/mvidner/ruby-dbus licenses: - LGPL v2.1 metadata: {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ruby-dbus.gemspec new/ruby-dbus.gemspec --- old/ruby-dbus.gemspec 2017-10-13 14:51:28.000000000 +0200 +++ new/ruby-dbus.gemspec 2018-04-30 17:10:48.000000000 +0200 @@ -1,6 +1,5 @@ # -*- ruby -*- require "rubygems" -require "rake" GEMSPEC = Gem::Specification.new do |s| s.name = "ruby-dbus" @@ -10,12 +9,13 @@ s.version = File.read("VERSION").strip s.license = "LGPL v2.1" s.author = "Ruby DBus Team" - s.email = "ruby-dbus-de...@lists.luon.net" - s.homepage = "https://trac.luon.net/ruby-dbus" - s.files = FileList[ + s.email = "martin.git...@vidner.net" + s.homepage = "https://github.com/mvidner/ruby-dbus" + s.files = Dir[ "{doc,examples,lib,spec}/**/*", "COPYING", "NEWS.md", "Rakefile", "README.md", - "ruby-dbus.gemspec", "VERSION", ".rspec"].to_a.sort + "ruby-dbus.gemspec", "VERSION", ".rspec" + ] s.require_path = "lib" s.required_ruby_version = ">= 2.0.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/binding_spec.rb new/spec/binding_spec.rb --- old/spec/binding_spec.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/spec/binding_spec.rb 2018-04-30 17:10:48.000000000 +0200 @@ -28,10 +28,14 @@ # it should have its own interface expect(test2["org.ruby.Test2"]).not_to be_nil # but not an interface of the Test class - expect(test2["org.ruby.SampleInterface"]).to be_nil + expect { test2["org.ruby.SampleInterface"] }.to raise_error(DBus::Error) do |e| + expect(e.message).to match(/no such interface/) + end # and the parent should not get polluted by the child - expect(@base["org.ruby.Test2"]).to be_nil + expect { @base["org.ruby.Test2"] }.to raise_error(DBus::Error) do |e| + expect(e.message).to match(/no such interface/) + end end it "tests translating errors into exceptions" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/introspect_xml_parser_spec.rb new/spec/introspect_xml_parser_spec.rb --- old/spec/introspect_xml_parser_spec.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/spec/introspect_xml_parser_spec.rb 2018-04-30 17:10:48.000000000 +0200 @@ -4,19 +4,19 @@ describe "IntrospectXMLParserTest" do it "tests split interfaces" do - xml = <<EOS -<node> - <interface name="org.example.Foo"> - <method name="Dwim"/> - </interface> - <interface name="org.example.Bar"> - <method name="Drink"/> - </interface> - <interface name="org.example.Foo"> - <method name="Smurf"/> - </interface> -</node> -EOS + xml = <<-XML + <node> + <interface name="org.example.Foo"> + <method name="Dwim"/> + </interface> + <interface name="org.example.Bar"> + <method name="Drink"/> + </interface> + <interface name="org.example.Foo"> + <method name="Smurf"/> + </interface> + </node> + XML interfaces, _subnodes = DBus::IntrospectXMLParser.new(xml).parse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/proxy_object_spec.rb new/spec/proxy_object_spec.rb --- old/spec/proxy_object_spec.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/spec/proxy_object_spec.rb 2018-04-30 17:10:48.000000000 +0200 @@ -38,5 +38,14 @@ end end end + + describe "#[]" do + it "raises when the interface is not found" do + obj = svc["/org/ruby/MyInstance"] + expect { obj["org.ruby.NoSuchInterface"] }.to raise_error(DBus::Error) do |e| + expect(e.message).to match(/no such interface/) + end + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/session_bus_spec.rb new/spec/session_bus_spec.rb --- old/spec/session_bus_spec.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/spec/session_bus_spec.rb 2018-04-30 17:10:48.000000000 +0200 @@ -37,31 +37,31 @@ context "when DBUS_SESSION_BUS_ADDRESS from file is surrounded by quotation marks" do it "returns session bus address without single quotation marks" do - expect(File).to receive(:open).with(session_bus_file_path) { <<-EOS.gsub(/^\s*/, "") } + expect(File).to receive(:open).with(session_bus_file_path) { <<-TEXT.gsub(/^\s*/, "") } DBUS_SESSION_BUS_ADDRESS='#{dbus_session_bus_address}' DBUS_SESSION_BUS_PID=12345 DBUS_SESSION_BUS_WINDOWID=12345678 - EOS + TEXT expect(DBus::ASessionBus.address_from_file).to eq(dbus_session_bus_address) end it "returns session bus address without double quotation marks" do - expect(File).to receive(:open).with(session_bus_file_path) { <<-EOS.gsub(/^\s*/, "") } + expect(File).to receive(:open).with(session_bus_file_path) { <<-TEXT.gsub(/^\s*/, "") } DBUS_SESSION_BUS_ADDRESS="#{dbus_session_bus_address}" DBUS_SESSION_BUS_PID=12345 DBUS_SESSION_BUS_WINDOWID=12345678 - EOS + TEXT expect(DBus::ASessionBus.address_from_file).to eq(dbus_session_bus_address) end end context "when DBUS_SESSION_BUS_ADDRESS from file is not surrounded by any quotation marks" do it "returns session bus address as it is" do - expect(File).to receive(:open).with(session_bus_file_path) { <<-EOS.gsub(/^\s*/, "") } + expect(File).to receive(:open).with(session_bus_file_path) { <<-TEXT.gsub(/^\s*/, "") } DBUS_SESSION_BUS_ADDRESS=#{dbus_session_bus_address} DBUS_SESSION_BUS_PID=12345 DBUS_SESSION_BUS_WINDOWID=12345678 - EOS + TEXT expect(DBus::ASessionBus.address_from_file).to eq(dbus_session_bus_address) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/signal_spec.rb new/spec/signal_spec.rb --- old/spec/signal_spec.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/spec/signal_spec.rb 2018-04-30 17:10:48.000000000 +0200 @@ -3,6 +3,19 @@ require_relative "spec_helper" require "dbus" +def new_quitter(main_loop) + Thread.new do + DBus.logger.debug "sleep before quit" + # FIXME: if we sleep for too long + # the socket will be drained and we deadlock in a select. + # It could be worked around by sending ourselves a Unix signal + # (with a dummy handler) to interrupt the select + sleep 1 + DBus.logger.debug "will quit" + main_loop.quit + end +end + describe "SignalHandlerTest" do before(:each) do @session_bus = DBus::ASessionBus.new @@ -32,16 +45,7 @@ DBus.logger.debug "will begin" @obj.LongTaskBegin 3 - quitter = Thread.new do - DBus.logger.debug "sleep before quit" - # FIXME: if we sleep for too long - # the socket will be drained and we deadlock in a select. - # It could be worked around by sending ourselves a Unix signal - # (with a dummy handler) to interrupt the select - sleep 1 - DBus.logger.debug "will quit" - @loop.quit - end + quitter = new_quitter(@loop) @loop.run quitter.join @@ -60,12 +64,7 @@ counter += 1 end @obj.LongTaskBegin 3 - quitter = Thread.new do - DBus.logger.debug "sleep before quit" - sleep 1 - DBus.logger.debug "will quit" - @loop.quit - end + quitter = new_quitter(@loop) @loop.run quitter.join @@ -75,6 +74,22 @@ expect { @intf.on_signal "to", "many", "yarrrrr!" }.to raise_error(ArgumentError) end + it "is possible to add signal handlers from within handlers" do + ended = false + @intf.on_signal "LongTaskStart" do + @intf.on_signal "LongTaskEnd" do + ended = true + end + end + + @obj.LongTaskBegin 3 + quitter = new_quitter(@loop) + @loop.run + quitter.join + + expect(ended).to eq(true) + end + it "tests too many rules" do 100.times do @obj.on_signal "Whichever" do 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-10-13 14:51:28.000000000 +0200 +++ new/spec/spec_helper.rb 2018-04-30 17:10:48.000000000 +0200 @@ -92,11 +92,11 @@ FileUtils.mkdir_p service_dir # file name actually does not need to match the service name File.open("#{service_dir}/#{name}.service", "w") do |f| - s = <<EOS -[D-BUS Service] -Name=#{name} -Exec=#{exec} -EOS + s = <<-TEXT.gsub(/^\s*/, "") + [D-BUS Service] + Name=#{name} + Exec=#{exec} + TEXT f.write(s) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/type_spec.rb new/spec/type_spec.rb --- old/spec/type_spec.rb 2017-10-13 14:51:28.000000000 +0200 +++ new/spec/type_spec.rb 2018-04-30 17:10:48.000000000 +0200 @@ -4,13 +4,13 @@ describe DBus do describe ".type" do - %w{i ai a(ii) aai}.each do |s| + ["i", "ai", "a(ii)", "aai"].each do |s| it "parses some type #{s}" do expect(DBus.type(s).to_s).to be_eql s end end - %w{aa (ii ii) hrmp}.each do |s| + ["aa", "(ii", "ii)", "hrmp"].each do |s| it "raises exception for invalid type #{s}" do expect { DBus.type(s).to_s }.to raise_error DBus::Type::SignatureException end