celluloid-zmq 0.16.1 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -7
  3. data/Gemfile +2 -8
  4. data/celluloid-zmq.gemspec +2 -5
  5. data/culture/CODE_OF_CONDUCT.md +28 -0
  6. data/culture/Gemfile +9 -0
  7. data/culture/README.md +22 -0
  8. data/culture/Rakefile +5 -0
  9. data/culture/SYNC.md +70 -0
  10. data/culture/celluloid-culture.gemspec +18 -0
  11. data/culture/gems/README.md +39 -0
  12. data/culture/gems/dependencies.yml +84 -0
  13. data/culture/gems/loader.rb +101 -0
  14. data/culture/rubocop/README.md +38 -0
  15. data/culture/rubocop/lint.yml +8 -0
  16. data/culture/rubocop/metrics.yml +15 -0
  17. data/culture/rubocop/rubocop.yml +4 -0
  18. data/culture/rubocop/style.yml +48 -0
  19. data/culture/spec/gems_spec.rb +2 -0
  20. data/culture/spec/spec_helper.rb +0 -0
  21. data/culture/spec/sync_spec.rb +2 -0
  22. data/culture/sync.rb +56 -0
  23. data/culture/tasks/rspec.rake +5 -0
  24. data/culture/tasks/rubocop.rake +2 -0
  25. data/examples/publish_subscribe.rb +8 -6
  26. data/lib/celluloid/zmq.rb +17 -3
  27. data/lib/celluloid/zmq/current.rb +2 -0
  28. data/lib/celluloid/zmq/deprecate.rb +15 -0
  29. data/lib/celluloid/zmq/mailbox.rb +1 -1
  30. data/lib/celluloid/zmq/reactor.rb +4 -3
  31. data/lib/celluloid/zmq/socket.rb +75 -0
  32. data/lib/celluloid/zmq/socket/readable.rb +46 -0
  33. data/lib/celluloid/zmq/socket/types.rb +104 -0
  34. data/lib/celluloid/zmq/socket/writable.rb +30 -0
  35. data/lib/celluloid/zmq/version.rb +1 -1
  36. data/lib/celluloid/zmq/waker.rb +4 -2
  37. data/log/test.log +23785 -0
  38. data/spec/celluloid/zmq/actor_spec.rb +1 -1
  39. data/spec/celluloid/zmq/socket_spec.rb +1 -1
  40. data/spec/celluloid/zmq_spec.rb +4 -4
  41. data/spec/spec_helper.rb +23 -0
  42. metadata +287 -35
  43. data/lib/celluloid/zmq/sockets.rb +0 -222
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c02acaa3645eadd8a7ed78d11d7db2d7b936d93b
4
- data.tar.gz: 647a4d4ba4e154409647be0a5f50b6495b37b9d4
3
+ metadata.gz: e422e2646f285c80a54a9ccd97ba55c34ab7efcd
4
+ data.tar.gz: b4ffc044fe8a8f4c1debf64718b1606e153132f1
5
5
  SHA512:
6
- metadata.gz: 363f8c86f53659e1fb6d8fa101101d39205060fe05d1cc47bbd5e5beb98d831d57416a30590be4757ac6f68868a6cd8d79056113fbfbbf61034a29e3f24aa3b2
7
- data.tar.gz: 22717696a52737c7894d86b597d3552741b8e95b40839ab71dbbf68df970b442fa071d2e084d68ec8745507f06a06201b02748924c154838c64ae31621554d6b
6
+ metadata.gz: fb33860007166b00eb2a75851d4fa449cb6075d2f88c9dee707eb4da563d0cbacb8a28be2658c5325e3a70619a893eb598791cffc0e3563596e1eb16a9f576ef
7
+ data.tar.gz: a0426f7a176ed76d86c01203111fcb878d29293686c5757f3c0099295ca8d9cc4eb78c6201e4961022fa9723ea6aa60e1813ac63fdbb3564dbbd91228944e5af
data/CHANGES.md CHANGED
@@ -1,37 +1,43 @@
1
+ 0.70.0
2
+ -----
3
+ * Adapted to be compliant with version 0.17.0 of Celluloid.
4
+ * Added `write_to` for use with `Router` sockets.
5
+ * Added more direct set/get of socket identity.
6
+
1
7
  0.16.1 (2015-04-26)
2
- -------------------
8
+ -----
3
9
  * Support for XPUB sockets
4
10
  * Support for reading multipart messages
5
11
  * Spec cleanup
6
12
 
7
13
  0.16.0 (2014-09-04)
8
- -------------------
14
+ -----
9
15
  * Support for setting socket options
10
16
  * More specs
11
17
 
12
18
  0.15.0 (2013-09-04)
13
- -------------------
19
+ -----
14
20
  * Tracking release for Celluloid 0.15
15
21
 
16
22
  0.14.0 (2013-05-07)
17
- -------------------
23
+ -----
18
24
  * Add pubsub example
19
25
  * Add identity support to Sockets
20
26
  * Depend on EventedMailbox from core instead of celluloid-io
21
27
  * Remove overhead for IO waiting by calling directly to the reactor
22
28
 
23
29
  0.13.0
24
- ------
30
+ -----
25
31
  * Feature: Support for DealerSocket and RouterSocket
26
32
  * Support for the #more_parts? method on sockets
27
33
  * Celluloid 0.13 compatibility fixes
28
34
 
29
35
  0.12.0
30
- ------
36
+ -----
31
37
  * Tracking release for Celluloid 0.12.0
32
38
 
33
39
  0.10.0
34
- ------
40
+ -----
35
41
  * Factor celluloid-zmq into its own gem
36
42
  * #linger= support
37
43
 
data/Gemfile CHANGED
@@ -1,8 +1,2 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'coveralls', require: false
4
- gem 'celluloid', github: 'celluloid/celluloid', branch: 'master'
5
- gem 'transpec', github: 'yujinakayama/transpec', tag: 'v3.1.0'
6
-
7
- # Specify your gem's dependencies in celluloid-zmq.gemspec
8
- gemspec
1
+ require File.expand_path("../culture/sync", __FILE__)
2
+ Celluloid::Sync::Gemfile[self]
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/celluloid/zmq/version', __FILE__)
2
+ require File.expand_path("../culture/sync", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Tony Arcieri"]
@@ -12,13 +12,10 @@ Gem::Specification.new do |gem|
12
12
  gem.name = "celluloid-zmq"
13
13
  gem.version = Celluloid::ZMQ::VERSION
14
14
 
15
- gem.add_dependency "celluloid", "~> 0.16"
15
+ Celluloid::Sync::Gemspec[gem]
16
16
  gem.add_dependency "ffi"
17
17
  gem.add_dependency "ffi-rzmq"
18
18
 
19
- gem.add_development_dependency "rake"
20
- gem.add_development_dependency "rspec", "~> 3.0"
21
-
22
19
  # Files
23
20
  ignores = File.read(".gitignore").split(/\r?\n/).reject{ |f| f =~ /^(#.+|\s*)$/ }.map {|f| Dir[f] }.flatten
24
21
  gem.files = (Dir['**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
@@ -0,0 +1,28 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all
4
+ people who contribute through reporting issues, posting feature requests,
5
+ updating documentation, submitting pull requests or patches, and other
6
+ activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, age, or religion.
12
+
13
+ Examples of unacceptable behavior by participants include the use of sexual
14
+ language or imagery, derogatory comments or personal attacks, trolling, public
15
+ or private harassment, insults, or other unprofessional conduct.
16
+
17
+ Project maintainers have the right and responsibility to remove, edit, or
18
+ reject comments, commits, code, wiki edits, issues, and other contributions
19
+ that are not aligned to this Code of Conduct. Project maintainers who do not
20
+ follow the Code of Conduct may be removed from the project team.
21
+
22
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
23
+ reported by opening an issue or contacting one or more of the project
24
+ maintainers.
25
+
26
+ This Code of Conduct is adapted from the [Contributor Covenant](http
27
+ :contributor-covenant.org), version 1.0.0, available at [http://contributor-
28
+ covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/culture/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ group :development, :test do
4
+ gem "rubocop"
5
+ gem "rspec"
6
+ gem "rake"
7
+ end
8
+
9
+ gemspec
data/culture/README.md ADDED
@@ -0,0 +1,22 @@
1
+ Celluloid::Culture
2
+ ==================
3
+ [![Build Status](https://travis-ci.org/celluloid/culture.svg)](https://travis-ci.org/celluloid/culture)
4
+
5
+ ### Please see...
6
+ * Important [issues for discussion](/celluloid/culture/issues).
7
+ * Information about [Celluloid::Sync](SYNC.md).
8
+ * Information about [RuboCop](rubocop/README.md).
9
+
10
+
11
+ ## Integration
12
+ To add `celluloid/culture` and its many splendors to a gem, install it as a sub-module of the gem repository. Once you fully integrate [`Celluloid::Sync`](SYNC.md), the sub-module will be automatically refreshed.
13
+
14
+ ##### Add celluloid/culture as GIT submodule:
15
+ ```sh
16
+ git submodule add http://github.com/celluloid/culture.git
17
+ ```
18
+
19
+ Make sure `http://` is used and no other method of inclusion. CI needs it to be `http://`
20
+
21
+ ### Then what?
22
+ Once you've done that, read up on [Celluloid::Sync](SYNC.md) and [RuboCop](rubocop/README.md).
data/culture/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ Dir["tasks/**/*.rake"].each { |task| load task }
4
+
5
+ task default: "rubocop"
data/culture/SYNC.md ADDED
@@ -0,0 +1,70 @@
1
+ # Celluloid::Sync
2
+
3
+ The `celluloid/culture` sub-module needs to be updated in ever repository which uses it, and integrations between all the gems in Celluloid's core suite began to need greater efficiency in handling many gems at once. This lead to the birth of `Celluloid::Sync` and its automation of several otherwise tedious tasks.
4
+
5
+
6
+ ## When all is said and done...
7
+
8
+ Running `bundle` or `rspec` will trigger `Celluloid::Sync` automatically, without slowing you down.
9
+
10
+ ---
11
+
12
+ ## So what does it do?
13
+
14
+ **1. It adds the gem you're in to the `$LOADPATH`.**
15
+
16
+ **2. It tries to find the `VERSION` constant for the current gem and load it.**
17
+
18
+ This allows easy inclusion of `VERSION` in gemspec, without individually including the required file first.
19
+
20
+ **3. It updates the `celluloid/culture` sub-module.**
21
+
22
+ Whenever `bundle` is run, the `culture/` directory is synchronized with the repository before it's used any further.
23
+
24
+ **4. It keeps `Gemfile` and `gemspec` requirements up to date.**
25
+
26
+ Avoid circular dependency errors, but still have the power to use locally sourced repositories.
27
+
28
+ ---
29
+
30
+ ## How is it installed in `Gemfile` and `gemspec` then?
31
+
32
+ Add the line above to the top of both files, before everything else:
33
+
34
+
35
+ ```ruby
36
+ require File.expand_path("../culture/sync", __FILE__)
37
+ ```
38
+
39
+
40
+ #### Finishing off `gemspec` ...
41
+
42
+ You only have one other line to add, other than line above ... right before the closing `end` in the file:
43
+
44
+ ```ruby
45
+ require File.expand_path("../culture/sync", __FILE__)
46
+ Gem::Specification.new do |gem|
47
+ # ...
48
+ # ...
49
+ # Keep in mind, the VERSION constant of this gem ought to be loaded.
50
+ # ...
51
+ # ...
52
+ Celluloid::Sync.gems(gem)
53
+ end
54
+
55
+ ```
56
+
57
+ #### Finishing off `Gemfile` ...
58
+
59
+ Same as in `gemspec` you have only two bits to add. The second line we're adding goes at the very end, or at least after `gemspec` is called:
60
+
61
+ ```ruby
62
+ require File.expand_path("../culture/sync", __FILE__)
63
+
64
+ # ...
65
+ # below any calls to `gemspec`
66
+ # below any other gems
67
+ # ...
68
+
69
+ Celluloid::Sync.gems(self)
70
+ ```
@@ -0,0 +1,18 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "celluloid-culture"
5
+ spec.version = "0.1.1"
6
+ spec.authors = ["Tony Arcieri"]
7
+ spec.email = ["bascule@gmail.com"]
8
+
9
+ spec.summary = "The culture of Celluloid, in RubyGem form!"
10
+ spec.description = "In which we try to codify Celluloid's life philosophy as Ruby"
11
+ spec.homepage = "https://github.com/celluloid/culture"
12
+
13
+ spec.files = Dir["README.md", "CHANGES.md", "LICENSE.txt", "lib/**/*", "spec/**/*"]
14
+ spec.require_path = "lib"
15
+
16
+ spec.add_development_dependency "bundler", "~> 1.9"
17
+ spec.add_development_dependency "rake", "~> 10.0"
18
+ end
@@ -0,0 +1,39 @@
1
+ # Motivation
2
+ To achieve the higher level of modularity, Celluloid was split into small sub-projects that naturally depend on each other.
3
+ Bundler can't handle circular dependencies properly and currently the only workaround is to list all celluloid-ish dependencies in both Gemfile and gemspec.
4
+ This is error-prone and not efficient. Thus it was required to put some better workaround in place.
5
+
6
+ # Configuration
7
+ The list of gems and their properties are now defined in `dependencies.yml`.
8
+
9
+ For example:
10
+
11
+ ```yml
12
+ celluloid:
13
+ bundler:
14
+ github: celluloid/celluloid
15
+ branch: 0.17.0-prerelease
16
+ celluloid-extras:
17
+ bundler:
18
+ github: celluloid/celluloid-extras
19
+ celluloid-supervision:
20
+ bundler:
21
+ github: celluloid/celluloid-supervision
22
+ celluloid-pool:
23
+ bundler:
24
+ github: celluloid/celluloid-pool
25
+ celluloid-fsm:
26
+ bundler:
27
+ github: celluloid/celluloid-fsm
28
+ timers:
29
+ gemspec:
30
+ - ~> 4.0.0
31
+ bundler:
32
+ github: celluloid/timers
33
+ ```
34
+
35
+ # Modification of `gemspec` and `Gemfile`
36
+
37
+ The injection of dependencies into `gemspec` and `Gemfile` is handled by `Celluloid::Sync.gems()`, which routes to either `Celluloid::Gems.gemspec` or `Celluloid::Gems.gemfile` depending on what is passed to it:
38
+
39
+ * Discussed in [SYNC.md](../SYNC.md#how-do-you-install-it-in-gemfile-and-gemspec-then)
@@ -0,0 +1,84 @@
1
+ bundler:
2
+ nenv:
3
+ dotenv:
4
+
5
+ benchmark_suite:
6
+ dependency: development
7
+
8
+ rubocop:
9
+ dependency: development
10
+
11
+ transpec:
12
+ dependency: development
13
+
14
+ pry:
15
+ dependency: development
16
+
17
+ rake:
18
+ dependency: development
19
+
20
+ rspec:
21
+ dependency: development
22
+
23
+ guard-rspec:
24
+ dependency: development
25
+
26
+ coveralls:
27
+ dependency: development
28
+ gemfile:
29
+ require: false
30
+
31
+ celluloid:
32
+ dependency: core
33
+ version: "~> 0.17"
34
+ gemfile:
35
+ github: celluloid/celluloid
36
+ branch: master
37
+ submodules: true
38
+
39
+ celluloid-essentials:
40
+ dependency: module
41
+ gemfile:
42
+ github: celluloid/celluloid-essentials
43
+ branch: master
44
+ submodules: true
45
+
46
+ celluloid-supervision:
47
+ dependency: module
48
+ gemfile:
49
+ github: celluloid/celluloid-supervision
50
+ branch: master
51
+ submodules: true
52
+
53
+ celluloid-pool:
54
+ dependency: module
55
+ gemfile:
56
+ github: celluloid/celluloid-pool
57
+ branch: master
58
+ submodules: true
59
+
60
+ celluloid-fsm:
61
+ dependency: module
62
+ gemfile:
63
+ github: celluloid/celluloid-fsm
64
+ branch: master
65
+ submodules: true
66
+
67
+ celluloid-extras:
68
+ dependency: module
69
+ gemfile:
70
+ github: celluloid/celluloid-extras
71
+ branch: master
72
+ submodules: true
73
+
74
+ timers:
75
+ version: "~> 4.0.0"
76
+ gemfile:
77
+ github: celluloid/timers
78
+
79
+ rspec-logsplit:
80
+ version: ">= 0.1.2"
81
+ gemfile:
82
+ github: "abstractive/rspec-logsplit"
83
+ branch: "master"
84
+ require: false
@@ -0,0 +1,101 @@
1
+ require "yaml"
2
+
3
+ module Celluloid
4
+ module Sync
5
+ module Gemfile
6
+ class << self
7
+ def [](dsl)
8
+ dsl.source("https://rubygems.org")
9
+ dsl.gemspec # Runs gemspec, but also @sets gem_name.
10
+ Gems.gemfile(dsl)
11
+ end
12
+ end
13
+ end
14
+ module Gemspec
15
+ class << self
16
+ def [](gem)
17
+ Gems.gemspec(gem)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ module Gems
23
+ extend self
24
+ @gem_name = nil
25
+
26
+ undef gems rescue nil
27
+ def gems
28
+ File.expand_path("../dependencies.yml", __FILE__)
29
+ end
30
+
31
+ unless @dependencies ||= nil
32
+ @dependencies = YAML.load_file(gems) if File.exist?(gems)
33
+ end
34
+
35
+ unless @dependencies.is_a?(Hash) && @dependencies.any?
36
+ fail "Celluloid cannot find its dependencies."
37
+ end
38
+
39
+ undef core? rescue nil
40
+ def core?(name=@gem_name)
41
+ return false unless @dependencies[name].is_a? Hash
42
+ @dependencies[name]["dependency"] == "core"
43
+ end
44
+
45
+ undef separate? rescue nil
46
+ def separate?
47
+ !@dependencies.keys.include?(@gem_name)
48
+ end
49
+
50
+ undef gemspec rescue nil
51
+ def gemspec(gem)
52
+ @gem_name = gem.name
53
+ loader do |name, spec|
54
+ # Rules for dependencies, to avoid so-called circular dependency:
55
+ # - Only the core gem lists all the modules as runtime dependencies.
56
+ # - If this gem is not in the dependencies list, then it needs the core gem at runtime;
57
+ # the module gems are development dependencies only. This is a depending separate gem.
58
+ # There is the core gem, module gems, true dependencies, and separately depending gems.
59
+ # - If the dependency is a module, it is only a development dependency to other modules,
60
+ # and even the core gem is a development dependency. It is not expected to be used alone.
61
+ meth = case spec["dependency"]
62
+ when "core", "module"
63
+ # For the core gem, all modules are runtime dependencies.
64
+ # For separate gems, only the core gem is a runtime dependency.
65
+ if core? || (separate? && core?(name))
66
+ :add_runtime_dependency
67
+ else
68
+ :add_development_dependency
69
+ end
70
+ when "development"
71
+ :add_development_dependency
72
+ else
73
+ :add_dependency
74
+ end
75
+ gem.send(meth, name, spec["version"] || ">= 0")
76
+ end
77
+ end
78
+
79
+ undef gemfile rescue nil
80
+ def gemfile(dsl)
81
+ loader do |name, spec|
82
+ params = [name, spec["version"] || ">= 0"]
83
+ req = spec["gemfile"] || {}
84
+ params << req.each_with_object({}) { |(k, v), o| o[k.to_sym] = v }
85
+ current = dsl.dependencies.find { |d| d.name == name }
86
+ dsl.dependencies.delete(current) if current
87
+ dsl.gem(*params)
88
+ end
89
+ end
90
+
91
+ private
92
+
93
+ def loader
94
+ @dependencies.each do |name, spec|
95
+ next if name == @gem_name
96
+ spec ||= {}
97
+ yield name, spec
98
+ end
99
+ end
100
+ end
101
+ end