gir_ffi-gnome_keyring 0.0.6 → 0.0.7

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: c3048f24273bbc8edba0c65169092ee6584d3f00
4
- data.tar.gz: 87c50014c4c13b592112aedeab97f7354fbac557
3
+ metadata.gz: 1c5d0da487b8bf0fc6253f5f81e21f48d8fff2f7
4
+ data.tar.gz: 1d1801d16bde2b995b871b140b36b36552f02fd7
5
5
  SHA512:
6
- metadata.gz: c12fc2555407e363f4318bca376abaa2bcdad645f50fcc4a16692049173ce1e023fe960c0e1b472cd537bed59f16b5ad5a0ec30d7781d378097e12adf4d1ee31
7
- data.tar.gz: dc12b9fc5ddc5a40fc84968ac42716f3b19827f8af490dc3fb31aabf017655909e0a478beaa75ac7cc2ded55c3e9b7b337244d2abd0299419477833a34c00472
6
+ metadata.gz: da1f1c98e310bdbe5a8ec47ec76d2069854b64e1494979f2bda8b474d79305b87a6486995c27654670ebc0378384bab9203c41ce8b96c66068438ced9f74df7e
7
+ data.tar.gz: e63d5674621ab649b0e9b5df68a701528c3bd89b31bee4bc3e23d39585effc100a4a0560800c9531d00ff76e407c8705548368a0584f41d1c41283d61e4ae10f
data/Changelog.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## 0.0.7 / 2017-09-22
4
+
5
+ * Depend on GirFFI 0.11.0
6
+ * Require CRuby 2.1 or above
7
+
3
8
  ## 0.0.6 / 2016-03-23
4
9
 
5
10
  * Depend on GirFFI 0.10.0
@@ -1,17 +1,17 @@
1
+ GnomeKeyring.load_class :Attribute
1
2
  module GnomeKeyring
2
- load_class :Attribute
3
-
3
+ # Overrides for GnomeKeyringAttribute
4
4
  class Attribute
5
5
  setup_method 'list_new'
6
6
  setup_method 'list_append_string'
7
7
  setup_method 'list_append_uint32'
8
8
 
9
9
  private_class_method :list_new,
10
- :list_append_string,
11
- :list_append_uint32,
12
- :list_copy,
13
- :list_free,
14
- :list_to_glist
10
+ :list_append_string,
11
+ :list_append_uint32,
12
+ :list_copy,
13
+ :list_free,
14
+ :list_to_glist
15
15
 
16
16
  def make_finalizer
17
17
  # Don't make a finalizer; Use FFI's regular free of the pointer instead.
@@ -1,33 +1,34 @@
1
1
  require 'gir_ffi-gnome_keyring/attribute'
2
2
 
3
3
  module GnomeKeyring
4
+ # GLib::Array alias used when returning lists of GnomeKeyringAttribute.
4
5
  class AttributeList < GLib::Array
5
6
  def self.new
6
7
  ptr = GnomeKeyring::Lib.gnome_keyring_attribute_list_new
7
8
  wrap(ptr)
8
9
  end
9
10
 
10
- def self.wrap ptr
11
+ def self.wrap(ptr)
11
12
  super GnomeKeyring::Attribute, ptr
12
13
  end
13
14
 
14
- def self.from it
15
+ def self.from(it)
15
16
  case it
16
17
  when self then it
17
18
  when FFI::Pointer then wrap it
18
- else self.new.tap {|arr| arr.append_vals it }
19
+ else new.tap { |arr| arr.append_vals it }
19
20
  end
20
21
  end
21
22
 
22
- def append_string name, value
23
- _v2 = GirFFI::InPointer.from(:utf8, name)
24
- _v3 = GirFFI::InPointer.from(:utf8, value)
25
- GnomeKeyring::Lib.gnome_keyring_attribute_list_append_string self, _v2, _v3
23
+ def append_string(name, value)
24
+ v2 = GirFFI::InPointer.from(:utf8, name)
25
+ v3 = GirFFI::InPointer.from(:utf8, value)
26
+ GnomeKeyring::Lib.gnome_keyring_attribute_list_append_string self, v2, v3
26
27
  end
27
28
 
28
- def append_uint32 name, value
29
- _v2 = GirFFI::InPointer.from(:utf8, name)
30
- GnomeKeyring::Lib.gnome_keyring_attribute_list_append_uint32 self, _v2, value
29
+ def append_uint32(name, value)
30
+ v2 = GirFFI::InPointer.from(:utf8, name)
31
+ GnomeKeyring::Lib.gnome_keyring_attribute_list_append_uint32 self, v2, value
31
32
  end
32
33
 
33
34
  private
@@ -1,20 +1,19 @@
1
1
  require 'gir_ffi-gnome_keyring/attribute_list'
2
2
 
3
- module GnomeKeyring
4
- load_class :Found
3
+ GnomeKeyring.load_class :Found
5
4
 
5
+ module GnomeKeyring
6
+ # Overrides for GnomeKeyringFound
6
7
  class Found
7
8
  remove_method :attributes
8
9
  remove_method :attributes=
9
10
 
10
11
  def attributes
11
- struct = GnomeKeyring::Found::Struct.new(@struct.to_ptr)
12
- GnomeKeyring::AttributeList.wrap(struct[:attributes])
12
+ GnomeKeyring::AttributeList.wrap(@struct[:attributes])
13
13
  end
14
14
 
15
15
  def attributes=(value)
16
- struct = GnomeKeyring::Found::Struct.new(@struct.to_ptr)
17
- struct[:attributes] = GnomeKeyring::AttributeList.from(value)
16
+ @struct[:attributes] = GnomeKeyring::AttributeList.from(value)
18
17
  end
19
18
  end
20
19
  end
@@ -6,6 +6,7 @@ require 'gir_ffi-gnome_keyring/attribute'
6
6
  require 'gir_ffi-gnome_keyring/attribute_list'
7
7
  require 'gir_ffi-gnome_keyring/found'
8
8
 
9
+ # Overrides for GnomeKeyring singleton methods
9
10
  module GnomeKeyring
10
11
  setup_method :find_items_sync
11
12
  setup_method :item_create_sync
@@ -20,39 +21,37 @@ module GnomeKeyring
20
21
  end
21
22
 
22
23
  def self.find_items_sync(type, attributes)
23
- _v2 = GnomeKeyring::AttributeList.from(attributes)
24
- _v3 = FFI::MemoryPointer.new :pointer
25
- _v4 = GnomeKeyring::Lib.gnome_keyring_find_items_sync(type, _v2, _v3)
26
- _v5 = GLib::List.wrap(GnomeKeyring::Found, _v3.get_pointer(0))
27
- return [_v4, _v5]
24
+ v2 = GnomeKeyring::AttributeList.from(attributes)
25
+ v3 = FFI::MemoryPointer.new :pointer
26
+ v4 = GnomeKeyring::Lib.gnome_keyring_find_items_sync(type, v2, v3)
27
+ v5 = GLib::List.wrap(GnomeKeyring::Found, v3.get_pointer(0))
28
+ [v4, v5]
28
29
  end
29
30
 
30
31
  def self.item_create_sync(keyring, type, display_name, attributes, secret,
31
32
  update_if_exists)
32
- _v1 = GirFFI::InPointer.from_utf8(keyring)
33
- _v3 = GirFFI::InPointer.from_utf8(display_name)
34
- _v4 = GnomeKeyring::AttributeList.from(attributes)
35
- _v5 = GirFFI::InPointer.from_utf8(secret)
36
- _v7 = FFI::MemoryPointer.new :uint32
37
- _v8 = GnomeKeyring::Lib.gnome_keyring_item_create_sync(_v1, type, _v3, _v4,
38
- _v5,
39
- update_if_exists,
40
- _v7)
41
- _v9 = _v7.get_uint32(0)
42
- return [_v8, _v9]
33
+ v1 = GirFFI::InPointer.from_utf8(keyring)
34
+ v3 = GirFFI::InPointer.from_utf8(display_name)
35
+ v4 = GnomeKeyring::AttributeList.from(attributes)
36
+ v5 = GirFFI::InPointer.from_utf8(secret)
37
+ v7 = FFI::MemoryPointer.new :uint32
38
+ v8 = GnomeKeyring::Lib.gnome_keyring_item_create_sync(v1, type, v3, v4, v5,
39
+ update_if_exists, v7)
40
+ v9 = v7.get_uint32(0)
41
+ [v8, v9]
43
42
  end
44
43
 
45
44
  def self.item_get_attributes_sync(keyring, id)
46
- _v1 = GirFFI::InPointer.from_utf8(keyring)
47
- _v3 = FFI::MemoryPointer.new :pointer
48
- _v4 = GnomeKeyring::Lib.gnome_keyring_item_get_attributes_sync(_v1, id, _v3)
49
- attributes = GnomeKeyring::AttributeList.wrap(_v3.get_pointer(0))
50
- return [_v4, attributes]
45
+ v1 = GirFFI::InPointer.from_utf8(keyring)
46
+ v3 = FFI::MemoryPointer.new :pointer
47
+ v4 = GnomeKeyring::Lib.gnome_keyring_item_get_attributes_sync(v1, id, v3)
48
+ attributes = GnomeKeyring::AttributeList.wrap(v3.get_pointer(0))
49
+ [v4, attributes]
51
50
  end
52
51
 
53
52
  def self.item_set_attributes_sync(keyring, id, attributes)
54
- _v1 = GirFFI::InPointer.from_utf8(keyring)
55
- _v3 = GnomeKeyring::AttributeList.from(attributes)
56
- GnomeKeyring::Lib.gnome_keyring_item_set_attributes_sync(_v1, id, _v3)
53
+ v1 = GirFFI::InPointer.from_utf8(keyring)
54
+ v3 = GnomeKeyring::AttributeList.from(attributes)
55
+ GnomeKeyring::Lib.gnome_keyring_item_set_attributes_sync(v1, id, v3)
57
56
  end
58
57
  end
data/tasks/test.rake CHANGED
@@ -1,19 +1,18 @@
1
1
  require 'rake/testtask'
2
2
 
3
3
  namespace :test do
4
-
5
4
  Rake::TestTask.new(:unit) do |t|
6
5
  t.libs = ['lib']
7
6
  t.test_files = FileList['test/unit/**/*_test.rb']
8
- t.ruby_opts += ["-w -Itest"]
7
+ t.ruby_opts += ['-w -Itest']
9
8
  end
10
9
 
11
10
  Rake::TestTask.new(:integration) do |t|
12
11
  t.libs = ['lib']
13
12
  t.test_files = FileList['test/integration/*_test.rb']
14
- t.ruby_opts += ["-w -Itest"]
13
+ t.ruby_opts += ['-w -Itest']
15
14
  end
16
15
  end
17
16
 
18
17
  desc 'Run unit and integration tests'
19
- task :test => ['test:unit', 'test:integration']
18
+ task test: ['test:unit', 'test:integration']
data/tasks/yardoc.rake CHANGED
@@ -3,7 +3,8 @@ begin
3
3
 
4
4
  YARD::Rake::YardocTask.new do |t|
5
5
  t.files = ['lib/**/*.rb']
6
- t.options = ['--private', '--protected', '--readme', 'README.md']
6
+ t.options = ['--private', '--protected', '--readme', 'README.md']
7
7
  end
8
8
  rescue LoadError
9
+ nil # Do nothing
9
10
  end
@@ -1,38 +1,38 @@
1
1
  require 'test_helper'
2
2
 
3
3
  describe GnomeKeyring::AttributeList do
4
- it "descends from GLib::Array" do
4
+ it 'descends from GLib::Array' do
5
5
  GnomeKeyring::AttributeList.ancestors.must_include GLib::Array
6
6
  end
7
7
 
8
- describe ".new" do
9
- it "takes no arguments" do
8
+ describe '.new' do
9
+ it 'takes no arguments' do
10
10
  GnomeKeyring::AttributeList.new
11
11
  pass
12
12
  end
13
13
  end
14
14
 
15
- describe ".wrap" do
16
- it "wraps its argument in an AttributeList object" do
15
+ describe '.wrap' do
16
+ it 'wraps its argument in an AttributeList object' do
17
17
  orig = GnomeKeyring::AttributeList.new
18
18
  copy = GnomeKeyring::AttributeList.wrap(orig.to_ptr)
19
19
  copy.to_ptr.must_equal orig.to_ptr
20
20
  end
21
21
  end
22
22
 
23
- describe ".from" do
23
+ describe '.from' do
24
24
  it "wraps its argument's pointer in an AttributeList object" do
25
25
  orig = GnomeKeyring::AttributeList.new
26
26
  copy = GnomeKeyring::AttributeList.from(orig)
27
27
  copy.to_ptr.must_equal orig.to_ptr
28
28
  end
29
29
 
30
- it "wraps an empty array" do
30
+ it 'wraps an empty array' do
31
31
  attr = GnomeKeyring::AttributeList.from([])
32
32
  attr.to_a.must_equal []
33
33
  end
34
34
 
35
- it "wraps an array of Attribute" do
35
+ it 'wraps an array of Attribute' do
36
36
  att = GnomeKeyring::Attribute.new
37
37
  att.name = 'foo'
38
38
  attr = GnomeKeyring::AttributeList.from([att])
@@ -42,8 +42,8 @@ describe GnomeKeyring::AttributeList do
42
42
  end
43
43
  end
44
44
 
45
- describe "#append_string" do
46
- it "appends a string attribute" do
45
+ describe '#append_string' do
46
+ it 'appends a string attribute' do
47
47
  list = GnomeKeyring::AttributeList.new
48
48
  list.append_string 'foo', 'bar'
49
49
  attr = list.index(0)
@@ -53,8 +53,8 @@ describe GnomeKeyring::AttributeList do
53
53
  end
54
54
  end
55
55
 
56
- describe "#append_uint32" do
57
- it "appends a uint32 attribute" do
56
+ describe '#append_uint32' do
57
+ it 'appends a uint32 attribute' do
58
58
  list = GnomeKeyring::AttributeList.new
59
59
  list.append_uint32 'baz', 42
60
60
  attr = list.index(0)
@@ -1,38 +1,38 @@
1
1
  require 'test_helper'
2
2
 
3
3
  describe GnomeKeyring::Attribute do
4
- describe ".list_new" do
5
- it "is private" do
4
+ describe '.list_new' do
5
+ it 'is private' do
6
6
  proc { GnomeKeyring::Attribute.list_new }.must_raise NoMethodError
7
7
  end
8
8
  end
9
9
 
10
- describe ".list_append_string" do
11
- it "is private" do
10
+ describe '.list_append_string' do
11
+ it 'is private' do
12
12
  proc { GnomeKeyring::Attribute.list_append_string }.must_raise NoMethodError
13
13
  end
14
14
  end
15
15
 
16
- describe ".list_append_uint32" do
17
- it "is private" do
16
+ describe '.list_append_uint32' do
17
+ it 'is private' do
18
18
  proc { GnomeKeyring::Attribute.list_append_uint32 }.must_raise NoMethodError
19
19
  end
20
20
  end
21
21
 
22
- describe ".list_copy" do
23
- it "is private" do
22
+ describe '.list_copy' do
23
+ it 'is private' do
24
24
  proc { GnomeKeyring::Attribute.list_copy }.must_raise NoMethodError
25
25
  end
26
26
  end
27
27
 
28
- describe ".list_free" do
29
- it "is private" do
28
+ describe '.list_free' do
29
+ it 'is private' do
30
30
  proc { GnomeKeyring::Attribute.list_free }.must_raise NoMethodError
31
31
  end
32
32
  end
33
33
 
34
- describe ".list_to_glist" do
35
- it "is private" do
34
+ describe '.list_to_glist' do
35
+ it 'is private' do
36
36
  proc { GnomeKeyring::Attribute.list_to_glist }.must_raise NoMethodError
37
37
  end
38
38
  end
@@ -3,13 +3,13 @@ require 'test_helper'
3
3
  describe GnomeKeyring::Found do
4
4
  let(:instance) { GnomeKeyring::Found.new }
5
5
 
6
- describe "#attributes" do
7
- it "returns nil by default" do
6
+ describe '#attributes' do
7
+ it 'returns nil by default' do
8
8
  attrs = instance.attributes
9
9
  attrs.must_be_nil
10
10
  end
11
11
 
12
- it "returns an assigned AttributeList" do
12
+ it 'returns an assigned AttributeList' do
13
13
  attrs = GnomeKeyring::AttributeList.new
14
14
  struct = GnomeKeyring::Found::Struct.new(instance.to_ptr)
15
15
  struct[:attributes] = attrs.to_ptr
@@ -20,8 +20,8 @@ describe GnomeKeyring::Found do
20
20
  end
21
21
  end
22
22
 
23
- describe "#attributes=" do
24
- it "assigns its argument to the correct struct member" do
23
+ describe '#attributes=' do
24
+ it 'assigns its argument to the correct struct member' do
25
25
  attrs = GnomeKeyring::AttributeList.new
26
26
  instance.attributes = attrs
27
27
  struct = GnomeKeyring::Found::Struct.new(instance.to_ptr)
@@ -1,8 +1,8 @@
1
1
  require 'test_helper'
2
2
 
3
3
  describe GnomeKeyring do
4
- describe ".find_items_sync" do
5
- it "calls Lib.gnome_keyring_find_items_sync with the correct values" do
4
+ describe '.find_items_sync' do
5
+ it 'calls Lib.gnome_keyring_find_items_sync with the correct values' do
6
6
  body = lambda { |type, attrs, listptr|
7
7
  type.must_equal :generic_secret
8
8
  attrs.must_be_instance_of GnomeKeyring::AttributeList
@@ -18,14 +18,14 @@ describe GnomeKeyring do
18
18
  end
19
19
  end
20
20
 
21
- describe ".item_create_sync" do
22
- it "calls Lib.gnome_keyring_item_create_sync with the correct values" do
21
+ describe '.item_create_sync' do
22
+ it 'calls Lib.gnome_keyring_item_create_sync with the correct values' do
23
23
  body = lambda { |keyring, type, display_name, attributes, secret, update_if_exists, item_id|
24
- keyring.to_utf8.must_equal "foo"
24
+ keyring.to_utf8.must_equal 'foo'
25
25
  type.must_equal :generic_secret
26
- display_name.to_utf8.must_equal "bar"
26
+ display_name.to_utf8.must_equal 'bar'
27
27
  attributes.must_be_instance_of GnomeKeyring::AttributeList
28
- secret.to_utf8.must_equal "secret-name"
28
+ secret.to_utf8.must_equal 'secret-name'
29
29
  update_if_exists.must_equal false
30
30
 
31
31
  item_id.put_int32 0, 42
@@ -33,46 +33,46 @@ describe GnomeKeyring do
33
33
  }
34
34
 
35
35
  GnomeKeyring::Lib.stub :gnome_keyring_item_create_sync, body do
36
- code, id = GnomeKeyring.item_create_sync("foo",
37
- :generic_secret,
38
- "bar",
39
- [],
40
- "secret-name",
41
- false)
36
+ code, id = GnomeKeyring.item_create_sync('foo',
37
+ :generic_secret,
38
+ 'bar',
39
+ [],
40
+ 'secret-name',
41
+ false)
42
42
  code.must_equal :ok
43
43
  id.must_equal 42
44
44
  end
45
45
  end
46
46
  end
47
47
 
48
- describe ".item_get_attributes_sync" do
49
- it "calls Lib.gnome_keyring_item_get_attributes_sync with the correct values" do
48
+ describe '.item_get_attributes_sync' do
49
+ it 'calls Lib.gnome_keyring_item_get_attributes_sync with the correct values' do
50
50
  body = lambda { |keyring, id, attributes|
51
- keyring.to_utf8.must_equal "foo"
51
+ keyring.to_utf8.must_equal 'foo'
52
52
  id.must_equal 42
53
53
  attributes.must_be_instance_of FFI::MemoryPointer
54
54
  :ok
55
55
  }
56
56
 
57
57
  GnomeKeyring::Lib.stub :gnome_keyring_item_get_attributes_sync, body do
58
- code, list = GnomeKeyring.item_get_attributes_sync "foo", 42
58
+ code, list = GnomeKeyring.item_get_attributes_sync 'foo', 42
59
59
  code.must_equal :ok
60
60
  list.must_be_nil
61
61
  end
62
62
  end
63
63
  end
64
64
 
65
- describe ".item_set_attributes_sync" do
66
- it "calls Lib.gnome_keyring_item_set_attributes_sync with the correct values" do
65
+ describe '.item_set_attributes_sync' do
66
+ it 'calls Lib.gnome_keyring_item_set_attributes_sync with the correct values' do
67
67
  body = lambda { |keyring, id, attributes|
68
- keyring.to_utf8.must_equal "foo"
68
+ keyring.to_utf8.must_equal 'foo'
69
69
  id.must_equal 42
70
70
  attributes.must_be_instance_of GnomeKeyring::AttributeList
71
71
  :ok
72
72
  }
73
73
 
74
74
  GnomeKeyring::Lib.stub :gnome_keyring_item_set_attributes_sync, body do
75
- result = GnomeKeyring.item_set_attributes_sync "foo", 42, []
75
+ result = GnomeKeyring.item_set_attributes_sync 'foo', 42, []
76
76
  result.must_equal :ok
77
77
  end
78
78
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gir_ffi-gnome_keyring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
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: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gir_ffi
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.0
19
+ version: 0.11.0
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: 0.10.0
26
+ version: 0.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '11.1'
47
+ version: '12.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '11.1'
54
+ version: '12.0'
55
55
  description: Bindings for GnomeKeyring generated by GirFFI, with overrides.
56
56
  email:
57
57
  - matijs@matijs.net
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: '0'
92
+ version: 2.1.0
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.5.1
100
+ rubygems_version: 2.6.13
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: GirFFI-based binding to GnomeKeyring