rb-kqueue 0.2.4 → 0.2.5

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: 2e0fbb1227b72dfcf7a88a6518c1d682eb7b16cc
4
- data.tar.gz: 1b116b3d52ff04e5d31a78ef819020a6a6001c6e
3
+ metadata.gz: 17d3f6e0c04fea13fd34ab65ff0d7248e02535e7
4
+ data.tar.gz: 47c725707074d7452391a24a4ddbfe9c6f22c9b4
5
5
  SHA512:
6
- metadata.gz: 5ada986f6476b4d522a5103fd2d56623a0dd7b86f271c7549c4a2fb9d0722492574446c09b8aa023ed059837fc8122fb30969436510798957a7b95e6a3c5c69f
7
- data.tar.gz: 712ae220aa51c262ba8126909fcd6d1d9b981c2fa9cb6900b70629085e46bbab0ff775eebdcd6656100843a581f77a16c5c4a71a63f01f3a8d4dba3b07a48c02
6
+ metadata.gz: 0d10f7f56be61427716f439cbe99f908eb9de2f64d99ed475e360dc256a7c6c8af2a258d1e3c7eb9f320e87b7b4584f7b1e8dfd7e2dd99e62de5bacc45ff0f87
7
+ data.tar.gz: 4bb2578457195f0706bf08609ad669ae1cabd630d0c0962542ec8ef07142783b5c06eafdbf104c19553cde622397e46d776450dbbf4ced3bd8bfa1e252cd3e71
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -13,13 +13,39 @@ module KQueue
13
13
  #
14
14
  # @private
15
15
  class KEvent < FFI::Struct
16
- layout(
17
- :ident, :uintptr_t,
18
- :filter, :int16,
19
- :flags, :uint16,
20
- :fflags, :uint32,
21
- :data, :intptr_t,
22
- :udata, :pointer)
16
+ if FFI::Platform::IS_FREEBSD
17
+ layout(
18
+ :ident, :uintptr_t,
19
+ :filter, :short,
20
+ :flags, :u_short,
21
+ :fflags, :u_int,
22
+ :data, :intptr_t,
23
+ :udata, :pointer)
24
+ elsif FFI::Platform::IS_NETBSD
25
+ layout(
26
+ :ident, :uintptr_t,
27
+ :filter, :uint32_t,
28
+ :flags, :uint32_t,
29
+ :fflags, :uint32_t,
30
+ :data, :int64_t,
31
+ :udata, :pointer)
32
+ elsif FFI::Platform::IS_OPENBSD
33
+ layout(
34
+ :ident, :__uintptr_t,
35
+ :filter, :short,
36
+ :flags, :u_short,
37
+ :fflags, :u_int,
38
+ :data, :quad_t,
39
+ :udata, :pointer)
40
+ else
41
+ layout(
42
+ :ident, :uintptr_t,
43
+ :filter, :int16,
44
+ :flags, :uint16,
45
+ :fflags, :uint32,
46
+ :data, :intptr_t,
47
+ :udata, :pointer)
48
+ end
23
49
  end
24
50
 
25
51
  # The C struct describing a timeout.
@@ -6,17 +6,50 @@ module KQueue
6
6
  # @private
7
7
  module Flags
8
8
  # Filters
9
- EVFILT_READ = -1
10
- EVFILT_WRITE = -2
11
- EVFILT_AIO = -3 # Attached to aio requests
12
- EVFILT_VNODE = -4 # Attached to vnodes
13
- EVFILT_PROC = -5 # Attached to struct proc
14
- EVFILT_SIGNAL = -6 # Attached to struct proc
15
- EVFILT_TIMER = -7 # Timers
16
- EVFILT_MACHPORT = -8 # Mach portsets
17
- EVFILT_FS = -9 # Filesystem events
18
- EVFILT_USER = -10 # User events
19
- EVFILT_SESSION = -11 # Audit session events
9
+ if FFI::Platform::IS_FREEBSD
10
+ EVFILT_READ = -1
11
+ EVFILT_WRITE = -2
12
+ EVFILT_AIO = -3 # Attached to aio requests
13
+ EVFILT_VNODE = -4 # Attached to vnodes
14
+ EVFILT_PROC = -5 # Attached to struct proc
15
+ EVFILT_SIGNAL = -6 # Attached to struct proc
16
+ EVFILT_TIMER = -7 # Timers
17
+ EVFILT_PROCDESC = -8 # Attached to process descriptors
18
+ EVFILT_FS = -9 # Filesystem events
19
+ EVFILT_LIO = -10 # Attached to lio requests
20
+ EVFILT_USER = -11 # User events
21
+ EVFILT_SENDFILE = -12 # Attached to sendfile requests
22
+ EVFILT_SYSCOUNT = 12
23
+ elsif FFI::Platform::IS_NETBSD
24
+ EVFILT_READ = 0
25
+ EVFILT_WRITE = 1
26
+ EVFILT_AIO = 2 # Attached to aio requests
27
+ EVFILT_VNODE = 3 # Attached to vnodes
28
+ EVFILT_PROC = 4 # Attached to struct proc
29
+ EVFILT_SIGNAL = 5 # Attached to struct proc
30
+ EVFILT_TIMER = 6 # Arbitrary timer (in ms)
31
+ EVFILT_SYSCOUNT = 7 # Number of filters
32
+ elsif FFI::Platform::IS_OPENBSD
33
+ EVFILT_READ = -1
34
+ EVFILT_WRITE = -2
35
+ EVFILT_AIO = -3 # Attached to aio requests
36
+ EVFILT_VNODE = -4 # Attached to vnodes
37
+ EVFILT_PROC = -5 # Attached to struct proc
38
+ EVFILT_SIGNAL = -6 # Attached to struct proc
39
+ EVFILT_TIMER = -7 # Timers
40
+ else
41
+ EVFILT_READ = -1
42
+ EVFILT_WRITE = -2
43
+ EVFILT_AIO = -3 # Attached to aio requests
44
+ EVFILT_VNODE = -4 # Attached to vnodes
45
+ EVFILT_PROC = -5 # Attached to struct proc
46
+ EVFILT_SIGNAL = -6 # Attached to struct proc
47
+ EVFILT_TIMER = -7 # Timers
48
+ EVFILT_MACHPORT = -8 # Mach portsets
49
+ EVFILT_FS = -9 # Filesystem events
50
+ EVFILT_USER = -10 # User events
51
+ EVFILT_SESSION = -11 # Audit session events
52
+ end
20
53
 
21
54
 
22
55
  # Actions
@@ -1,3 +1,3 @@
1
1
  module KQueue
2
- VERSION = [0, 2, 4]
2
+ VERSION = [0, 2, 5]
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
 
12
12
  gem.authors = ["Mathieu Arnold", "Nathan Weizenbaum"]
13
13
  gem.email = %q{mat@mat.cc nex342@gmail.com}
14
- gem.date = %q{2015-05-01}
14
+ gem.date = %q{2017-05-16}
15
15
  gem.description = %q{A Ruby wrapper for BSD's kqueue, using FFI}
16
16
  gem.extra_rdoc_files = %w(README.md)
17
17
  gem.licenses = ['MIT']
@@ -28,5 +28,6 @@ Gem::Specification.new do |gem|
28
28
 
29
29
  gem.add_runtime_dependency(%q<ffi>, [">= 0.5.0"])
30
30
  gem.add_development_dependency(%q<yard>, [">= 0.4.0"])
31
+ gem.add_development_dependency(%q<rspec>, [">= 3.3.0"])
31
32
  end
32
33
 
@@ -0,0 +1,32 @@
1
+ require_relative '../lib/rb-kqueue'
2
+ require 'tempfile'
3
+ require 'pathname'
4
+
5
+ RSpec.describe KQueue::Queue do
6
+ describe '#watch_file' do
7
+ let(:file_touched) { false }
8
+ let(:queue) { KQueue::Queue.new }
9
+ let(:file) { Tempfile.new 'rb-kqueue_test', Pathname(__dir__).parent.join('tmp') }
10
+
11
+ context 'file is watched for writes' do
12
+ before do
13
+ queue.watch_file file.path, :write do
14
+ file_touched = !file_touched
15
+ end
16
+ queue.process
17
+ end
18
+
19
+ context 'file is written to' do
20
+ it 'executes the defined block' do
21
+ expect { file.write 'test' }.to change { file_touched }.from(false).to true
22
+ end
23
+ end
24
+ end
25
+
26
+ context 'file is watched for reads' do
27
+ end
28
+
29
+ context 'file is not watched' do
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,96 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Allows RSpec to persist some state between runs in order to support
54
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
55
+ # you configure your source control system to ignore this file.
56
+ config.example_status_persistence_file_path = "spec/examples.txt"
57
+
58
+ # Limits the available syntax to the non-monkey patched syntax that is
59
+ # recommended. For more details, see:
60
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
61
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
63
+ config.disable_monkey_patching!
64
+
65
+ # This setting enables warnings. It's recommended, but in some cases may
66
+ # be too noisy due to issues in dependencies.
67
+ config.warnings = true
68
+
69
+ # Many RSpec users commonly either run the entire suite or an individual
70
+ # file, and it's useful to allow more verbose output when running an
71
+ # individual spec file.
72
+ if config.files_to_run.one?
73
+ # Use the documentation formatter for detailed output,
74
+ # unless a formatter has already been configured
75
+ # (e.g. via a command-line flag).
76
+ config.default_formatter = 'doc'
77
+ end
78
+
79
+ # Print the 10 slowest examples and example groups at the
80
+ # end of the spec run, to help surface which specs are running
81
+ # particularly slow.
82
+ config.profile_examples = 10
83
+
84
+ # Run specs in random order to surface order dependencies. If you find an
85
+ # order dependency and want to debug it, you can fix the order by providing
86
+ # the seed, which is printed after each run.
87
+ # --seed 1234
88
+ config.order = :random
89
+
90
+ # Seed global randomization in this process using the `--seed` CLI option.
91
+ # Setting this allows you to use `--seed` to deterministically reproduce
92
+ # test failures related to randomization by passing the same `--seed` value
93
+ # as the one that triggered the failure.
94
+ Kernel.srand config.seed
95
+ =end
96
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-kqueue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathieu Arnold
@@ -9,36 +9,50 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-01 00:00:00.000000000 Z
12
+ date: 2017-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.5.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 0.5.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: yard
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.4.0
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 0.4.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 3.3.0
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.3.0
42
56
  description: A Ruby wrapper for BSD's kqueue, using FFI
43
57
  email: mat@mat.cc nex342@gmail.com
44
58
  executables: []
@@ -46,8 +60,9 @@ extensions: []
46
60
  extra_rdoc_files:
47
61
  - README.md
48
62
  files:
49
- - .gitignore
50
- - .yardopts
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".yardopts"
51
66
  - Gemfile
52
67
  - MIT-LICENSE
53
68
  - README.md
@@ -67,29 +82,33 @@ files:
67
82
  - lib/rb-kqueue/watcher/socket_read_write.rb
68
83
  - lib/rb-kqueue/watcher/timer.rb
69
84
  - rb-kqueue.gemspec
85
+ - spec/kqueue_queue_spec.rb
86
+ - spec/spec_helper.rb
70
87
  homepage: http://github.com/mat813/rb-kqueue
71
88
  licenses:
72
89
  - MIT
73
90
  metadata: {}
74
91
  post_install_message:
75
92
  rdoc_options:
76
- - --charset=UTF-8
93
+ - "--charset=UTF-8"
77
94
  require_paths:
78
95
  - lib
79
96
  required_ruby_version: !ruby/object:Gem::Requirement
80
97
  requirements:
81
- - - '>='
98
+ - - ">="
82
99
  - !ruby/object:Gem::Version
83
100
  version: '0'
84
101
  required_rubygems_version: !ruby/object:Gem::Requirement
85
102
  requirements:
86
- - - '>='
103
+ - - ">="
87
104
  - !ruby/object:Gem::Version
88
105
  version: '0'
89
106
  requirements: []
90
107
  rubyforge_project:
91
- rubygems_version: 2.2.2
108
+ rubygems_version: 2.4.8
92
109
  signing_key:
93
110
  specification_version: 4
94
111
  summary: A Ruby wrapper for BSD's kqueue, using FFI
95
- test_files: []
112
+ test_files:
113
+ - spec/kqueue_queue_spec.rb
114
+ - spec/spec_helper.rb