[rubygem-ruby-dbus] Initial import (#798248)

Bohuslav Kabrda bkabrda at fedoraproject.org
Fri Mar 9 13:54:58 UTC 2012


commit 94daafdd5ed402de4ed5b7d2466e28cd3db8a919
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date:   Fri Mar 9 14:54:52 2012 +0100

    Initial import (#798248)

 .gitignore                                        |    1 +
 ruby-dbus-unbundle-files-from-activesupport.patch |  206 +++++++++++++++++++++
 rubygem-ruby-dbus.spec                            |   92 +++++++++
 sources                                           |    1 +
 4 files changed, 300 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..4625ae8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/ruby-dbus-0.7.0.gem
diff --git a/ruby-dbus-unbundle-files-from-activesupport.patch b/ruby-dbus-unbundle-files-from-activesupport.patch
new file mode 100644
index 0000000..893ec19
--- /dev/null
+++ b/ruby-dbus-unbundle-files-from-activesupport.patch
@@ -0,0 +1,206 @@
+From 65615521832c557f0f337003674ba1d45009dea7 Mon Sep 17 00:00:00 2001
+From: Bohuslav Kabrda <bkabrda at redhat.com>
+Date: Wed, 29 Feb 2012 10:02:25 +0100
+Subject: [PATCH] Unbundle files from activesupport
+
+---
+ lib/dbus.rb                                 |    1 -
+ lib/dbus/core_ext/class/attribute.rb        |   91 ---------------------------
+ lib/dbus/core_ext/kernel/singleton_class.rb |   14 ----
+ lib/dbus/core_ext/module/remove_method.rb   |   12 ----
+ lib/dbus/export.rb                          |   22 ++++++-
+ 5 files changed, 21 insertions(+), 119 deletions(-)
+ delete mode 100644 lib/dbus/core_ext/class/attribute.rb
+ delete mode 100644 lib/dbus/core_ext/kernel/singleton_class.rb
+ delete mode 100644 lib/dbus/core_ext/module/remove_method.rb
+
+diff --git a/lib/dbus.rb b/lib/dbus.rb
+index bbb1b97..e49df8c 100644
+--- a/lib/dbus.rb
++++ b/lib/dbus.rb
+@@ -8,7 +8,6 @@
+ # License, version 2.1 as published by the Free Software Foundation.
+ # See the file "COPYING" for the exact licensing terms.
+ 
+-require 'dbus/core_ext/class/attribute'
+ require 'dbus/type'
+ require 'dbus/introspect'
+ require 'dbus/error'
+diff --git a/lib/dbus/core_ext/class/attribute.rb b/lib/dbus/core_ext/class/attribute.rb
+deleted file mode 100644
+index 3b9caa3..0000000
+--- a/lib/dbus/core_ext/class/attribute.rb
++++ /dev/null
+@@ -1,91 +0,0 @@
+-# copied from activesupport/core_ext from Rails, MIT license
+-require 'dbus/core_ext/kernel/singleton_class'
+-require 'dbus/core_ext/module/remove_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.
+-  #
+-  #   class Base
+-  #     class_attribute :setting
+-  #   end
+-  #
+-  #   class Subclass < Base
+-  #   end
+-  #
+-  #   Base.setting = true
+-  #   Subclass.setting            # => true
+-  #   Subclass.setting = false
+-  #   Subclass.setting            # => false
+-  #   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>
+-  # 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:
+-  #
+-  #   Base.setting = []
+-  #   Base.setting                # => []
+-  #   Subclass.setting            # => []
+-  #
+-  #   # Appending in child changes both parent and child because it is the same object:
+-  #   Subclass.setting << :foo
+-  #   Base.setting               # => [:foo]
+-  #   Subclass.setting           # => [:foo]
+-  #
+-  #   # Use setters to not propagate changes:
+-  #   Base.setting = []
+-  #   Subclass.setting += [:foo]
+-  #   Base.setting               # => []
+-  #   Subclass.setting           # => [:foo]
+-  #
+-  # For convenience, a query method is defined as well:
+-  #
+-  #   Subclass.setting?       # => false
+-  #
+-  # Instances may overwrite the class value in the same way:
+-  #
+-  #   Base.setting = true
+-  #   object = Base.new
+-  #   object.setting          # => true
+-  #   object.setting = false
+-  #   object.setting          # => false
+-  #   Base.setting            # => true
+-  #
+-  # To opt out of the instance writer method, pass :instance_writer => false.
+-  #
+-  #   object.setting = false  # => NoMethodError
+-  def class_attribute(*attrs)
+-    instance_writer = !attrs.last.is_a?(Hash) || attrs.pop[:instance_writer]
+-
+-    attrs.each do |name|
+-      class_eval <<-RUBY, __FILE__, __LINE__ + 1
+-        def self.#{name}() nil end
+-        def self.#{name}?() !!#{name} end
+-
+-        def self.#{name}=(val)
+-          singleton_class.class_eval do
+-            remove_possible_method(:#{name})
+-            define_method(:#{name}) { val }
+-          end
+-          val
+-        end
+-
+-        def #{name}
+-          defined?(@#{name}) ? @#{name} : singleton_class.#{name}
+-        end
+-
+-        def #{name}?
+-          !!#{name}
+-        end
+-      RUBY
+-
+-      attr_writer name if instance_writer
+-    end
+-  end
+-end
+diff --git a/lib/dbus/core_ext/kernel/singleton_class.rb b/lib/dbus/core_ext/kernel/singleton_class.rb
+deleted file mode 100644
+index 80cc00e..0000000
+--- a/lib/dbus/core_ext/kernel/singleton_class.rb
++++ /dev/null
+@@ -1,14 +0,0 @@
+-# copied from activesupport/core_ext from Rails, MIT license
+-module Kernel
+-  # Returns the object's singleton class.
+-  def singleton_class
+-    class << self
+-      self
+-    end
+-  end unless respond_to?(:singleton_class) # exists in 1.9.2
+-
+-  # 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 --git a/lib/dbus/core_ext/module/remove_method.rb b/lib/dbus/core_ext/module/remove_method.rb
+deleted file mode 100644
+index ef6a9ec..0000000
+--- a/lib/dbus/core_ext/module/remove_method.rb
++++ /dev/null
+@@ -1,12 +0,0 @@
+-# copied from activesupport/core_ext from Rails, MIT license
+-class Module
+-  def remove_possible_method(method)
+-    remove_method(method)
+-  rescue NameError
+-  end
+-
+-  def redefine_method(method, &block)
+-    remove_possible_method(method)
+-    define_method(method, &block)
+-  end
+-end
+diff --git a/lib/dbus/export.rb b/lib/dbus/export.rb
+index cb79d26..4490e3b 100644
+--- a/lib/dbus/export.rb
++++ b/lib/dbus/export.rb
+@@ -20,7 +20,7 @@ module DBus
+     # The path of the object.
+     attr_reader :path
+     # The interfaces that the object supports. Hash: String => Interface
+-    class_attribute :intfs
++    @@intfs_hash = {DBus::Object => nil}
+     # The service that the object is exported by.
+     attr_writer :service
+ 
+@@ -34,6 +34,26 @@ module DBus
+       @service = nil
+     end
+ 
++    def self.intfs
++      if self.equal? DBus::Object
++        @@intfs_hash[DBus::Object]
++      else
++        @@intfs_hash[self] || self.superclass.intfs
++      end
++    end
++
++    def self.intfs= param
++      @@intfs_hash[self] = param
++    end
++
++    def intfs
++      self.class.intfs
++    end
++
++    def intfs= param
++      self.class.intfs = param
++    end
++
+     # State that the object implements the given _intf_.
+     def implements(intf)
+       # use a setter
+-- 
+1.7.9.1
+
diff --git a/rubygem-ruby-dbus.spec b/rubygem-ruby-dbus.spec
new file mode 100644
index 0000000..970d594
--- /dev/null
+++ b/rubygem-ruby-dbus.spec
@@ -0,0 +1,92 @@
+# Generated from ruby-dbus-0.7.0.gem by gem2rpm -*- rpm-spec -*-
+%global gem_name ruby-dbus
+%global rubyabi 1.9.1
+
+Summary: Ruby module for interaction with D-Bus
+Name: rubygem-%{gem_name}
+Version: 0.7.0
+Release: 2%{?dist}
+Group: Development/Languages
+License: LGPLv2+
+URL: https://trac.luon.net/ruby-dbus
+Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
+# Accepted by upstream: https://github.com/mvidner/ruby-dbus/pull/18
+Patch0: %{gem_name}-unbundle-files-from-activesupport.patch
+Requires: ruby(abi) = %{rubyabi}
+Requires: ruby(rubygems)
+BuildRequires: ruby(abi) = %{rubyabi}
+BuildRequires: rubygems-devel
+BuildRequires: rubygem(minitest)
+BuildArch: noarch
+Provides: rubygem(%{gem_name}) = %{version}
+# Obsolete ruby-dbus
+Provides: ruby(dbus) = %{version}
+Provides: ruby-dbus = %{version}-%{release}
+Obsoletes: ruby(dbus) <= 0.3.0
+Obsoletes: ruby-dbus < 0.3.0-5
+
+%description
+Ruby D-Bus provides an implementation of the D-Bus protocol such that the
+D-Bus system can be used in the Ruby programming language.
+
+
+%package doc
+Summary: Documentation for %{name}
+Group: Documentation
+Requires: %{name} = %{version}-%{release}
+BuildArch: noarch
+
+%description doc
+Documentation for %{name}
+
+%prep
+%setup -q -c -T
+mkdir -p .%{gem_dir}
+gem install --local --install-dir .%{gem_dir} \
+            --force %{SOURCE0}
+
+# fix rpmlint issue with Rakefile (should not have shebang)
+sed -i '1d' .%{gem_instdir}/Rakefile
+
+pushd .%{gem_instdir}
+%patch0 -p1
+popd
+
+%build
+
+%install
+mkdir -p %{buildroot}%{gem_dir}
+cp -a .%{gem_dir}/* \
+        %{buildroot}%{gem_dir}/
+
+%check
+pushd .%{gem_instdir}/test
+RUBYOPT="-I../lib" ./test_env testrb *_test.rb t[0-9]*.rb
+popd
+
+%files
+%dir %{gem_instdir}
+%doc %{gem_instdir}/COPYING
+%{gem_libdir}
+%exclude %{gem_cache}
+%{gem_spec}
+
+%files doc
+%doc %{gem_docdir}
+%doc %{gem_instdir}/README
+%doc %{gem_instdir}/NEWS
+%doc %{gem_instdir}/VERSION
+%doc %{gem_instdir}/doc
+%doc %{gem_instdir}/examples
+%{gem_instdir}/Rakefile
+%{gem_instdir}/%{gem_name}.gemspec
+%{gem_instdir}/test
+
+%changelog
+* Tue Feb 28 2012 Bohuslav Kabrda <bkabrda at redhat.com> - 0.7.0-2
+- Simplified the test running.
+- Properly obsolete ruby-dbus.
+- Applied the patch that unbundles files from activesupport (accepted by upstream).
+
+* Tue Feb 28 2012 Bohuslav Kabrda <bkabrda at redhat.com> - 0.7.0-1
+- Initial package
diff --git a/sources b/sources
index e69de29..ddc132b 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+1cc154474b779e0422c643828d2d99d1  ruby-dbus-0.7.0.gem


More information about the scm-commits mailing list