ruby-dbus 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/NEWS.md +344 -0
- data/Rakefile +21 -15
- data/VERSION +1 -1
- data/doc/Reference.md +26 -37
- data/examples/doc/_extract_examples +4 -4
- data/examples/gdbus/gdbus +40 -39
- data/examples/no-introspect/nm-test.rb +1 -3
- data/examples/no-introspect/tracker-test.rb +2 -4
- data/examples/rhythmbox/playpause.rb +1 -2
- data/examples/service/call_service.rb +0 -3
- data/examples/service/service_newapi.rb +3 -4
- data/examples/simple/call_introspect.rb +0 -3
- data/examples/simple/get_id.rb +1 -3
- data/examples/simple/properties.rb +3 -4
- data/examples/utils/listnames.rb +6 -7
- data/examples/utils/notify.rb +3 -5
- data/lib/dbus.rb +8 -20
- data/lib/dbus/auth.rb +59 -61
- data/lib/dbus/bus.rb +86 -97
- data/lib/dbus/error.rb +1 -1
- data/lib/dbus/export.rb +20 -18
- data/lib/dbus/introspect.rb +26 -28
- data/lib/dbus/logger.rb +1 -1
- data/lib/dbus/marshall.rb +72 -74
- data/lib/dbus/matchrule.rb +22 -26
- data/lib/dbus/message.rb +24 -33
- data/lib/dbus/message_queue.rb +30 -30
- data/lib/dbus/proxy_object.rb +34 -30
- data/lib/dbus/proxy_object_factory.rb +5 -2
- data/lib/dbus/proxy_object_interface.rb +10 -8
- data/lib/dbus/type.rb +154 -156
- data/lib/dbus/xml.rb +22 -16
- data/ruby-dbus.gemspec +15 -3
- data/spec/async_spec.rb +2 -4
- data/spec/binding_spec.rb +1 -5
- data/spec/bus_and_xml_backend_spec.rb +6 -9
- data/spec/bus_spec.rb +1 -1
- data/spec/byte_array_spec.rb +0 -2
- data/spec/err_msg_spec.rb +13 -10
- data/spec/introspect_xml_parser_spec.rb +2 -2
- data/spec/introspection_spec.rb +1 -1
- data/spec/main_loop_spec.rb +4 -5
- data/spec/property_spec.rb +0 -3
- data/spec/proxy_object_spec.rb +42 -0
- data/spec/server_robustness_spec.rb +0 -2
- data/spec/service_newapi.rb +51 -41
- data/spec/session_bus_spec.rb +6 -7
- data/spec/signal_spec.rb +2 -3
- data/spec/spec_helper.rb +28 -24
- data/spec/thread_safety_spec.rb +1 -2
- data/spec/type_spec.rb +2 -2
- data/spec/value_spec.rb +7 -10
- data/spec/variant_spec.rb +15 -16
- metadata +60 -3
- data/NEWS +0 -279
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be28e1bcc3ffa7c25f729d8915cd90344d565644
|
4
|
+
data.tar.gz: 94eaa6d210ee9fed21c764c7d24d521ca98bf60f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89bad1fc379f3e77d8758007e5d88664faa765bd6e1ef7d9638490e67b33a5411da8d90c151c9e8d263951d40d43520076f2c6d18aa27423eb92d7409c275667
|
7
|
+
data.tar.gz: 9c24257d8db08279aeed560e050179d674397c0cdb93bba805f637afee70611edaa7373034aae2b8f69bf7466ea1936ea85a72dd1fe0182bfa02486bf57702a4
|
data/NEWS.md
ADDED
@@ -0,0 +1,344 @@
|
|
1
|
+
# Ruby D-Bus NEWS
|
2
|
+
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## Ruby D-Bus 0.13.0 - 2016-09-21
|
6
|
+
|
7
|
+
Bug fixes:
|
8
|
+
* It is no longer required to explicitly call ProxyObject#introspect,
|
9
|
+
it will be done automatically once ([#28][]).
|
10
|
+
|
11
|
+
Requirements:
|
12
|
+
* Introduced RuboCop to keep a consistent coding style.
|
13
|
+
* Replaced Gemfile.ci with a regular Gemfile.
|
14
|
+
|
15
|
+
[#28]: http://github.com/mvidner/ruby-dbus/issue/28
|
16
|
+
|
17
|
+
## Ruby D-Bus 0.12.0 - 2016-09-12
|
18
|
+
|
19
|
+
API:
|
20
|
+
* Added proxy objects whose methods return single values instead of arrays
|
21
|
+
(use Service#[] instead of Service#object; [#30][]).
|
22
|
+
|
23
|
+
Requirements:
|
24
|
+
* Require ruby 2.0.0, stopped supporting 1.9.3.
|
25
|
+
|
26
|
+
[#30]: http://github.com/mvidner/ruby-dbus/issue/30
|
27
|
+
|
28
|
+
## Ruby D-Bus 0.11.2 - 2016-09-11
|
29
|
+
|
30
|
+
Bug fixes:
|
31
|
+
* Fixed reading a quoted session bus address, as written by dbus-1.10.10
|
32
|
+
([#62][], Yasuhiro Asaka)
|
33
|
+
|
34
|
+
[#62]: https://github.com/mvidner/ruby-dbus/pull/62
|
35
|
+
|
36
|
+
## Ruby D-Bus 0.11.1 - 2016-05-12
|
37
|
+
|
38
|
+
Bug fixes:
|
39
|
+
* Fix default path finding on FreeBSD (Greg)
|
40
|
+
* Service#unexport fixed to really return the unexported object
|
41
|
+
|
42
|
+
Requirements:
|
43
|
+
* made tests compatible with RSpec 3
|
44
|
+
|
45
|
+
## Ruby D-Bus 0.11.0 - 2014-02-17
|
46
|
+
|
47
|
+
API:
|
48
|
+
* Connection: split off MessageQueue, marked other methods as private.
|
49
|
+
|
50
|
+
Requirements:
|
51
|
+
* converted tests to RSpec, rather mechanically for now
|
52
|
+
|
53
|
+
## Ruby D-Bus 0.10.0 - 2014-01-10
|
54
|
+
|
55
|
+
Bug fixes:
|
56
|
+
* fixed "Interfaces added with singleton_class.instance_eval aren't
|
57
|
+
exported" ([#22][], by miaoufkirsh)
|
58
|
+
|
59
|
+
Requirements:
|
60
|
+
* Require ruby 1.9.3, stopped supporting 1.8.7.
|
61
|
+
|
62
|
+
[#22]: https://github.com/mvidner/ruby-dbus/issue/22
|
63
|
+
|
64
|
+
## Ruby D-Bus 0.9.3 - 2014-01-02
|
65
|
+
|
66
|
+
Bug fixes:
|
67
|
+
* re-added COPYING, NEWS, README.md to the gem ([#47][],
|
68
|
+
by Cédric Boutillier)
|
69
|
+
|
70
|
+
Packaging:
|
71
|
+
* use packaging_rake_tasks
|
72
|
+
|
73
|
+
[#47]: https://github.com/mvidner/ruby-dbus/issue/47
|
74
|
+
|
75
|
+
## Ruby D-Bus 0.9.2 - 2013-05-08
|
76
|
+
|
77
|
+
Features:
|
78
|
+
* Ruby strings can be passed where byte arrays ("ay") are expected
|
79
|
+
([#40][], by Jesper B. Rosenkilde)
|
80
|
+
|
81
|
+
Bug fixes:
|
82
|
+
* Fixed accessing ModemManager properties ([#41][], reported
|
83
|
+
by Ernest Bursa). MM introspection produces two elements
|
84
|
+
for a single interface; merge them.
|
85
|
+
|
86
|
+
[#40]: https://github.com/mvidner/ruby-dbus/issue/40
|
87
|
+
[#41]: https://github.com/mvidner/ruby-dbus/issue/41
|
88
|
+
|
89
|
+
## Ruby D-Bus 0.9.1 - 2013-04-23
|
90
|
+
|
91
|
+
Bug fixes:
|
92
|
+
* Prefer /etc/machine-id to /var/lib/dbus/machine-id
|
93
|
+
when DBUS_SESSION_BUS_ADDRESS is unset ([#39][], by WU Jun).
|
94
|
+
|
95
|
+
[#39]: https://github.com/mvidner/ruby-dbus/issue/39
|
96
|
+
|
97
|
+
## Ruby D-Bus 0.9.0 - 2012-11-06
|
98
|
+
|
99
|
+
Features:
|
100
|
+
* When calling methods, the interface can be left unspecified if unambiguous
|
101
|
+
(Damiano Stoffie)
|
102
|
+
* YARD documentation, Reference.md
|
103
|
+
|
104
|
+
Bug fixes:
|
105
|
+
* Introspection attribute "direction" can be omitted
|
106
|
+
as allowed by the specification (Noah Meyerhans).
|
107
|
+
* ProxyObjectInterface#on_signal no longer needs the "bus" parameter
|
108
|
+
([#31][], by Damiano Stoffie)
|
109
|
+
|
110
|
+
[#31]: https://github.com/mvidner/ruby-dbus/issue/31
|
111
|
+
|
112
|
+
## Ruby D-Bus 0.8.0 - 2012-09-20
|
113
|
+
|
114
|
+
Features:
|
115
|
+
* Add Anonymous authentication ([#27][], by Walter Brebels).
|
116
|
+
* Use Nokogiri for XML parsing when available ([#24][], by Geoff Youngs).
|
117
|
+
|
118
|
+
Bug fixes:
|
119
|
+
* Use SCM_CREDS authentication only on FreeBSD, not on OpenBSD ([#21][],
|
120
|
+
reported by Adde Nilsson).
|
121
|
+
* Recognize signature "h" (UNIX_FD) used eg. by Upstart ([#23][],
|
122
|
+
by Bernd Ahlers).
|
123
|
+
* Find the session bus also via launchd, on OS X ([#20][], reported
|
124
|
+
by Paul Sturgess).
|
125
|
+
|
126
|
+
Other:
|
127
|
+
* Now doing continuous integration with Travis:
|
128
|
+
http://travis-ci.org/#!/mvidner/ruby-dbus
|
129
|
+
|
130
|
+
[#20]: https://github.com/mvidner/ruby-dbus/issue/20
|
131
|
+
[#21]: https://github.com/mvidner/ruby-dbus/issue/21
|
132
|
+
[#23]: https://github.com/mvidner/ruby-dbus/issue/23
|
133
|
+
[#24]: https://github.com/mvidner/ruby-dbus/issue/24
|
134
|
+
[#27]: https://github.com/mvidner/ruby-dbus/issue/27
|
135
|
+
|
136
|
+
## Ruby D-Bus 0.7.2 - 2012-04-05
|
137
|
+
|
138
|
+
A brown-paper-bag release.
|
139
|
+
|
140
|
+
Bug fixes:
|
141
|
+
* Fixed "undefined local variable or method `continue'" in
|
142
|
+
DBus::Main#run when a service becomes idle (by Ravil Bayramgalin)
|
143
|
+
|
144
|
+
## Ruby D-Bus 0.7.1 - 2012-04-04
|
145
|
+
|
146
|
+
Bug fixes:
|
147
|
+
* Fixed calling asynchronous methods on the default interface ([#13][],
|
148
|
+
by Eugene Korbut).
|
149
|
+
* Fixed Main#quit to really quit the loop (by Josef Reidinger)
|
150
|
+
* Unbundled files from Active Support (by Bohuslav Kabrda)
|
151
|
+
|
152
|
+
[#13]: https://github.com/mvidner/ruby-dbus/issue/13
|
153
|
+
|
154
|
+
## Ruby D-Bus 0.7.0 - 2011-07-26
|
155
|
+
|
156
|
+
Features:
|
157
|
+
* Added ASystemBus and ASessionBus, non-singletons useful in tests
|
158
|
+
and threads.
|
159
|
+
|
160
|
+
Bug fixes:
|
161
|
+
* Fixed handling of multibyte strings ([#8][], by Takayuki YAMAGUCHI).
|
162
|
+
* Allow reopening of a dbus_interface declaration ([#9][], by T. YAMAGUCHI).
|
163
|
+
* Fixed ruby-1.9.2 compatibility again ([#12][]).
|
164
|
+
* Fixed authentication on BSD ([#11][], by Jonathan Walker)
|
165
|
+
* Fixed exiting a nested event loop for synchronous calls
|
166
|
+
(reported by Timo Warns).
|
167
|
+
* Fixed introspection calls leaking reply handlers.
|
168
|
+
* "rake test" now works, doing what was called "rake env:test"
|
169
|
+
|
170
|
+
[#8]: https://github.com/mvidner/ruby-dbus/issue/8
|
171
|
+
[#9]: https://github.com/mvidner/ruby-dbus/issue/9
|
172
|
+
[#11]: https://github.com/mvidner/ruby-dbus/issue/11
|
173
|
+
[#12]: https://github.com/mvidner/ruby-dbus/issue/12
|
174
|
+
|
175
|
+
## Ruby D-Bus 0.6.0 - 2010-12-11
|
176
|
+
|
177
|
+
Features:
|
178
|
+
* Clients can access properties conveniently ([T#28][]).
|
179
|
+
|
180
|
+
Bug fixes:
|
181
|
+
* Service won't crash whan handling an unknown method or interface ([T#31][]).
|
182
|
+
* Don't send an invalid error name when it originates from a NameError.
|
183
|
+
|
184
|
+
[T#28]: https://trac.luon.net/ruby-dbus/ticket/28
|
185
|
+
[T#31]: https://trac.luon.net/ruby-dbus/ticket/31
|
186
|
+
|
187
|
+
## Ruby D-Bus 0.5.0 - 2010-11-07
|
188
|
+
|
189
|
+
Features:
|
190
|
+
* Better binding of Ruby Exceptions to D-Bus Errors.
|
191
|
+
* Converted the package to a Gem ([#6][]).
|
192
|
+
* Converted the tutorial from Webgen to Markdown.
|
193
|
+
|
194
|
+
Bug fixes:
|
195
|
+
* Don't pass file descriptors to subprocesses.
|
196
|
+
* Fixed InterfaceElement::validate_name ([T#38][], by Herwin Weststrate).
|
197
|
+
* Fixed a typo in InvalidDestinationName description ([T#40][]).
|
198
|
+
|
199
|
+
[#6]: https://github.com/mvidner/ruby-dbus/issue/6
|
200
|
+
[T#38]: https://trac.luon.net/ruby-dbus/ticket/38
|
201
|
+
[T#40]: https://trac.luon.net/ruby-dbus/ticket/40
|
202
|
+
|
203
|
+
## Ruby D-Bus 0.4.0 - 2010-08-20
|
204
|
+
|
205
|
+
Features:
|
206
|
+
* TCP transport (by pangdudu)
|
207
|
+
* Enabled test code coverage report (rcov)
|
208
|
+
|
209
|
+
Bug fixes:
|
210
|
+
* Classes should not share all interfaces ([T#36][]/[#5][])
|
211
|
+
* Ruby 1.9 compatibility ([T#37][], by Myra Nelson)
|
212
|
+
|
213
|
+
[#5]: https://github.com/mvidner/ruby-dbus/issue/5
|
214
|
+
[T#36]: https://trac.luon.net/ruby-dbus/ticket/36
|
215
|
+
[T#37]: https://trac.luon.net/ruby-dbus/ticket/37
|
216
|
+
|
217
|
+
## Ruby D-Bus 0.3.1 - 2010-07-22
|
218
|
+
|
219
|
+
Bug fixes:
|
220
|
+
* Many on_signal could cause DBus.Error.LimitsExceeded [bsc#617350][]).
|
221
|
+
Don't add a match rule that already exists, enable removing match
|
222
|
+
rules. Now only one handler for a rule is called (but it is possible
|
223
|
+
for one signal to match more rules). This reverts the half-fix done
|
224
|
+
to fix [#3][]
|
225
|
+
* Re-added InterfaceElement#add_param for compatibility.
|
226
|
+
* Handle more ways which tell us that a bus connection has died.
|
227
|
+
|
228
|
+
[#3]: https://github.com/mvidner/ruby-dbus/issue/3
|
229
|
+
[bsc#617350]: https://bugzilla.novell.com/show_bug.cgi?id=617350
|
230
|
+
|
231
|
+
## Ruby D-Bus 0.3.0 - 2010-03-28
|
232
|
+
|
233
|
+
Bug fixes:
|
234
|
+
|
235
|
+
* Fixed "undefined method `get_node' for nil:NilClass"
|
236
|
+
on Ubuntu Karmic ([T#34][]).
|
237
|
+
* Get the session bus address even if unset in ENV ([#4][]).
|
238
|
+
* Improved exceptions a bit:
|
239
|
+
UndefinedInterface, InvalidMethodName, NoMethodError, no RuntimeException
|
240
|
+
|
241
|
+
These are by Klaus Kaempf:
|
242
|
+
* Make the signal dispatcher call all handlers ([#3][]).
|
243
|
+
* Run on Ruby < 1.8.7 ([#2][]).
|
244
|
+
* Avoid needless DBus::IncompleteBufferException ([T#33][]).
|
245
|
+
* Don't ignore DBus Errors in request_service, raise them ([T#32][]).
|
246
|
+
|
247
|
+
[#2]: https://github.com/mvidner/ruby-dbus/issue/2
|
248
|
+
[#3]: https://github.com/mvidner/ruby-dbus/issue/3
|
249
|
+
[#4]: https://github.com/mvidner/ruby-dbus/issue/4
|
250
|
+
[T#32]: https://trac.luon.net/ruby-dbus/ticket/32
|
251
|
+
[T#33]: https://trac.luon.net/ruby-dbus/ticket/33
|
252
|
+
[T#34]: https://trac.luon.net/ruby-dbus/ticket/34
|
253
|
+
|
254
|
+
Features:
|
255
|
+
|
256
|
+
* Automatic signature inference for variants.
|
257
|
+
* Introduced FormalParameter where a plain pair had been used.
|
258
|
+
|
259
|
+
## Ruby D-Bus 0.2.12 - 2010-01-24
|
260
|
+
|
261
|
+
Bug fixes:
|
262
|
+
|
263
|
+
* Fixed a long-standing bug where a service activated by the bus
|
264
|
+
would fail with "undefined method `get_node' for nil:NilClass"
|
265
|
+
([T#25][] and [T#29][]).
|
266
|
+
|
267
|
+
[T#25]: https://trac.luon.net/ruby-dbus/ticket/25
|
268
|
+
[T#29]: https://trac.luon.net/ruby-dbus/ticket/29
|
269
|
+
|
270
|
+
|
271
|
+
## Ruby D-Bus 0.2.11 - 2009-11-12
|
272
|
+
|
273
|
+
Features:
|
274
|
+
|
275
|
+
* Added DBus::Service#unexport (da1l6).
|
276
|
+
|
277
|
+
Bug fixes:
|
278
|
+
|
279
|
+
* Return org.freedesktop.DBus.Error.UnknownObject instead of crashing
|
280
|
+
([T#31][]).
|
281
|
+
* Rescue exceptions in dbus_methods and reply with DBus errors instead of
|
282
|
+
crashing (da1l6).
|
283
|
+
* Better exception messages when sending nil, or mismatched structs.
|
284
|
+
* Call mktemp without --tmpdir, to build on older distros.
|
285
|
+
|
286
|
+
[T#31]: https://trac.luon.net/ruby-dbus/ticket/31
|
287
|
+
|
288
|
+
## Ruby D-Bus 0.2.10 - 2009-09-10
|
289
|
+
|
290
|
+
Bug fixes:
|
291
|
+
|
292
|
+
* DBus::Service.exists? fixed (Murat Demirten).
|
293
|
+
* Ruby 1.9 fixes (Jedediah Smith).
|
294
|
+
* Fixed an endless sleep in DBus::Main.run ([bsc#537401][]).
|
295
|
+
* Added details to PacketMarshaller exceptions ([bsc#538050][]).
|
296
|
+
|
297
|
+
[bsc#537401]: https://bugzilla.novell.com/show_bug.cgi?id=537401
|
298
|
+
[bsc#538050]: https://bugzilla.novell.com/show_bug.cgi?id=538050
|
299
|
+
|
300
|
+
## Ruby D-Bus "I'm not dead" 0.2.9 - 2009-08-26
|
301
|
+
|
302
|
+
Thank you to Paul and Arnaud for starting the project. I, Martin
|
303
|
+
Vidner, am continuing with it on GitHub.
|
304
|
+
|
305
|
+
* Fixed passing an array through a variant (no ticket).
|
306
|
+
* Fixed marshalling "av" ([T#30][]).
|
307
|
+
* Fixed variant alignment ([T#27][]).
|
308
|
+
* Added DBus::Main.quit.
|
309
|
+
* Mention the DBus interface in a NameError for an unknown method.
|
310
|
+
* Fixed ruby-1.9 "warning: default `to_a' will be obsolete".
|
311
|
+
* Added Rakefile and gemspec.
|
312
|
+
|
313
|
+
[T#27]: https://trac.luon.net/ruby-dbus/ticket/27
|
314
|
+
[T#30]: https://trac.luon.net/ruby-dbus/ticket/30
|
315
|
+
|
316
|
+
## Ruby D-Bus "Thanks for all the fish" 0.2.1 - 2007-12-29
|
317
|
+
|
318
|
+
More bugfixes, mostly supplied by users supplying us with patches. Thanks!
|
319
|
+
|
320
|
+
* Support for new types added:
|
321
|
+
- dict (courtesy of Drake Wilson);
|
322
|
+
- double (courtesy of Patrick Sissons);
|
323
|
+
- variant.
|
324
|
+
* Improved exception raise support (courtesy of Sjoerd Simons,
|
325
|
+
Patrick Sissons).
|
326
|
+
* Some polish (removed debug output, solved unnecessary warnings).
|
327
|
+
* Documentation updates, example fixes and updates.
|
328
|
+
|
329
|
+
## Ruby D-Bus "Almost live from DebConf 7" 0.2.0 - 2007-06-02
|
330
|
+
|
331
|
+
Again a bugfix release, also meant to be the public release
|
332
|
+
for exploratory purposes. New in 0.2.0:
|
333
|
+
|
334
|
+
* Complete tutorial revamp.
|
335
|
+
* Relicensed to the LGPL.
|
336
|
+
|
337
|
+
## Ruby D-Bus "Release Often" 0.1.1 - 2007-04-23
|
338
|
+
|
339
|
+
Bugfix release. Fixes hardcoded string for requesting bus names,
|
340
|
+
found by Rudi Cilibrasi.
|
341
|
+
|
342
|
+
## Ruby D-Bus "Happy Birthday Paul" 0.1.0 - 2007-04-17
|
343
|
+
|
344
|
+
First release. Supports most of D-Bus' features.
|
data/Rakefile
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "rake"
|
3
|
+
require "fileutils"
|
4
4
|
include FileUtils
|
5
|
-
require
|
6
|
-
require
|
7
|
-
|
5
|
+
require "tmpdir"
|
6
|
+
require "rspec/core/rake_task"
|
7
|
+
begin
|
8
|
+
require "rubocop/rake_task"
|
9
|
+
rescue LoadError
|
10
|
+
nil
|
11
|
+
end
|
8
12
|
require "packaging"
|
9
13
|
|
10
14
|
Packaging.configuration do |conf|
|
@@ -12,22 +16,22 @@ Packaging.configuration do |conf|
|
|
12
16
|
conf.obs_target = "openSUSE_Tumbleweed"
|
13
17
|
conf.package_name = "rubygem-ruby-dbus"
|
14
18
|
conf.obs_sr_project = "openSUSE:Factory"
|
15
|
-
conf.skip_license_check <<
|
16
|
-
conf.skip_license_check <<
|
19
|
+
conf.skip_license_check << %r{^[^/]*$}
|
20
|
+
conf.skip_license_check << %r{^(doc|examples|spec)/.*}
|
17
21
|
# "Ruby on Rails is released under the MIT License."
|
18
22
|
# but the files are missing copyright headers
|
19
|
-
conf.skip_license_check <<
|
23
|
+
conf.skip_license_check << %r{^lib/dbus/core_ext/}
|
20
24
|
end
|
21
25
|
|
22
|
-
desc
|
23
|
-
task :
|
24
|
-
task :
|
26
|
+
desc "Default: run specs in the proper environment"
|
27
|
+
task default: [:spec, :rubocop]
|
28
|
+
task test: :spec
|
25
29
|
|
26
30
|
RSpec::Core::RakeTask.new("bare:spec")
|
27
31
|
|
28
32
|
%w(spec).each do |tname|
|
29
33
|
desc "Run bare:#{tname} in the proper environment"
|
30
|
-
task tname do |
|
34
|
+
task tname do |_t|
|
31
35
|
cd "spec/tools" do
|
32
36
|
sh "./test_env rake bare:#{tname}"
|
33
37
|
end
|
@@ -37,14 +41,14 @@ end
|
|
37
41
|
if ENV["TRAVIS"]
|
38
42
|
require "coveralls/rake/task"
|
39
43
|
Coveralls::RakeTask.new
|
40
|
-
task :
|
44
|
+
task default: "coveralls:push"
|
41
45
|
end
|
42
46
|
|
43
|
-
#remove tarball implementation and create gem for this gemfile
|
47
|
+
# remove tarball implementation and create gem for this gemfile
|
44
48
|
Rake::Task[:tarball].clear
|
45
49
|
|
46
50
|
desc "Build a package from a clone of the local Git repo"
|
47
|
-
task :tarball do |
|
51
|
+
task :tarball do |_t|
|
48
52
|
Dir.mktmpdir do |temp|
|
49
53
|
sh "git clone . #{temp}"
|
50
54
|
cd temp do
|
@@ -63,3 +67,5 @@ namespace :doc do
|
|
63
67
|
end
|
64
68
|
end
|
65
69
|
end
|
70
|
+
|
71
|
+
RuboCop::RakeTask.new if Object.const_defined? :RuboCop
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.13.0
|
data/doc/Reference.md
CHANGED
@@ -23,23 +23,18 @@ is simply "dbus"
|
|
23
23
|
#### Calling Methods
|
24
24
|
|
25
25
|
1. {DBus.session_bus Connect to the session bus};
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
to define the interfaces and methods
|
30
|
-
on the {DBus::ProxyObject object proxy}
|
31
|
-
([I#28](https://github.com/mvidner/ruby-dbus/issues/28)).
|
32
|
-
3. Call one of its methods in a loop, solving [xkcd#196](http://xkcd.com/196).
|
26
|
+
2. {DBus::Connection#[] get the screensaver service}
|
27
|
+
3. {DBus::Service#[] and its screensaver object}.
|
28
|
+
4. Call one of its methods in a loop, solving [xkcd#196](http://xkcd.com/196).
|
33
29
|
|
34
30
|
|
35
31
|
|
36
32
|
mybus = DBus.session_bus
|
37
|
-
service = mybus[
|
38
|
-
object = service[
|
39
|
-
object.introspect
|
33
|
+
service = mybus["org.freedesktop.ScreenSaver"]
|
34
|
+
object = service["/ScreenSaver"]
|
40
35
|
loop do
|
41
|
-
|
42
|
-
|
36
|
+
object.SimulateUserActivity
|
37
|
+
sleep 5 * 60
|
43
38
|
end
|
44
39
|
|
45
40
|
##### Retrieving Return Values
|
@@ -48,10 +43,9 @@ A method proxy simply returns a value.
|
|
48
43
|
In this example SuspendAllowed returns a boolean:
|
49
44
|
|
50
45
|
mybus = DBus.session_bus
|
51
|
-
pm_s = mybus[
|
52
|
-
pm_o = pm_s[
|
53
|
-
pm_o.
|
54
|
-
pm_i = pm_o['org.freedesktop.PowerManagement']
|
46
|
+
pm_s = mybus["org.freedesktop.PowerManagement"]
|
47
|
+
pm_o = pm_s["/org/freedesktop/PowerManagement"]
|
48
|
+
pm_i = pm_o["org.freedesktop.PowerManagement"]
|
55
49
|
|
56
50
|
if pm_i.CanSuspend
|
57
51
|
pm_i.Suspend
|
@@ -69,13 +63,12 @@ which is what {DBus::Service#object} does.
|
|
69
63
|
For nearly all methods you used `Method[0]` or
|
70
64
|
`Method.first`
|
71
65
|
([I#30](https://github.com/mvidner/ruby-dbus/issues/30)).
|
72
|
-
|
66
|
+
|
73
67
|
mybus = DBus.session_bus
|
74
|
-
pm_s = mybus[
|
68
|
+
pm_s = mybus["org.freedesktop.PowerManagement"]
|
75
69
|
# use legacy compatibility API
|
76
|
-
pm_o = pm_s.object[
|
77
|
-
pm_o.
|
78
|
-
pm_i = pm_o['org.freedesktop.PowerManagement']
|
70
|
+
pm_o = pm_s.object["/org/freedesktop/PowerManagement"]
|
71
|
+
pm_i = pm_o["org.freedesktop.PowerManagement"]
|
79
72
|
|
80
73
|
# wrong
|
81
74
|
# if pm_i.CanSuspend
|
@@ -95,12 +88,11 @@ or use {DBus::ProxyObjectInterface#all_properties} to get
|
|
95
88
|
an actual Hash of them.
|
96
89
|
|
97
90
|
sysbus = DBus.system_bus
|
98
|
-
upower_s = sysbus[
|
99
|
-
upower_o = upower_s[
|
100
|
-
upower_o.
|
101
|
-
upower_i = upower_o['org.freedesktop.UPower']
|
91
|
+
upower_s = sysbus["org.freedesktop.UPower"]
|
92
|
+
upower_o = upower_s["/org/freedesktop/UPower"]
|
93
|
+
upower_i = upower_o["org.freedesktop.UPower"]
|
102
94
|
|
103
|
-
on_battery = upower_i[
|
95
|
+
on_battery = upower_i["OnBattery"]
|
104
96
|
|
105
97
|
puts "Is the computer on battery now? #{on_battery}"
|
106
98
|
|
@@ -135,10 +127,9 @@ To receive signals for a specific object and interface, use
|
|
135
127
|
{DBus::ProxyObject#on_signal}(name, &block), for the default interface.
|
136
128
|
|
137
129
|
sysbus = DBus.system_bus
|
138
|
-
login_s = sysbus[
|
139
|
-
login_o = login_s.object
|
140
|
-
login_o.
|
141
|
-
login_o.default_iface = 'org.freedesktop.login1.Manager'
|
130
|
+
login_s = sysbus["org.freedesktop.login1"] # part of systemd
|
131
|
+
login_o = login_s.object "/org/freedesktop/login1"
|
132
|
+
login_o.default_iface = "org.freedesktop.login1.Manager"
|
142
133
|
|
143
134
|
main = DBus::Main.new
|
144
135
|
main << sysbus
|
@@ -148,9 +139,8 @@ To receive signals for a specific object and interface, use
|
|
148
139
|
puts "New session: #{name}"
|
149
140
|
|
150
141
|
session_o = login_s.object(opath)
|
151
|
-
session_o.
|
152
|
-
|
153
|
-
uid, user_opath = session_i['User']
|
142
|
+
session_i = session_o["org.freedesktop.login1.Session"]
|
143
|
+
uid, _user_opath = session_i["User"]
|
154
144
|
puts "Its UID: #{uid}"
|
155
145
|
main.quit
|
156
146
|
end
|
@@ -189,7 +179,7 @@ If the signature expects a Variant
|
|
189
179
|
ISSUE: using something else than cryptic signatures is even more painful
|
190
180
|
than remembering the signatures!
|
191
181
|
|
192
|
-
foo_i[
|
182
|
+
foo_i["Bar"] = DBus.variant("au", [0, 1, 1, 2, 3, 5, 8])
|
193
183
|
|
194
184
|
2. Other values are tried to fit one of these:
|
195
185
|
Boolean, Double, Array of Variants, Hash of String keyed Variants,
|
@@ -218,12 +208,11 @@ D-Bus calls can reply with an error instead of a return value. An error is
|
|
218
208
|
translated to a Ruby exception, an instance of {DBus::Error}.
|
219
209
|
|
220
210
|
nm_o = DBus.system_bus["org.freedesktop.NetworkManager"]["/org/freedesktop/NetworkManager"]
|
221
|
-
nm_o.introspect
|
222
211
|
nm = nm_o["org.freedesktop.NetworkManager"]
|
223
212
|
begin
|
224
|
-
|
213
|
+
nm.Sleep(false)
|
225
214
|
rescue DBus::Error => e
|
226
|
-
|
215
|
+
puts e unless e.name == "org.freedesktop.NetworkManager.AlreadyAsleepOrAwake"
|
227
216
|
end
|
228
217
|
|
229
218
|
#### Interfaces
|