gir_ffi 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1e39bcc0f9f9fcac282b4b73a70afcf38f07696
4
- data.tar.gz: 8f62a51f4fc6ce78aca5e2d88fd756aca059561d
3
+ metadata.gz: a183b776462b97665e2e4422ee403c77189232f0
4
+ data.tar.gz: 0e803082509b39db6946310f232b5b7dd5ccdee6
5
5
  SHA512:
6
- metadata.gz: bb3dc4825b39325387310a3509772f72fa4df20907ba7aca1ebfba0f98f3b5390bbe345a9abbaf2ee1d6b1c7e58e468d1d8c94966d794e9840f8075543e74144
7
- data.tar.gz: 7fbb7f35d22e0b552c5538c984a567f06ad67f98f90963f49c351603ed1652ac9206c7d47c60229737202942115155ce802c0ba5b1628900bfa9a11b92f6eed6
6
+ metadata.gz: 233f733b08504cbc8282d2f2a0fc68caf65e3e648dcc9b0c912c816f83574c38c1e287a1c561db4a11195980243f62024a6a0588376a6f7b0311afa12481b350
7
+ data.tar.gz: a4d1c9f718083cbe4932385aa60196ac3bbe870403de227d1cd43914908afb836c42191f3e63ee66021c6da43e07cb432ed6f8d3e241ff95d70b05b818e08fec
data/Changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.4 / 2017-09-19
4
+
5
+ * Support glib 2.54 and gobject-introspection 1.54
6
+
3
7
  ## 0.11.3 / 2017-05-05
4
8
 
5
9
  * Allow conversion to native Boolean from any Ruby value
data/Gemfile CHANGED
@@ -11,5 +11,5 @@ if ENV['CI']
11
11
  end
12
12
  else
13
13
  gem 'pry', '~> 0.10.4', group: :local_development
14
- gem 'simplecov', '~> 0.14.0', group: :local_development, platform: :mri
14
+ gem 'simplecov', '~> 0.15.0', group: :local_development, platform: :mri
15
15
  end
data/README.md CHANGED
@@ -53,7 +53,7 @@ examples can be found in `gir_ffi-gtk` and `gir_ffi-gst`.
53
53
 
54
54
  ## Requirements
55
55
 
56
- GirFFI is tested on CRuby 2.1, 2.2 and 2.3, JRuby 9.1, and on Rubinius 3.
56
+ GirFFI is tested on CRuby 2.1, 2.2, 2.3 and 2.4, JRuby 9.1, and on Rubinius 3.
57
57
 
58
58
  You will also need gobject-introspection installed with some
59
59
  introspection data.
@@ -8,17 +8,34 @@ module GObject
8
8
  # Overrides for GObject, GObject's generic base class.
9
9
  class Object
10
10
  setup_method 'new'
11
-
12
- def initialize_with_automatic_gtype(properties = {})
13
- gparameters = properties.map do |name, value|
14
- name = name.to_s
15
- property_param_spec(name)
16
- GObject::Parameter.new.tap do |gparam|
17
- gparam.name = name
18
- gparam.value = value
11
+ if !GLib.check_version(2, 54, 0)
12
+ setup_method 'newv'
13
+
14
+ def initialize_with_automatic_gtype(properties = {})
15
+ names = []
16
+ values = []
17
+ properties.each do |name, value|
18
+ name = name.to_s
19
+ gvalue = gvalue_for_property(name)
20
+ gvalue.set_value value
21
+
22
+ names << name
23
+ values << gvalue
24
+ end
25
+ initialize_without_automatic_gtype(self.class.gtype, names, values)
26
+ end
27
+ else
28
+ def initialize_with_automatic_gtype(properties = {})
29
+ gparameters = properties.map do |name, value|
30
+ name = name.to_s
31
+ property_param_spec(name)
32
+ GObject::Parameter.new.tap do |gparam|
33
+ gparam.name = name
34
+ gparam.value = value
35
+ end
19
36
  end
37
+ initialize_without_automatic_gtype(self.class.gtype, gparameters)
20
38
  end
21
- initialize_without_automatic_gtype(self.class.gtype, gparameters)
22
39
  end
23
40
 
24
41
  alias_method :initialize_without_automatic_gtype, :initialize
@@ -41,11 +41,11 @@ module GirFFI
41
41
  end
42
42
 
43
43
  def setup_inspect
44
- klass.instance_eval <<-EOS
44
+ klass.instance_eval <<-RUBY
45
45
  def self.inspect
46
46
  "#{@namespace}::#{@classname}"
47
47
  end
48
- EOS
48
+ RUBY
49
49
  end
50
50
 
51
51
  def already_set_up
@@ -132,17 +132,17 @@ module GirFFI
132
132
  return if info.find_method 'new'
133
133
 
134
134
  if info.abstract?
135
- klass.class_eval <<-END
135
+ klass.class_eval <<-RUBY
136
136
  def initialize(*)
137
137
  raise NoMethodError
138
138
  end
139
- END
139
+ RUBY
140
140
  else
141
- klass.class_eval <<-END
141
+ klass.class_eval <<-RUBY
142
142
  def initialize(properties = {})
143
143
  base_initialize(properties)
144
144
  end
145
- END
145
+ RUBY
146
146
  end
147
147
  end
148
148
 
@@ -58,7 +58,7 @@ module GirFFI
58
58
  new do |*args|
59
59
  begin
60
60
  call_with_argument_mapping(prc, *args)
61
- rescue => e
61
+ rescue StandardError => e
62
62
  GLib::MainLoop.handle_exception e
63
63
  end
64
64
  end
@@ -29,12 +29,13 @@ end
29
29
  FFI::Pointer.prepend GirFFI::FFIExt::Pointer
30
30
 
31
31
  FFI::Pointer.class_eval do
32
- case FFI.type_size(:size_t)
33
- when 4
34
- alias_method :get_size_t, :get_uint32
35
- when 8
36
- alias_method :get_size_t, :get_uint64
37
- end
32
+ size_t_getter = case FFI.type_size(:size_t)
33
+ when 4
34
+ :get_uint32
35
+ when 8
36
+ :get_uint64
37
+ end
38
38
 
39
+ alias_method :get_size_t, size_t_getter
39
40
  alias_method :get_gtype, :get_size_t
40
41
  end
@@ -25,9 +25,7 @@ module GirFFI
25
25
  end
26
26
 
27
27
  def install_vfunc_implementation(name, implementation = nil)
28
- unless implementation
29
- implementation = ->(obj, *args) { obj.public_send name, *args }
30
- end
28
+ implementation ||= ->(obj, *args) { obj.public_send name, *args }
31
29
  @vfunc_implementations << VFuncImplementation.new(name, implementation)
32
30
  end
33
31
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Current GirFFI version
4
4
  module GirFFI
5
- VERSION = '0.11.3'.freeze
5
+ VERSION = '0.11.4'.freeze
6
6
  end
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'gir_ffi_test_helper'
@@ -7,7 +7,7 @@ describe 'The generated GtkSource module' do
7
7
  before do
8
8
  begin
9
9
  GirFFI.setup :GtkSource
10
- rescue
10
+ rescue RuntimeError
11
11
  skip 'GtkSource GIR not available'
12
12
  end
13
13
  end
@@ -8,7 +8,7 @@ describe 'The generated GTop module' do
8
8
  before do
9
9
  begin
10
10
  GirFFI.setup :GTop
11
- rescue
11
+ rescue RuntimeError
12
12
  skip 'No GIR data for GTop available'
13
13
  end
14
14
  end
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'gir_ffi_test_helper'
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'gir_ffi_test_helper'
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'gir_ffi_test_helper'
@@ -2827,7 +2826,15 @@ describe Regress do
2827
2826
  end
2828
2827
 
2829
2828
  it 'has a working function #annotation_transfer_floating' do
2830
- Regress.annotation_transfer_floating.must_be_nil
2829
+ Regress.setup_method :annotation_transfer_floating
2830
+ method = Regress.method :annotation_transfer_floating
2831
+ # NOTE: The arity of this method was changed in GObjectIntrospection 1.53.2
2832
+ if method.arity == 1
2833
+ object = GObject::Object.new
2834
+ Regress.annotation_transfer_floating(object).must_be_nil
2835
+ else
2836
+ Regress.annotation_transfer_floating.must_be_nil
2837
+ end
2831
2838
  end
2832
2839
 
2833
2840
  it 'has a working function #annotation_versioned' do
@@ -7,7 +7,7 @@ describe 'The generated Secret module' do
7
7
  it 'has a working constructor' do
8
8
  begin
9
9
  GirFFI.setup :Secret
10
- rescue
10
+ rescue RuntimeError
11
11
  skip 'No GIR data for Secret available'
12
12
  end
13
13
  instance = Secret::Schema.new('foo', :none, 'bar' => :string)
@@ -6,7 +6,7 @@ describe 'The generated WarnLib module' do
6
6
  before do
7
7
  begin
8
8
  GirFFI.setup :WarnLib
9
- rescue
9
+ rescue RuntimeError
10
10
  skip 'WarnLib GIR not available'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 3.5.0
75
+ version: '3.5'
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: 3.5.0
82
+ version: '3.5'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -431,7 +431,7 @@ files:
431
431
  - test/minitest/stats_plugin.rb
432
432
  homepage: http://www.github.com/mvz/ruby-gir-ffi
433
433
  licenses:
434
- - LGPL-2.1
434
+ - LGPL-2.1+
435
435
  metadata: {}
436
436
  post_install_message:
437
437
  rdoc_options:
@@ -451,7 +451,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
451
451
  version: '0'
452
452
  requirements: []
453
453
  rubyforge_project:
454
- rubygems_version: 2.6.8
454
+ rubygems_version: 2.6.13
455
455
  signing_key:
456
456
  specification_version: 4
457
457
  summary: FFI-based GObject binding using the GObject Introspection Repository