ruby-dbus 0.17.0 → 0.18.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +15 -0
- data/README.md +1 -1
- data/Rakefile +3 -11
- data/VERSION +1 -1
- data/doc/Reference.md +9 -2
- data/examples/doc/_extract_examples +2 -0
- data/examples/gdbus/gdbus +11 -5
- data/examples/no-introspect/nm-test.rb +2 -0
- data/examples/no-introspect/tracker-test.rb +3 -1
- data/examples/rhythmbox/playpause.rb +2 -1
- data/examples/service/call_service.rb +1 -0
- data/examples/service/service_newapi.rb +1 -1
- data/examples/simple/call_introspect.rb +1 -0
- data/examples/simple/get_id.rb +2 -1
- data/examples/simple/properties.rb +2 -0
- data/examples/utils/listnames.rb +1 -0
- data/examples/utils/notify.rb +1 -0
- data/lib/dbus/api_options.rb +9 -0
- data/lib/dbus/auth.rb +12 -7
- data/lib/dbus/bus.rb +114 -70
- data/lib/dbus/bus_name.rb +12 -8
- data/lib/dbus/error.rb +4 -2
- data/lib/dbus/introspect.rb +29 -18
- data/lib/dbus/logger.rb +3 -1
- data/lib/dbus/marshall.rb +118 -86
- data/lib/dbus/matchrule.rb +16 -16
- data/lib/dbus/message.rb +40 -27
- data/lib/dbus/message_queue.rb +10 -5
- data/lib/dbus/object.rb +34 -13
- data/lib/dbus/object_path.rb +9 -5
- data/lib/dbus/proxy_object.rb +18 -4
- data/lib/dbus/proxy_object_factory.rb +11 -7
- data/lib/dbus/proxy_object_interface.rb +26 -22
- data/lib/dbus/type.rb +41 -34
- data/lib/dbus/xml.rb +28 -17
- data/lib/dbus.rb +7 -7
- data/ruby-dbus.gemspec +4 -2
- data/spec/async_spec.rb +2 -0
- data/spec/binding_spec.rb +2 -0
- data/spec/bus_and_xml_backend_spec.rb +2 -0
- data/spec/bus_driver_spec.rb +2 -0
- data/spec/bus_name_spec.rb +3 -1
- data/spec/bus_spec.rb +2 -0
- data/spec/byte_array_spec.rb +2 -0
- data/spec/client_robustness_spec.rb +4 -2
- data/spec/err_msg_spec.rb +2 -0
- data/spec/introspect_xml_parser_spec.rb +2 -0
- data/spec/introspection_spec.rb +2 -0
- data/spec/main_loop_spec.rb +2 -0
- data/spec/node_spec.rb +23 -0
- data/spec/object_path_spec.rb +2 -0
- data/spec/property_spec.rb +11 -2
- data/spec/proxy_object_spec.rb +2 -0
- data/spec/server_robustness_spec.rb +2 -0
- data/spec/server_spec.rb +2 -0
- data/spec/service_newapi.rb +19 -4
- data/spec/session_bus_spec.rb +3 -1
- data/spec/session_bus_spec_manual.rb +2 -0
- data/spec/signal_spec.rb +2 -0
- data/spec/spec_helper.rb +5 -3
- data/spec/thread_safety_spec.rb +2 -0
- data/spec/type_spec.rb +2 -0
- data/spec/value_spec.rb +16 -1
- data/spec/variant_spec.rb +4 -2
- metadata +8 -7
data/ruby-dbus.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -*- ruby -*-
|
2
4
|
require "rubygems"
|
3
5
|
|
@@ -18,7 +20,7 @@ GEMSPEC = Gem::Specification.new do |s|
|
|
18
20
|
]
|
19
21
|
s.require_path = "lib"
|
20
22
|
|
21
|
-
s.required_ruby_version = ">= 2.
|
23
|
+
s.required_ruby_version = ">= 2.4.0"
|
22
24
|
|
23
25
|
s.add_dependency "rexml"
|
24
26
|
|
@@ -28,7 +30,7 @@ GEMSPEC = Gem::Specification.new do |s|
|
|
28
30
|
s.add_development_dependency "packaging_rake_tasks"
|
29
31
|
s.add_development_dependency "rake"
|
30
32
|
s.add_development_dependency "rspec", "~> 3"
|
31
|
-
s.add_development_dependency "rubocop", "=
|
33
|
+
s.add_development_dependency "rubocop", "= 1.0"
|
32
34
|
s.add_development_dependency "simplecov"
|
33
35
|
s.add_development_dependency "simplecov-lcov"
|
34
36
|
end
|
data/spec/async_spec.rb
CHANGED
data/spec/binding_spec.rb
CHANGED
data/spec/bus_driver_spec.rb
CHANGED
data/spec/bus_name_spec.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require_relative "spec_helper"
|
3
5
|
require "dbus"
|
4
6
|
|
@@ -17,7 +19,7 @@ describe DBus::BusName do
|
|
17
19
|
expect(described_class.valid?("Empty.Last.Component.")).to be_falsey
|
18
20
|
expect(described_class.valid?("Invalid.Ch@r@cter")).to be_falsey
|
19
21
|
expect(described_class.valid?("/Invalid-Character")).to be_falsey
|
20
|
-
long_name = "a
|
22
|
+
long_name = "a.#{"long." * 100}name"
|
21
23
|
expect(described_class.valid?(long_name)).to be_falsey
|
22
24
|
expect(described_class.valid?("org.7_zip.Archiver")).to be_falsey
|
23
25
|
end
|
data/spec/bus_spec.rb
CHANGED
data/spec/byte_array_spec.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
# Test that a client survives various error cases
|
3
5
|
require_relative "spec_helper"
|
4
6
|
require "dbus"
|
@@ -12,14 +14,14 @@ describe "ClientRobustnessTest" do
|
|
12
14
|
context "when the bus name is invalid" do
|
13
15
|
it "tells the user the bus name is invalid" do
|
14
16
|
# user mistake, should be "org.ruby.service"
|
15
|
-
expect { @bus.service(".org.ruby.service") }.to raise_error(DBus::Error)
|
17
|
+
expect { @bus.service(".org.ruby.service") }.to raise_error(DBus::Error, /Invalid bus name/)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
21
|
context "when the object path is invalid" do
|
20
22
|
it "tells the user the path is invalid" do
|
21
23
|
# user mistake, should be "/org/ruby/MyInstance"
|
22
|
-
expect { @svc.object("org.ruby.MyInstance") }.to raise_error(DBus::Error)
|
24
|
+
expect { @svc.object("org.ruby.MyInstance") }.to raise_error(DBus::Error, /Invalid object path/)
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
data/spec/err_msg_spec.rb
CHANGED
data/spec/introspection_spec.rb
CHANGED
data/spec/main_loop_spec.rb
CHANGED
data/spec/node_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "spec_helper"
|
5
|
+
require "dbus"
|
6
|
+
|
7
|
+
describe DBus::Node do
|
8
|
+
describe "#inspect" do
|
9
|
+
# the behavior needs improvement
|
10
|
+
it "shows the node, poorly" do
|
11
|
+
parent = described_class.new("parent")
|
12
|
+
parent.object = DBus::Object.new("/parent")
|
13
|
+
|
14
|
+
3.times do |i|
|
15
|
+
child_name = "child#{i}"
|
16
|
+
child = described_class.new(child_name)
|
17
|
+
parent[child_name] = child
|
18
|
+
end
|
19
|
+
|
20
|
+
expect(parent.inspect).to match(/<DBus::Node [0-9a-f]+ {child0 => {},child1 => {},child2 => {}}>/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/object_path_spec.rb
CHANGED
data/spec/property_spec.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require_relative "spec_helper"
|
3
5
|
require "dbus"
|
4
6
|
|
@@ -50,7 +52,7 @@ describe "PropertyTest" do
|
|
50
52
|
|
51
53
|
it "tests get all" do
|
52
54
|
all = @iface.all_properties
|
53
|
-
expect(all.keys.sort).to eq(["ReadMe", "ReadOrWriteMe"])
|
55
|
+
expect(all.keys.sort).to eq(["MyStruct", "ReadMe", "ReadOrWriteMe"])
|
54
56
|
end
|
55
57
|
|
56
58
|
it "tests get all on a V1 object" do
|
@@ -58,7 +60,7 @@ describe "PropertyTest" do
|
|
58
60
|
iface = obj["org.ruby.SampleInterface"]
|
59
61
|
|
60
62
|
all = iface.all_properties
|
61
|
-
expect(all.keys.sort).to eq(["ReadMe", "ReadOrWriteMe"])
|
63
|
+
expect(all.keys.sort).to eq(["MyStruct", "ReadMe", "ReadOrWriteMe"])
|
62
64
|
end
|
63
65
|
|
64
66
|
it "tests unknown property reading" do
|
@@ -114,4 +116,11 @@ describe "PropertyTest" do
|
|
114
116
|
|
115
117
|
expect(received["ReadOrWriteMe"]).to eq("VALUE")
|
116
118
|
end
|
119
|
+
|
120
|
+
context "a struct-typed property" do
|
121
|
+
it "gets read as a struct, not an array (#97)" do
|
122
|
+
struct = @iface["MyStruct"]
|
123
|
+
expect(struct).to be_frozen
|
124
|
+
end
|
125
|
+
end
|
117
126
|
end
|
data/spec/proxy_object_spec.rb
CHANGED
data/spec/server_spec.rb
CHANGED
data/spec/service_newapi.rb
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require_relative "spec_helper"
|
5
5
|
SimpleCov.command_name "Service Tests" if Object.const_defined? "SimpleCov"
|
6
6
|
# find the library without external help
|
7
|
-
$LOAD_PATH.unshift File.expand_path("
|
7
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
8
8
|
|
9
9
|
require "dbus"
|
10
10
|
|
11
|
-
PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"
|
11
|
+
PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"
|
12
12
|
|
13
13
|
class Test < DBus::Object
|
14
|
-
|
14
|
+
Point2D = Struct.new(:x, :y)
|
15
|
+
|
16
|
+
INTERFACE = "org.ruby.SampleInterface"
|
15
17
|
def initialize(path)
|
16
18
|
super path
|
17
19
|
@read_me = "READ ME"
|
18
20
|
@read_or_write_me = "READ OR WRITE ME"
|
21
|
+
@my_struct = ["three", "strings", "in a struct"].freeze
|
19
22
|
end
|
20
23
|
|
21
24
|
# Create an interface aggregating all upcoming dbus_method defines.
|
@@ -60,6 +63,16 @@ class Test < DBus::Object
|
|
60
63
|
[bytes]
|
61
64
|
end
|
62
65
|
|
66
|
+
dbus_method :Coordinates, "out coords:(dd)" do
|
67
|
+
coords = [3.0, 4.0].freeze
|
68
|
+
[coords]
|
69
|
+
end
|
70
|
+
|
71
|
+
dbus_method :Coordinates2, "out coords:(dd)" do
|
72
|
+
coords = Point2D.new(5.0, 12.0)
|
73
|
+
[coords]
|
74
|
+
end
|
75
|
+
|
63
76
|
# Properties:
|
64
77
|
# ReadMe:string, returns "READ ME" at first, then what WriteMe received
|
65
78
|
# WriteMe:string
|
@@ -79,6 +92,8 @@ class Test < DBus::Object
|
|
79
92
|
raise "Something failed"
|
80
93
|
end
|
81
94
|
dbus_reader :explosive, "s"
|
95
|
+
|
96
|
+
dbus_attr_reader :my_struct, "(sss)"
|
82
97
|
end
|
83
98
|
|
84
99
|
# closing and reopening the same interface
|
data/spec/session_bus_spec.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require_relative "spec_helper"
|
3
5
|
require "dbus"
|
4
6
|
|
@@ -23,7 +25,7 @@ describe DBus::ASessionBus do
|
|
23
25
|
|
24
26
|
before do
|
25
27
|
# mocks of files for address_from_file method
|
26
|
-
machine_id_path = File.expand_path("/etc/machine-id",
|
28
|
+
machine_id_path = File.expand_path("/etc/machine-id", __dir__)
|
27
29
|
expect(Dir).to receive(:[]).with(any_args) { [machine_id_path] }
|
28
30
|
expect(File).to receive(:read).with(machine_id_path) { "baz" }
|
29
31
|
expect(File).to receive(:exist?).with(session_bus_file_path) { true }
|
data/spec/signal_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
coverage = if ENV["COVERAGE"]
|
2
4
|
ENV["COVERAGE"] == "true"
|
3
5
|
else
|
@@ -7,7 +9,7 @@ coverage = if ENV["COVERAGE"]
|
|
7
9
|
|
8
10
|
if coverage
|
9
11
|
require "simplecov"
|
10
|
-
SimpleCov.root File.expand_path("
|
12
|
+
SimpleCov.root File.expand_path("..", __dir__)
|
11
13
|
|
12
14
|
# do not cover specs
|
13
15
|
SimpleCov.add_filter "_spec.rb"
|
@@ -34,7 +36,7 @@ if coverage
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
$LOAD_PATH.unshift File.expand_path("
|
39
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
38
40
|
|
39
41
|
if Object.const_defined? "RSpec"
|
40
42
|
# http://betterspecs.org/#expect
|
@@ -48,7 +50,7 @@ end
|
|
48
50
|
require "tempfile"
|
49
51
|
require "timeout"
|
50
52
|
|
51
|
-
TOPDIR = File.expand_path("
|
53
|
+
TOPDIR = File.expand_path("..", __dir__)
|
52
54
|
|
53
55
|
# path of config file for a private bus
|
54
56
|
def config_file_path
|
data/spec/thread_safety_spec.rb
CHANGED
data/spec/type_spec.rb
CHANGED
data/spec/value_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
3
4
|
require_relative "spec_helper"
|
4
5
|
require "dbus"
|
5
6
|
|
@@ -91,4 +92,18 @@ describe "ValueTest" do
|
|
91
92
|
it "aligns short integers correctly" do
|
92
93
|
expect(@obj.i16_plus(10, -30)[0]).to eq(-20)
|
93
94
|
end
|
95
|
+
|
96
|
+
context "structs" do
|
97
|
+
it "they are returned as FROZEN arrays" do
|
98
|
+
struct = @obj.Coordinates[0]
|
99
|
+
expect(struct).to be_an(Array)
|
100
|
+
expect(struct).to be_frozen
|
101
|
+
end
|
102
|
+
|
103
|
+
it "they are returned also from structs" do
|
104
|
+
struct = @obj.Coordinates2[0]
|
105
|
+
expect(struct).to be_an(Array)
|
106
|
+
expect(struct).to be_frozen
|
107
|
+
end
|
108
|
+
end
|
94
109
|
end
|
data/spec/variant_spec.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
# Test marshalling variants according to ruby types
|
3
5
|
require_relative "spec_helper"
|
4
6
|
require "dbus"
|
@@ -9,8 +11,8 @@ describe "VariantTest" do
|
|
9
11
|
@svc = @bus.service("org.ruby.service")
|
10
12
|
end
|
11
13
|
|
12
|
-
def make_variant(
|
13
|
-
DBus::PacketMarshaller.make_variant(
|
14
|
+
def make_variant(val)
|
15
|
+
DBus::PacketMarshaller.make_variant(val)
|
14
16
|
end
|
15
17
|
|
16
18
|
it "tests make variant scalar" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-dbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0.beta1
|
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: 2022-02-
|
11
|
+
date: 2022-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '1.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- spec/introspect_xml_parser_spec.rb
|
172
172
|
- spec/introspection_spec.rb
|
173
173
|
- spec/main_loop_spec.rb
|
174
|
+
- spec/node_spec.rb
|
174
175
|
- spec/object_path_spec.rb
|
175
176
|
- spec/property_spec.rb
|
176
177
|
- spec/proxy_object_spec.rb
|
@@ -201,12 +202,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
202
|
requirements:
|
202
203
|
- - ">="
|
203
204
|
- !ruby/object:Gem::Version
|
204
|
-
version: 2.
|
205
|
+
version: 2.4.0
|
205
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
207
|
requirements:
|
207
|
-
- - "
|
208
|
+
- - ">"
|
208
209
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
210
|
+
version: 1.3.1
|
210
211
|
requirements: []
|
211
212
|
rubyforge_project:
|
212
213
|
rubygems_version: 2.7.6.3
|