ruby-dbus 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/NEWS +9 -0
  4. data/Rakefile +13 -6
  5. data/VERSION +1 -1
  6. data/doc/Reference.md +42 -6
  7. data/examples/doc/README.md +4 -0
  8. data/examples/doc/_extract_examples +37 -0
  9. data/lib/dbus/bus.rb +11 -5
  10. data/ruby-dbus.gemspec +1 -1
  11. data/{test → spec}/async_spec.rb +0 -0
  12. data/{test → spec}/binding_spec.rb +5 -5
  13. data/{test → spec}/bus_and_xml_backend_spec.rb +0 -0
  14. data/spec/bus_driver_spec.rb +28 -0
  15. data/{test → spec}/bus_spec.rb +0 -0
  16. data/{test → spec}/byte_array_spec.rb +0 -0
  17. data/{test → spec}/err_msg_spec.rb +0 -0
  18. data/{test → spec}/introspect_xml_parser_spec.rb +0 -0
  19. data/{test → spec}/introspection_spec.rb +0 -0
  20. data/{test → spec}/main_loop_spec.rb +0 -0
  21. data/{test → spec}/property_spec.rb +0 -0
  22. data/{test → spec}/server_robustness_spec.rb +0 -0
  23. data/{test → spec}/server_spec.rb +3 -3
  24. data/{test → spec}/service_newapi.rb +0 -0
  25. data/{test → spec}/session_bus_spec_manual.rb +1 -1
  26. data/{test → spec}/signal_spec.rb +0 -0
  27. data/spec/spec_helper.rb +102 -0
  28. data/{test → spec}/thread_safety_spec.rb +0 -0
  29. data/{test → spec}/tools/dbus-launch-simple +1 -1
  30. data/{test → spec}/tools/dbus-limited-session.conf +0 -0
  31. data/{test → spec}/tools/test_env +4 -3
  32. data/{test → spec}/tools/test_server +0 -0
  33. data/{test → spec}/type_spec.rb +0 -0
  34. data/{test → spec}/value_spec.rb +0 -0
  35. data/{test → spec}/variant_spec.rb +0 -0
  36. metadata +37 -42
  37. data/doc/ex-calling-methods.body.rb +0 -8
  38. data/doc/ex-calling-methods.rb +0 -3
  39. data/doc/ex-properties.body.rb +0 -9
  40. data/doc/ex-properties.rb +0 -3
  41. data/doc/ex-setup.rb +0 -7
  42. data/doc/ex-signal.body.rb +0 -20
  43. data/doc/ex-signal.rb +0 -3
  44. data/doc/example-helper.rb +0 -6
  45. data/test/bus_driver_spec.rb +0 -20
  46. data/test/spec_helper.rb +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfbf7c6779ae43ca2e0d5774d391bd8bb785bcbf
4
- data.tar.gz: d8b52f014b2a5bc585099f601385a5bd27dd9ac4
3
+ metadata.gz: cc5578c5ae560c5c6a45df876f49b57d165ba04f
4
+ data.tar.gz: 3f6ae11937fb008b74c8ddfa208288b5d6b0e584
5
5
  SHA512:
6
- metadata.gz: 1aa32167272f9caa031a723efbef29b72197bfa3837eede6d5615f88f4e643d1a5520b31777bac39e545310bab6a2023b1ee619d65fb26a4b48bf4ec11767ac0
7
- data.tar.gz: 46cb2c144392a04aee1a718f75e1b2bebf22a1dd1bcee0efb3b262852dc8334578366a4e7e35568a9ceb127131b2f39e52e60690319a51448015fc4dd2f1401a
6
+ metadata.gz: d3c0e16681e04bac203929ba4470e68431a88318d6b07cf34b6219e9ff9b19dd922874387bb43c8378eee0909703466aebd78882de20b5aec02065b4ec16226c
7
+ data.tar.gz: 30cdab56d6793c7027b2bce10b75fd6b1a9c31395fea2b741deb85ce00d79dc02a97ad79187416adebb36c612562d9ae03dc1750be69914adde4f9f6b65c46e1
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --format doc
data/NEWS CHANGED
@@ -5,6 +5,15 @@ Note about bug numbers:
5
5
  Issue#1 - http://github.com/mvidner/ruby-dbus/issues#issue/1
6
6
  bnc#1 - https://bugzilla.novell.com/show_bug.cgi?id=1
7
7
 
8
+ == Ruby D-Bus 0.11.1 - 2016-05-12
9
+
10
+ Bug fixes:
11
+ * Fix default path finding on FreeBSD (Greg)
12
+ * Service#unexport fixed to really return the unexported object
13
+
14
+ Requirements:
15
+ * made tests compatible with RSpec 3
16
+
8
17
  == Ruby D-Bus 0.11.0 - 2014-02-17
9
18
 
10
19
  API:
data/Rakefile CHANGED
@@ -9,10 +9,11 @@ require "packaging"
9
9
 
10
10
  Packaging.configuration do |conf|
11
11
  conf.obs_project = "devel:languages:ruby:extensions"
12
+ conf.obs_target = "openSUSE_Tumbleweed"
12
13
  conf.package_name = "rubygem-ruby-dbus"
13
14
  conf.obs_sr_project = "openSUSE:Factory"
14
15
  conf.skip_license_check << /^[^\/]*$/
15
- conf.skip_license_check << /^(doc|examples|test)\/.*/
16
+ conf.skip_license_check << /^(doc|examples|spec)\/.*/
16
17
  # "Ruby on Rails is released under the MIT License."
17
18
  # but the files are missing copyright headers
18
19
  conf.skip_license_check << /^lib\/dbus\/core_ext\//
@@ -22,15 +23,12 @@ desc 'Default: run specs in the proper environment'
22
23
  task :default => :spec
23
24
  task :test => :spec
24
25
 
25
- RSpec::Core::RakeTask.new("bare:spec") do |t|
26
- t.pattern = "**/test/**/*_spec.rb"
27
- t.rspec_opts = "--color --format doc"
28
- end
26
+ RSpec::Core::RakeTask.new("bare:spec")
29
27
 
30
28
  %w(spec).each do |tname|
31
29
  desc "Run bare:#{tname} in the proper environment"
32
30
  task tname do |t|
33
- cd "test/tools" do
31
+ cd "spec/tools" do
34
32
  sh "./test_env rake bare:#{tname}"
35
33
  end
36
34
  end
@@ -56,3 +54,12 @@ task :tarball do |t|
56
54
  cp Dir.glob("#{temp}/*.gem"), "package"
57
55
  end
58
56
  end
57
+
58
+ namespace :doc do
59
+ desc "Extract code examples from doc/Reference.md to examples/doc"
60
+ task :examples do
61
+ cd "examples/doc" do
62
+ sh "./_extract_examples ../../doc/Reference.md"
63
+ end
64
+ end
65
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.0
1
+ 0.11.1
@@ -14,9 +14,11 @@ This section should be enough if you only want to consume DBus APIs.
14
14
 
15
15
  #### Setting Up
16
16
 
17
- The following code is assumed as a prolog to all following ones
17
+ Note that although the gem is named "ruby-dbus", the required name
18
+ is simply "dbus"
18
19
 
19
- {include:file:doc/ex-setup.rb}
20
+ #! /usr/bin/env ruby
21
+ require "dbus"
20
22
 
21
23
  #### Calling Methods
22
24
 
@@ -29,7 +31,15 @@ The following code is assumed as a prolog to all following ones
29
31
  ([I#28](https://github.com/mvidner/ruby-dbus/issues/28)).
30
32
  3. Call one of its methods in a loop, solving [xkcd#196](http://xkcd.com/196).
31
33
 
32
- {include:file:doc/ex-calling-methods.body.rb}
34
+ &nbsp;
35
+ mybus = DBus.session_bus
36
+ service = mybus['org.freedesktop.ScreenSaver']
37
+ object = service.object '/ScreenSaver'
38
+ object.introspect
39
+ loop do
40
+ object.SimulateUserActivity
41
+ sleep 5 * 60
42
+ end
33
43
 
34
44
  ##### Retrieving Return Values
35
45
 
@@ -38,7 +48,6 @@ accomodate the rare cases of a DBus method specifying more than one
38
48
  *out* parameter. For nearly all methods you should use `Method[0]` or
39
49
  `Method.first`
40
50
  ([I#30](https://github.com/mvidner/ruby-dbus/issues/30)).
41
-
42
51
 
43
52
  # wrong
44
53
  if upower_i.SuspendAllowed # [false] is true!
@@ -57,7 +66,15 @@ To access properties, think of the {DBus::ProxyObjectInterface interface} as a
57
66
  or use {DBus::ProxyObjectInterface#all_properties} to get
58
67
  an actual Hash of them.
59
68
 
60
- {include:file:doc/ex-properties.body.rb}
69
+ sysbus = DBus.system_bus
70
+ upower_s = sysbus['org.freedesktop.UPower']
71
+ upower_o = upower_s.object '/org/freedesktop/UPower'
72
+ upower_o.introspect
73
+ upower_i = upower_o['org.freedesktop.UPower']
74
+
75
+ on_battery = upower_i['OnBattery']
76
+
77
+ puts "Is the computer on battery now? #{on_battery}"
61
78
 
62
79
  (TODO a writable property example)
63
80
 
@@ -89,7 +106,26 @@ To receive signals for a specific object and interface, use
89
106
  {DBus::ProxyObjectInterface#on\_signal}(name, &block) or
90
107
  {DBus::ProxyObject#on_signal}(name, &block), for the default interface.
91
108
 
92
- {include:file:doc/ex-signal.body.rb}
109
+ sysbus = DBus.system_bus
110
+ login_s = sysbus['org.freedesktop.login1'] # part of systemd
111
+ login_o = login_s.object '/org/freedesktop/login1'
112
+ login_o.introspect
113
+ login_o.default_iface = 'org.freedesktop.login1.Manager'
114
+
115
+ # to trigger this signal, login on the Linux console
116
+ login_o.on_signal("SessionNew") do |name, opath|
117
+ puts "New session: #{name}"
118
+
119
+ session_o = login_s.object(opath)
120
+ session_o.introspect
121
+ session_i = session_o['org.freedesktop.login1.Session']
122
+ uid, user_opath = session_i['User']
123
+ puts "Its UID: #{uid}"
124
+ end
125
+
126
+ main = DBus::Main.new
127
+ main << sysbus
128
+ main.run
93
129
 
94
130
  ### Intermediate Concepts
95
131
  #### Names
@@ -0,0 +1,4 @@
1
+ This directory contains runnable examples
2
+ extracted from [the reference documentation](../../doc/Reference.md).
3
+
4
+ Run `rake doc:examples` to extract them.
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+ if ARGV[0].nil?
3
+ puts "Usage: #{$0} file.md"
4
+ exit
5
+ end
6
+
7
+ File.open(ARGV[0]) do |f|
8
+ title = nil
9
+ setup = ""
10
+ example = ""
11
+ f.each_line do |line|
12
+ case line
13
+ when /^#+ *(.*)/
14
+ new_title = $1
15
+
16
+ # write previous example
17
+ unless example.empty?
18
+ basename = title.downcase.gsub(/ +/, "_")
19
+ if basename == "setting_up"
20
+ setup = example
21
+ else
22
+ File.open("#{basename}.rb", "w") do |e|
23
+ e.write setup
24
+ e.write example
25
+ e.chmod(0755)
26
+ end
27
+ end
28
+ end
29
+
30
+ # set new
31
+ title = new_title
32
+ example = ""
33
+ when /^ (.*)/
34
+ example << $1 << "\n"
35
+ end
36
+ end
37
+ end
@@ -77,9 +77,9 @@ module DBus
77
77
  parent_node = get_node(parent_path, false)
78
78
  return false unless parent_node
79
79
  obj.service = nil
80
- parent_node.delete(node_name)
80
+ parent_node.delete(node_name).object
81
81
  end
82
-
82
+
83
83
  # Get the object node corresponding to the given _path_. if _create_ is
84
84
  # true, the the nodes in the path are created if they do not already exist.
85
85
  def get_node(path, create = false)
@@ -597,14 +597,20 @@ module DBus
597
597
  class ASessionBus < Connection
598
598
  # Get the the default session bus.
599
599
  def initialize
600
- super(ENV["DBUS_SESSION_BUS_ADDRESS"] || address_from_file || "launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET")
600
+ super(self.class.session_bus_address)
601
601
  send_hello
602
602
  end
603
603
 
604
- def address_from_file
604
+ def self.session_bus_address
605
+ ENV["DBUS_SESSION_BUS_ADDRESS"] ||
606
+ address_from_file ||
607
+ "launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET"
608
+ end
609
+
610
+ def self.address_from_file
605
611
  # systemd uses /etc/machine-id
606
612
  # traditional dbus uses /var/lib/dbus/machine-id
607
- machine_id_path = Dir['{/etc,/var/lib/dbus}/machine-id'].first
613
+ machine_id_path = Dir['{/etc,/var/lib/dbus,/var/db/dbus}/machine-id'].first
608
614
  return nil unless machine_id_path
609
615
  machine_id = File.read(machine_id_path).chomp
610
616
 
@@ -12,7 +12,7 @@ GEMSPEC = Gem::Specification.new do |s|
12
12
  s.author = "Ruby DBus Team"
13
13
  s.email = "ruby-dbus-devel@lists.luon.net"
14
14
  s.homepage = "https://trac.luon.net/ruby-dbus"
15
- s.files = FileList["{doc,examples,lib,test}/**/*", "COPYING", "NEWS", "Rakefile", "README.md", "ruby-dbus.gemspec", "VERSION"].to_a.sort
15
+ s.files = FileList["{doc,examples,lib,spec}/**/*", "COPYING", "NEWS", "Rakefile", "README.md", "ruby-dbus.gemspec", "VERSION", ".rspec"].to_a.sort
16
16
  s.require_path = "lib"
17
17
  s.required_ruby_version = ">= 1.9.3"
18
18
  s.add_development_dependency("packaging_rake_tasks")
File without changes
@@ -52,11 +52,11 @@ describe "BindingTest" do
52
52
  expect(e.message).to match(/failed as designed/)
53
53
  end
54
54
  end
55
-
55
+
56
56
  it "tests dynamic interface definition" do
57
57
  # interfaces can be defined dynamicaly
58
58
  derived = DBus::Object.new "/org/ruby/MyDerivedInstance"
59
-
59
+
60
60
  #define a new interface
61
61
  derived.singleton_class.instance_eval do
62
62
  dbus_interface "org.ruby.DynamicInterface" do
@@ -65,10 +65,10 @@ describe "BindingTest" do
65
65
  end
66
66
  end
67
67
  end
68
-
68
+
69
69
  # the object should have the new iface
70
70
  ifaces = derived.intfs
71
- expect(ifaces && ifaces.include?("org.ruby.DynamicInterface")).to be_true
71
+ expect(ifaces).to include "org.ruby.DynamicInterface"
72
72
  end
73
-
73
+
74
74
  end
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env rspec
2
+ require_relative "spec_helper"
3
+ require "dbus"
4
+
5
+ describe DBus::Service do
6
+ context "when a private bus is set up" do
7
+ around(:each) do |example|
8
+ with_private_bus do
9
+ with_service_by_activation(&example)
10
+ end
11
+ end
12
+
13
+ let(:bus) { DBus::ASessionBus.new }
14
+
15
+ describe "#exists?" do
16
+ it "is true for an existing service" do
17
+ svc = bus.service("org.ruby.service")
18
+ svc.object("/").introspect # must activate the service first :-/
19
+ expect(svc.exists?).to be true
20
+ end
21
+
22
+ it "is false for a nonexisting service" do
23
+ svc = bus.service("org.ruby.nosuchservice")
24
+ expect(svc.exists?).to be false
25
+ end
26
+ end
27
+ end
28
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -36,18 +36,18 @@ describe "ServerTest" do
36
36
  it "tests unexporting an object" do
37
37
  obj = Foo.new "/org/ruby/Foo"
38
38
  @svc.export obj
39
- expect(@svc.unexport(obj)).to be_true
39
+ expect(@svc.unexport(obj)).to be_a DBus::Object
40
40
  end
41
41
 
42
42
  it "tests unexporting an object not exported" do
43
43
  obj = Foo.new "/org/ruby/Foo"
44
- expect(@svc.unexport(obj)).to be_false
44
+ expect(@svc.unexport(obj)).to be false
45
45
  end
46
46
 
47
47
  it "tests emiting signals" do
48
48
  obj = Foo.new "/org/ruby/Foo"
49
49
  @svc.export obj
50
- obj.signal_without_arguments
50
+ obj.signal_without_arguments
51
51
  obj.signal_with_argument(-0.1)
52
52
  end
53
53
  end
File without changes
@@ -9,7 +9,7 @@ describe DBus::ASessionBus do
9
9
  it "can connect" do
10
10
  bus = DBus::ASessionBus.new
11
11
  svc = bus.service("org.freedesktop.DBus")
12
- expect(svc.exists?).to be_true
12
+ expect(svc.exists?).to be true
13
13
  end
14
14
  end
15
15
  end
File without changes
@@ -0,0 +1,102 @@
1
+ if ENV["COVERAGE"]
2
+ coverage = ENV["COVERAGE"] == "true"
3
+ else
4
+ # heuristics: enable for interactive builds (but not in OBS) or in Travis
5
+ coverage = !!ENV["DISPLAY"] || ENV["TRAVIS"]
6
+ end
7
+
8
+ if coverage
9
+ require "simplecov"
10
+ SimpleCov.root File.expand_path("../..", __FILE__)
11
+
12
+ # do not cover specs
13
+ SimpleCov.add_filter "_spec.rb"
14
+ # do not cover the activesupport helpers
15
+ SimpleCov.add_filter "/core_ext/"
16
+
17
+ # use coveralls for on-line code coverage reporting at Travis CI
18
+ if ENV["TRAVIS"]
19
+ require "coveralls"
20
+ end
21
+ SimpleCov.start
22
+ end
23
+
24
+ $:.unshift File.expand_path("../../lib", __FILE__)
25
+
26
+ if Object.const_defined? "RSpec"
27
+ # http://betterspecs.org/#expect
28
+ RSpec.configure do |config|
29
+ config.expect_with :rspec do |c|
30
+ c.syntax = :expect
31
+ end
32
+ end
33
+ end
34
+
35
+ require "tempfile"
36
+ require "timeout"
37
+
38
+ TOPDIR = File.expand_path("../..", __FILE__)
39
+
40
+ # path of config file for a private bus
41
+ def config_file_path
42
+ "#{TOPDIR}/spec/tools/dbus-limited-session.conf"
43
+ end
44
+
45
+ # set ENV[variable] to value and restore it after block is done
46
+ def with_env(variable, value, &block)
47
+ old_value = ENV[variable]
48
+ ENV[variable] = value
49
+ block.call
50
+ ENV[variable] = old_value
51
+ end
52
+
53
+ # Set up a private session bus and run *block* with that.
54
+ def with_private_bus(&block)
55
+ address_file = Tempfile.new("dbus-address")
56
+ pid_file = Tempfile.new("dbus-pid")
57
+ output_file = Tempfile.new("dbus-output") # just in case
58
+
59
+ $temp_dir = Dir.mktmpdir
60
+ with_env("XDG_DATA_DIRS", $temp_dir) do
61
+ cmd = "dbus-daemon --nofork --config-file=#{config_file_path} --print-address=3 3>#{address_file.path} --print-pid=4 4>#{pid_file.path} >#{output_file.path} 2>&1 &"
62
+ system cmd
63
+ end
64
+
65
+ # wait until dbus-daemon writes the info
66
+ Timeout.timeout(10) do
67
+ until File.size?(address_file) and File.size?(pid_file) do
68
+ sleep 0.1
69
+ end
70
+ end
71
+
72
+ address = address_file.read.chomp
73
+ pid = pid_file.read.chomp.to_i
74
+
75
+ with_env("DBUS_SESSION_BUS_ADDRESS", address) do
76
+ block.call
77
+ end
78
+
79
+ Process.kill("TERM", pid)
80
+ FileUtils.rm_rf $temp_dir
81
+ end
82
+
83
+ def with_service_by_activation(&block)
84
+ name = "org.ruby.service"
85
+ exec = "#{TOPDIR}/spec/service_newapi.rb"
86
+
87
+ service_dir = "#{$temp_dir}/dbus-1/services"
88
+ FileUtils.mkdir_p service_dir
89
+ # file name actually does not need to match the service name
90
+ File.open("#{service_dir}/#{name}.service", "w") do |f|
91
+ s = <<EOS
92
+ [D-BUS Service]
93
+ Name=#{name}
94
+ Exec=#{exec}
95
+ EOS
96
+ f.write(s)
97
+ end
98
+
99
+ block.call
100
+
101
+ system "pkill -f #{exec}"
102
+ end
File without changes
@@ -12,7 +12,7 @@ my_dbus_launch () {
12
12
  AF=`mktemp dbus.addr.XXXXXX` || exit
13
13
  RM_FILES="$RM_FILES $PF $AF"
14
14
 
15
- dbus-daemon --config-file=dbus-limited-session.conf --print-address=3 3>$AF --print-pid=4 4>$PF &
15
+ dbus-daemon --config-file=$(dirname $0)/dbus-limited-session.conf --print-address=3 3>$AF --print-pid=4 4>$PF &
16
16
  # wait for the daemon to print the info
17
17
  TRIES=0
18
18
  while [ ! -s $AF -o ! -s $PF ]; do
@@ -6,8 +6,9 @@
6
6
  #export DBUS_VERBOSE=1
7
7
  #export RUBYOPT="-d"
8
8
  export RUBYOPT="$RUBYOPT -w"
9
- ./test_server \
10
- ../service_newapi.rb \
9
+ DIR=$(dirname $0)
10
+ $DIR/test_server \
11
+ $DIR/../service_newapi.rb \
11
12
  -- \
12
- ./dbus-launch-simple \
13
+ $DIR/dbus-launch-simple \
13
14
  "$@"
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-dbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruby DBus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-17 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: packaging_rake_tasks
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Pure Ruby module for interaction with D-Bus IPC system
@@ -44,6 +44,7 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - ".rspec"
47
48
  - COPYING
48
49
  - NEWS
49
50
  - README.md
@@ -51,14 +52,8 @@ files:
51
52
  - VERSION
52
53
  - doc/Reference.md
53
54
  - doc/Tutorial.md
54
- - doc/ex-calling-methods.body.rb
55
- - doc/ex-calling-methods.rb
56
- - doc/ex-properties.body.rb
57
- - doc/ex-properties.rb
58
- - doc/ex-setup.rb
59
- - doc/ex-signal.body.rb
60
- - doc/ex-signal.rb
61
- - doc/example-helper.rb
55
+ - examples/doc/README.md
56
+ - examples/doc/_extract_examples
62
57
  - examples/gdbus/gdbus
63
58
  - examples/gdbus/gdbus.glade
64
59
  - examples/gdbus/launch.sh
@@ -92,31 +87,31 @@ files:
92
87
  - lib/dbus/type.rb
93
88
  - lib/dbus/xml.rb
94
89
  - ruby-dbus.gemspec
95
- - test/async_spec.rb
96
- - test/binding_spec.rb
97
- - test/bus_and_xml_backend_spec.rb
98
- - test/bus_driver_spec.rb
99
- - test/bus_spec.rb
100
- - test/byte_array_spec.rb
101
- - test/err_msg_spec.rb
102
- - test/introspect_xml_parser_spec.rb
103
- - test/introspection_spec.rb
104
- - test/main_loop_spec.rb
105
- - test/property_spec.rb
106
- - test/server_robustness_spec.rb
107
- - test/server_spec.rb
108
- - test/service_newapi.rb
109
- - test/session_bus_spec_manual.rb
110
- - test/signal_spec.rb
111
- - test/spec_helper.rb
112
- - test/thread_safety_spec.rb
113
- - test/tools/dbus-launch-simple
114
- - test/tools/dbus-limited-session.conf
115
- - test/tools/test_env
116
- - test/tools/test_server
117
- - test/type_spec.rb
118
- - test/value_spec.rb
119
- - test/variant_spec.rb
90
+ - spec/async_spec.rb
91
+ - spec/binding_spec.rb
92
+ - spec/bus_and_xml_backend_spec.rb
93
+ - spec/bus_driver_spec.rb
94
+ - spec/bus_spec.rb
95
+ - spec/byte_array_spec.rb
96
+ - spec/err_msg_spec.rb
97
+ - spec/introspect_xml_parser_spec.rb
98
+ - spec/introspection_spec.rb
99
+ - spec/main_loop_spec.rb
100
+ - spec/property_spec.rb
101
+ - spec/server_robustness_spec.rb
102
+ - spec/server_spec.rb
103
+ - spec/service_newapi.rb
104
+ - spec/session_bus_spec_manual.rb
105
+ - spec/signal_spec.rb
106
+ - spec/spec_helper.rb
107
+ - spec/thread_safety_spec.rb
108
+ - spec/tools/dbus-launch-simple
109
+ - spec/tools/dbus-limited-session.conf
110
+ - spec/tools/test_env
111
+ - spec/tools/test_server
112
+ - spec/type_spec.rb
113
+ - spec/value_spec.rb
114
+ - spec/variant_spec.rb
120
115
  homepage: https://trac.luon.net/ruby-dbus
121
116
  licenses:
122
117
  - LGPL v2.1
@@ -127,17 +122,17 @@ require_paths:
127
122
  - lib
128
123
  required_ruby_version: !ruby/object:Gem::Requirement
129
124
  requirements:
130
- - - '>='
125
+ - - ">="
131
126
  - !ruby/object:Gem::Version
132
127
  version: 1.9.3
133
128
  required_rubygems_version: !ruby/object:Gem::Requirement
134
129
  requirements:
135
- - - '>='
130
+ - - ">="
136
131
  - !ruby/object:Gem::Version
137
132
  version: '0'
138
133
  requirements: []
139
134
  rubyforge_project:
140
- rubygems_version: 2.0.3
135
+ rubygems_version: 2.2.2
141
136
  signing_key:
142
137
  specification_version: 4
143
138
  summary: Ruby module for interaction with D-Bus
@@ -1,8 +0,0 @@
1
- mybus = DBus.session_bus
2
- service = mybus['org.freedesktop.ScreenSaver']
3
- object = service.object '/ScreenSaver'
4
- object.introspect
5
- loop do
6
- object.SimulateUserActivity
7
- sleep 5 * 60
8
- end
@@ -1,3 +0,0 @@
1
- #! /usr/bin/env ruby
2
- require 'example-helper.rb'
3
- example 'ex-calling-methods.body.rb'
@@ -1,9 +0,0 @@
1
- sysbus = DBus.system_bus
2
- upower_s = sysbus['org.freedesktop.UPower']
3
- upower_o = upower_s.object '/org/freedesktop/UPower'
4
- upower_o.introspect
5
- upower_i = upower_o['org.freedesktop.UPower']
6
-
7
- on_battery = upower_i['OnBattery']
8
-
9
- puts "Is the computer on battery now? #{on_battery}"
@@ -1,3 +0,0 @@
1
- #! /usr/bin/env ruby
2
- require 'example-helper.rb'
3
- example 'ex-properties.body.rb'
@@ -1,7 +0,0 @@
1
- #! /usr/bin/env ruby
2
- require 'rubygems' # Not needed since Ruby 1.9
3
- require 'dbus' # The gem is 'ruby-dbus' but the require is 'dbus'
4
-
5
- # Connect to a well-known address. Most apps need only one of them.
6
- mybus = DBus.session_bus
7
- sysbus = DBus.system_bus
@@ -1,20 +0,0 @@
1
- sysbus = DBus.system_bus
2
- login_s = sysbus['org.freedesktop.login1'] # part of systemd
3
- login_o = login_s.object '/org/freedesktop/login1'
4
- login_o.introspect
5
- login_o.default_iface = 'org.freedesktop.login1.Manager'
6
-
7
- # to trigger this signal, login on the Linux console
8
- login_o.on_signal("SessionNew") do |name, opath|
9
- puts "New session: #{name}"
10
-
11
- session_o = login_s.object(opath)
12
- session_o.introspect
13
- session_i = session_o['org.freedesktop.login1.Session']
14
- uid, user_opath = session_i['User']
15
- puts "Its UID: #{uid}"
16
- end
17
-
18
- main = DBus::Main.new
19
- main << sysbus
20
- main.run
@@ -1,3 +0,0 @@
1
- #! /usr/bin/env ruby
2
- require 'example-helper.rb'
3
- example 'ex-signal.body.rb'
@@ -1,6 +0,0 @@
1
- # Fin
2
- $:.unshift File.expand_path("../../lib", __FILE__)
3
- load 'ex-setup.rb'
4
- def example(filename)
5
- eval(File.read(filename), binding, filename, 1)
6
- end
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env rspec
2
- require_relative "spec_helper"
3
- require "dbus"
4
-
5
- describe DBus::Service do
6
- let(:bus) { DBus::ASessionBus.new }
7
-
8
- describe "#exists?" do
9
- it "is true for an existing service" do
10
- svc = bus.service("org.ruby.service")
11
- svc.object("/").introspect # must activate the service first :-/
12
- expect(svc.exists?).to be_true
13
- end
14
-
15
- it "is false for a nonexisting service" do
16
- svc = bus.service("org.ruby.nosuchservice")
17
- expect(svc.exists?).to be_false
18
- end
19
- end
20
- end
@@ -1,33 +0,0 @@
1
- if ENV["COVERAGE"]
2
- coverage = ENV["COVERAGE"] == "true"
3
- else
4
- # heuristics: enable for interactive builds (but not in OBS) or in Travis
5
- coverage = !!ENV["DISPLAY"] || ENV["TRAVIS"]
6
- end
7
-
8
- if coverage
9
- require "simplecov"
10
- SimpleCov.root File.expand_path("../..", __FILE__)
11
-
12
- # do not cover specs
13
- SimpleCov.add_filter "_spec.rb"
14
- # do not cover the activesupport helpers
15
- SimpleCov.add_filter "/core_ext/"
16
-
17
- # use coveralls for on-line code coverage reporting at Travis CI
18
- if ENV["TRAVIS"]
19
- require "coveralls"
20
- end
21
- SimpleCov.start
22
- end
23
-
24
- $:.unshift File.expand_path("../../lib", __FILE__)
25
-
26
- if Object.const_defined? "RSpec"
27
- # http://betterspecs.org/#expect
28
- RSpec.configure do |config|
29
- config.expect_with :rspec do |c|
30
- c.syntax = :expect
31
- end
32
- end
33
- end