libvirt_async 0.3.2 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ceed699e8f54337a21a865a705812aa9e9dc254f09e940c5a7599ffe0bd636b
4
- data.tar.gz: 220744ac997b245a94ff5bcb3fc8e876b94a78e58198c06eb2442cb43cdfaee3
3
+ metadata.gz: a09af72032f53f8c42c5b94d07545ea1d83162f27b43cc37bf7b76299c09bce3
4
+ data.tar.gz: 36871662bf7af1a333a0e5209ee280b992bb65c4eca5d57dd9f540b046137f9b
5
5
  SHA512:
6
- metadata.gz: 4eee9029a3ffad0987f7b687c88384db43c498832cf1bedabecd9a013bffd6d015f6ab01dc136907db05232fa95bb8c3939d0b90ab4358181ec80a73121133eb
7
- data.tar.gz: c51ef28c2fe03d74f400865742331e29ab197a9ae2bb6de2b106c0937b539d7385c2aa89a1fe299d07a5a27ee425a321f17be6094d6a62d2ea763e7776faa663
6
+ metadata.gz: 826e01d8be353bc9dbb9e920ebc4c879970218c6c8808d1db77d3fbd2145ef1a77b894ac5ffb0232381ff45f45a0d667ccd84b9d885c8198c014bc78a0c99123
7
+ data.tar.gz: 3d85a9f6c6eb9bc7b8c9eec53c9880c79892cc74bf2798473469397c750a9e0d6e589eb42c63901c3984b5f109567df7ce7d5d78ec9830bbd7c8111e5b1db29f
@@ -0,0 +1,24 @@
1
+ name: Tests
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.7', '3.0' ]
14
+ name: Tests with Ruby ${{ matrix.ruby }}
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - name: Run tests
21
+ run: |
22
+ gem install bundler
23
+ bundle install
24
+ bundle exec rake
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in libvirt_async.gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
3
5
 
data/bin/console CHANGED
File without changes
data/bin/setup CHANGED
File without changes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LibvirtAsync
2
4
  class Error < StandardError
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LibvirtAsync
2
4
  class Handle
3
5
  # Represents an event handle (usually a file descriptor). When an event
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'async'
2
4
  require 'libvirt_async/with_dbg'
3
5
  require 'libvirt_async/util'
@@ -68,10 +70,16 @@ module LibvirtAsync
68
70
  remove_handle: method(:remove_handle).to_proc,
69
71
  add_timer: method(:add_timer).to_proc,
70
72
  update_timer: method(:update_timer).to_proc,
71
- remove_timer: method(:remove_timer).to_proc
73
+ remove_timer: method(:remove_timer).to_proc,
74
+ schedule: method(:schedule).to_proc
72
75
  )
73
76
  end
74
77
 
78
+ def schedule(&block)
79
+ t = Async::Task.new(Async::Task.current.reactor, nil, &block)
80
+ t.reactor << t.fiber
81
+ end
82
+
75
83
  def add_handle(fd, events, opaque)
76
84
  # add a handle to be tracked by this object. The application is
77
85
  # expected to maintain a list of internal handle IDs (integers); this
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LibvirtAsync
2
4
  class LogFormatter
3
5
  LOG_FORMAT = "%s, %s [%d/%s/%s] %s\n".freeze
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LibvirtAsync
2
4
  class StreamRead
3
5
  # StreamRead allows to work with stream in non-block read mode.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LibvirtAsync
2
4
  class Timer
3
5
  # Represents a When a timer expires, we dispatch the event to
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LibvirtAsync
2
4
  module Util
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LibvirtAsync
2
- VERSION = '0.3.2'
4
+ VERSION = '0.4.0'
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/concern'
2
4
 
3
5
  module LibvirtAsync
data/lib/libvirt_async.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'logger'
2
4
  require 'libvirt_async/version'
3
5
  require 'libvirt_async/error'
@@ -44,8 +46,8 @@ module LibvirtAsync
44
46
 
45
47
  module_function :build_logger
46
48
 
47
- def use_logger!(io = STDOUT, options = {})
48
- self.logger = build_logger(io, options)
49
+ def use_logger!(io = STDOUT, **options)
50
+ self.logger = build_logger(io, **options)
49
51
  end
50
52
 
51
53
  module_function :use_logger!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libvirt_async
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Talakevich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-28 00:00:00.000000000 Z
11
+ date: 2022-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libvirt_ffi
@@ -60,6 +60,7 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - ".github/workflows/tests.yml"
63
64
  - ".gitignore"
64
65
  - ".travis.yml"
65
66
  - CHANGELOG.md
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  - !ruby/object:Gem::Version
104
105
  version: '0'
105
106
  requirements: []
106
- rubygems_version: 3.0.6
107
+ rubygems_version: 3.2.32
107
108
  signing_key:
108
109
  specification_version: 4
109
110
  summary: Libvirt event async implementation.