gio2 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gio2/deprecated.rb +21 -1
- data/lib/gio2/file.rb +25 -6
- data/lib/gio2/loader.rb +3 -9
- data/test/test-file-enumerator.rb +2 -2
- data/test/test-file.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6d84eca2c1900d778c7ea7ee72407f41147045d
|
4
|
+
data.tar.gz: b3391e2c37b479fe4018af91c6e3411b41360c33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe70c6286d70c5b7dd709a312a4da5f6a163c902c6cb024ffcef742c6c9a5305031256317893bf98ca17e781cc04d2fbaad5c7d6ec1d6602586400f8f1df8771
|
7
|
+
data.tar.gz: 22d10e4e393b976c2d67b0f1720ca3c17400d2ba8d18ef2f4aff10f772be3cbff667df69fbbb2c86a4e37a02fa6f99db6bdfce1ba90cc1115f344e4cea0af293
|
data/lib/gio2/deprecated.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2013-2017 Ruby-GNOME2 Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -116,3 +116,23 @@ module GLib
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
+
module Gio
|
120
|
+
module File
|
121
|
+
extend GLib::Deprecatable
|
122
|
+
|
123
|
+
define_deprecated_singleton_method(:commandline_arg,
|
124
|
+
"open(arg: arg, cwd: cwd)") do |_self, arg, cwd=nil|
|
125
|
+
open(arg: arg, cwd: cwd)
|
126
|
+
end
|
127
|
+
|
128
|
+
define_deprecated_singleton_method(:path,
|
129
|
+
"open(path: path)") do |_self, path|
|
130
|
+
open(path: path)
|
131
|
+
end
|
132
|
+
|
133
|
+
define_deprecated_singleton_method(:uri,
|
134
|
+
"open(uri: uri)") do |_self, uri|
|
135
|
+
open(uri: uri)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
data/lib/gio2/file.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2016 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2016-2017 Ruby-GNOME2 Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -17,12 +17,31 @@
|
|
17
17
|
module Gio
|
18
18
|
module File
|
19
19
|
class << self
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def open(options={})
|
21
|
+
arg = options[:arg]
|
22
|
+
cwd = options[:cwd]
|
23
|
+
path = options[:path]
|
24
|
+
uri = options[:uri]
|
25
|
+
|
26
|
+
if arg
|
27
|
+
if cwd
|
28
|
+
file = new_for_commandline_arg_and_cmd(arg, cwd)
|
29
|
+
else
|
30
|
+
file = new_for_commandline_arg(arg)
|
31
|
+
end
|
32
|
+
elsif path
|
33
|
+
file = new_for_path(path)
|
34
|
+
elsif uri
|
35
|
+
file = new_for_uri(uri)
|
36
|
+
else
|
37
|
+
message = "must specify :arg, :path or :uri: #{options.inspect}"
|
38
|
+
raise ArgumentError, message
|
39
|
+
end
|
40
|
+
|
41
|
+
if block_given?
|
42
|
+
yield(file)
|
24
43
|
else
|
25
|
-
|
44
|
+
file
|
26
45
|
end
|
27
46
|
end
|
28
47
|
end
|
data/lib/gio2/loader.rb
CHANGED
@@ -22,6 +22,7 @@ module Gio
|
|
22
22
|
define_mime_type_class
|
23
23
|
define_dbus_module
|
24
24
|
define_resources_module
|
25
|
+
@file_function_infos = []
|
25
26
|
@content_type_guess_for_tree_info = nil
|
26
27
|
end
|
27
28
|
|
@@ -116,6 +117,8 @@ module Gio
|
|
116
117
|
when /\Adbus_/
|
117
118
|
name = rubyish_method_name(info, :prefix => "dbus_")
|
118
119
|
define_singleton_method(@dbus_module, name, info)
|
120
|
+
when /\Afile_/
|
121
|
+
# Ignore because they are defined by load_interface_info
|
119
122
|
else
|
120
123
|
super
|
121
124
|
end
|
@@ -172,15 +175,6 @@ module Gio
|
|
172
175
|
end
|
173
176
|
end
|
174
177
|
|
175
|
-
def rubyish_method_name(info, options={})
|
176
|
-
case info.name
|
177
|
-
when /\Anew_(?:for_)?/
|
178
|
-
$POSTMATCH
|
179
|
-
else
|
180
|
-
super
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
178
|
def rubyish_class_name(info)
|
185
179
|
case info.name
|
186
180
|
when /Enum\z/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
1
|
+
# Copyright (C) 2013-2017 Ruby-GNOME2 Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -19,7 +19,7 @@ class TestFileEnumerator < Test::Unit::TestCase
|
|
19
19
|
|
20
20
|
def test_container
|
21
21
|
path = File.dirname(__FILE__)
|
22
|
-
dir = Gio::File.
|
22
|
+
dir = Gio::File.open(path: path)
|
23
23
|
enumerator = dir.enumerate_children("*", :none)
|
24
24
|
assert_equal(path, enumerator.container.path)
|
25
25
|
end
|
data/test/test-file.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (C) 2014-2017 Ruby-GNOME2 Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -22,7 +22,7 @@ class TestFile < Test::Unit::TestCase
|
|
22
22
|
def test_guess_content_type
|
23
23
|
omit_on_os_x
|
24
24
|
path = fixture_path("content-type", "x-content", "unix-software")
|
25
|
-
dir = Gio::File.
|
25
|
+
dir = Gio::File.open(path: path)
|
26
26
|
assert_equal(["x-content/unix-software"],
|
27
27
|
dir.guess_content_types.collect(&:to_s))
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gio2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME2 Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glib2
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.1.
|
19
|
+
version: 3.1.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.1.
|
26
|
+
version: 3.1.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gobject-introspection
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.1.
|
33
|
+
version: 3.1.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.1.
|
40
|
+
version: 3.1.4
|
41
41
|
description: Ruby/GIO2 is a Ruby binding of gio-2.x.
|
42
42
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
43
43
|
executables: []
|