celluloid 0.18.0.pre → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +258 -39
  3. data/CONDUCT.md +13 -0
  4. data/CONTRIBUTING.md +39 -0
  5. data/README.md +54 -165
  6. data/REFACTOR.md +1 -0
  7. data/architecture.md +120 -0
  8. data/examples/basic_usage.rb +1 -1
  9. data/examples/configurations.rb +78 -0
  10. data/examples/futures.rb +1 -1
  11. data/examples/ring.rb +5 -4
  12. data/examples/simple_pmap.rb +1 -1
  13. data/examples/stack.rb +2 -2
  14. data/examples/supervisors_and_registry.rb +82 -0
  15. data/examples/timers.rb +2 -2
  16. data/lib/celluloid.rb +72 -47
  17. data/lib/celluloid/actor.rb +27 -17
  18. data/lib/celluloid/actor/system.rb +13 -29
  19. data/lib/celluloid/autostart.rb +5 -5
  20. data/lib/celluloid/call/async.rb +2 -0
  21. data/lib/celluloid/call/sync.rb +10 -3
  22. data/lib/celluloid/calls.rb +5 -12
  23. data/lib/celluloid/cell.rb +5 -9
  24. data/lib/celluloid/condition.rb +3 -3
  25. data/lib/celluloid/core_ext.rb +0 -2
  26. data/lib/celluloid/debug.rb +3 -0
  27. data/lib/celluloid/exceptions.rb +2 -2
  28. data/lib/celluloid/future.rb +7 -9
  29. data/lib/celluloid/group.rb +12 -8
  30. data/lib/celluloid/group/pool.rb +1 -3
  31. data/lib/celluloid/group/spawner.rb +2 -6
  32. data/lib/celluloid/internals/call_chain.rb +15 -0
  33. data/lib/celluloid/internals/cpu_counter.rb +62 -0
  34. data/lib/celluloid/internals/handlers.rb +42 -0
  35. data/lib/celluloid/internals/links.rb +38 -0
  36. data/lib/celluloid/internals/logger.rb +104 -0
  37. data/lib/celluloid/internals/method.rb +34 -0
  38. data/lib/celluloid/internals/properties.rb +32 -0
  39. data/lib/celluloid/internals/receivers.rb +64 -0
  40. data/lib/celluloid/internals/registry.rb +102 -0
  41. data/lib/celluloid/internals/responses.rb +46 -0
  42. data/lib/celluloid/internals/signals.rb +24 -0
  43. data/lib/celluloid/internals/stack.rb +74 -0
  44. data/lib/celluloid/internals/stack/dump.rb +12 -0
  45. data/lib/celluloid/internals/stack/states.rb +72 -0
  46. data/lib/celluloid/internals/stack/summary.rb +12 -0
  47. data/lib/celluloid/internals/task_set.rb +51 -0
  48. data/lib/celluloid/internals/thread_handle.rb +52 -0
  49. data/lib/celluloid/internals/uuid.rb +40 -0
  50. data/lib/celluloid/logging/incident.rb +21 -0
  51. data/lib/celluloid/logging/incident_logger.rb +147 -0
  52. data/lib/celluloid/logging/incident_reporter.rb +49 -0
  53. data/lib/celluloid/logging/log_event.rb +20 -0
  54. data/lib/celluloid/logging/ring_buffer.rb +64 -0
  55. data/lib/celluloid/mailbox.rb +22 -9
  56. data/lib/celluloid/mailbox/evented.rb +13 -5
  57. data/lib/celluloid/notifications.rb +95 -0
  58. data/lib/celluloid/pool.rb +6 -0
  59. data/lib/celluloid/probe.rb +81 -0
  60. data/lib/celluloid/proxy/abstract.rb +9 -9
  61. data/lib/celluloid/proxy/async.rb +1 -1
  62. data/lib/celluloid/proxy/block.rb +2 -2
  63. data/lib/celluloid/proxy/cell.rb +1 -1
  64. data/lib/celluloid/proxy/future.rb +2 -4
  65. data/lib/celluloid/proxy/sync.rb +1 -3
  66. data/lib/celluloid/rspec.rb +22 -33
  67. data/lib/celluloid/supervision.rb +17 -0
  68. data/lib/celluloid/supervision/configuration.rb +169 -0
  69. data/lib/celluloid/supervision/configuration/injections.rb +8 -0
  70. data/lib/celluloid/supervision/configuration/instance.rb +113 -0
  71. data/lib/celluloid/supervision/constants.rb +123 -0
  72. data/lib/celluloid/supervision/container.rb +144 -0
  73. data/lib/celluloid/supervision/container/behavior.rb +89 -0
  74. data/lib/celluloid/supervision/container/behavior/pool.rb +71 -0
  75. data/lib/celluloid/supervision/container/behavior/tree.rb +23 -0
  76. data/lib/celluloid/supervision/container/injections.rb +8 -0
  77. data/lib/celluloid/supervision/container/instance.rb +116 -0
  78. data/lib/celluloid/supervision/container/pool.rb +210 -0
  79. data/lib/celluloid/supervision/service.rb +27 -0
  80. data/lib/celluloid/supervision/supervise.rb +34 -0
  81. data/lib/celluloid/supervision/validation.rb +40 -0
  82. data/lib/celluloid/supervision/version.rb +5 -0
  83. data/lib/celluloid/system_events.rb +11 -6
  84. data/lib/celluloid/task.rb +25 -12
  85. data/lib/celluloid/task/fibered.rb +2 -0
  86. data/lib/celluloid/task/threaded.rb +3 -3
  87. data/lib/celluloid/test.rb +5 -2
  88. data/lib/celluloid/thread.rb +0 -2
  89. data/lib/celluloid/version.rb +1 -1
  90. data/spec/celluloid/block_spec.rb +29 -32
  91. data/spec/celluloid/calls_spec.rb +5 -15
  92. data/spec/celluloid/future_spec.rb +2 -2
  93. data/spec/celluloid/internals/cpu_counter_spec.rb +129 -0
  94. data/spec/celluloid/internals/links_spec.rb +43 -0
  95. data/spec/celluloid/internals/properties_spec.rb +40 -0
  96. data/spec/celluloid/internals/registry_spec.rb +62 -0
  97. data/spec/celluloid/internals/stack/dump_spec.rb +4 -0
  98. data/spec/celluloid/internals/stack/summary_spec.rb +4 -0
  99. data/spec/celluloid/internals/thread_handle_spec.rb +60 -0
  100. data/spec/celluloid/internals/uuid_spec.rb +9 -0
  101. data/spec/celluloid/logging/ring_buffer_spec.rb +36 -0
  102. data/spec/celluloid/mailbox/evented_spec.rb +11 -22
  103. data/spec/celluloid/misc/leak_spec.rb +3 -4
  104. data/spec/celluloid/notifications_spec.rb +140 -0
  105. data/spec/celluloid/probe_spec.rb +102 -0
  106. data/spec/celluloid/proxy_spec.rb +30 -30
  107. data/spec/celluloid/supervision/behavior_spec.rb +74 -0
  108. data/spec/celluloid/supervision/configuration_spec.rb +181 -0
  109. data/spec/celluloid/supervision/container_spec.rb +72 -0
  110. data/spec/celluloid/supervision/instance_spec.rb +13 -0
  111. data/spec/celluloid/supervision/root_spec.rb +28 -0
  112. data/spec/celluloid/supervision/supervisor_spec.rb +93 -0
  113. data/spec/celluloid/task/fibered_spec.rb +1 -3
  114. data/spec/celluloid/task/threaded_spec.rb +1 -3
  115. data/spec/shared/actor_examples.rb +58 -33
  116. data/spec/shared/group_examples.rb +2 -2
  117. data/spec/shared/mailbox_examples.rb +1 -1
  118. data/spec/shared/stack_examples.rb +87 -0
  119. data/spec/shared/task_examples.rb +2 -3
  120. data/spec/spec_helper.rb +2 -4
  121. data/spec/support/configure_rspec.rb +2 -3
  122. data/spec/support/coverage.rb +2 -4
  123. data/spec/support/crash_checking.rb +2 -2
  124. data/spec/support/examples/actor_class.rb +3 -8
  125. data/spec/support/examples/call_class.rb +2 -2
  126. data/spec/support/examples/container_class.rb +35 -0
  127. data/spec/support/examples/evented_mailbox_class.rb +1 -2
  128. data/spec/support/examples/stack_classes.rb +58 -0
  129. data/spec/support/examples/stack_methods.rb +23 -0
  130. data/spec/support/examples/subordinate_class.rb +19 -0
  131. data/spec/support/logging.rb +2 -34
  132. data/spec/support/loose_threads.rb +3 -16
  133. data/spec/support/reset_class_variables.rb +5 -1
  134. data/spec/support/stubbing.rb +1 -1
  135. metadata +91 -323
  136. data/culture/CONDUCT.md +0 -38
  137. data/culture/GSoC/1010-why_we_will_participate.md +0 -17
  138. data/culture/GSoC/1020-how_mentors_stay_engaged.md +0 -7
  139. data/culture/GSoC/1030-keeping_students_on_schedule.md +0 -9
  140. data/culture/GSoC/1040-getting_students_involved.md +0 -5
  141. data/culture/GSoC/1050-student_involvement_after.md +0 -5
  142. data/culture/GSoC/README.md +0 -16
  143. data/culture/Gemfile +0 -9
  144. data/culture/LICENSE.txt +0 -22
  145. data/culture/README.md +0 -22
  146. data/culture/Rakefile +0 -5
  147. data/culture/SYNC.md +0 -70
  148. data/culture/celluloid-culture.gemspec +0 -18
  149. data/culture/gems/README.md +0 -39
  150. data/culture/gems/dependencies.yml +0 -93
  151. data/culture/gems/loader.rb +0 -101
  152. data/culture/rubocop/README.md +0 -38
  153. data/culture/rubocop/lint.yml +0 -8
  154. data/culture/rubocop/metrics.yml +0 -15
  155. data/culture/rubocop/perf.yml +0 -0
  156. data/culture/rubocop/rubocop.yml +0 -5
  157. data/culture/rubocop/style.yml +0 -61
  158. data/culture/spec/gems_spec.rb +0 -2
  159. data/culture/spec/spec_helper.rb +0 -0
  160. data/culture/spec/sync_spec.rb +0 -2
  161. data/culture/sync.rb +0 -56
  162. data/culture/tasks/rspec.rake +0 -5
  163. data/culture/tasks/rubocop.rake +0 -2
  164. data/lib/celluloid/actor/manager.rb +0 -7
  165. data/lib/celluloid/backported.rb +0 -2
  166. data/lib/celluloid/current.rb +0 -2
  167. data/lib/celluloid/deprecate.rb +0 -34
  168. data/lib/celluloid/fiber.rb +0 -32
  169. data/lib/celluloid/managed.rb +0 -3
  170. data/lib/celluloid/notices.rb +0 -15
  171. data/spec/deprecate/actor_system_spec.rb +0 -72
  172. data/spec/deprecate/block_spec.rb +0 -52
  173. data/spec/deprecate/calls_spec.rb +0 -39
  174. data/spec/deprecate/evented_mailbox_spec.rb +0 -34
  175. data/spec/deprecate/future_spec.rb +0 -32
  176. data/spec/deprecate/internal_pool_spec.rb +0 -4
  177. data/spec/support/env.rb +0 -21
data/culture/CONDUCT.md DELETED
@@ -1,38 +0,0 @@
1
- Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, and in the interest of fostering
4
- an open and welcoming community, we pledge to respect all people who contribute
5
- through reporting issues, posting feature requests, updating documentation,
6
- submitting pull requests or patches, and other activities.
7
-
8
- We are committed to making participation in this project a harassment-free experience for
9
- everyone, regardless of level of experience, gender, gender identity and expression,
10
- sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
11
- religion, or nationality.
12
-
13
- Examples of unacceptable behavior by participants include:
14
-
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
18
- * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic addresses,
20
- without explicit permission
21
- * Other unethical or unprofessional conduct.
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or reject
24
- comments, commits, code, wiki edits, issues, and other contributions that are not
25
- aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers
26
- commit themselves to fairly and consistently applying these principles to every aspect
27
- of managing this project. Project maintainers who do not follow or enforce the Code of
28
- Conduct may be permanently removed from the project team.
29
-
30
- This code of conduct applies both within project spaces and in public spaces
31
- when an individual is representing the project or its community.
32
-
33
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
34
- opening an issue or contacting one or more of the project maintainers.
35
-
36
- This Code of Conduct is adapted from the Contributor Covenant
37
- (http://contributor-covenant.org), version 1.2.0, available at
38
- http://contributor-covenant.org/version/1/2/0/
@@ -1,17 +0,0 @@
1
- ### Why does your org want to participate in Google Summer of Code?
2
-
3
- This year is pivotal for us. Celluloid is approaching "1.0" across its suite of Ruby gems. We need students' attention focused on Celluloid itself now.
4
-
5
- We want to participate directly this year, for three reasons:
6
-
7
- 1) We grew beyond the scope of umbrella organizations, and are establishing a new non-profit corporation.
8
-
9
- 2) We are important to one of the most epic shifts in software. With us, any coder can create parallel, asynchronous, concurrent, and/or distributed systems, simply. We hold & gain ground in a fierce, ordinarily complicated, multi-threaded multi-core space; fought over by Erlang/Elixr, Go, Rust, Akka, etc.
10
-
11
- 3) We are important to Ruby:
12
-
13
- a) We maintain many widely used libraries, and have millions of downloads.
14
-
15
- b) We bring design diversity to Ruby. The vast majority of Rubyists tend toward one design approach: Rails+Rack. We offer alternatives sparing Ruby from monoculture.
16
-
17
- c) We cause Ruby itself to evolve. We use and stretch nearly every aspect of every Ruby engine.
@@ -1,7 +0,0 @@
1
- ### How will you keep mentors engaged with their students?
2
-
3
- We have many contributors with management experience. One of our administrators will not be mentoring a student, but instead will be responsible for assessing public communication and activity, providing encouragement and support. We will also be creating healthy competition between mentors.
4
-
5
- All mentors and students will be present in Ryver. All student activity ( code and communication ) will be visible, and administrators will be monitoring student activity and mentor interactions. On a weekly basis, before prolonged trouble or inactivity, at least one person in addition to the mentor involved will know a mentor or student began to fall behind the stated project goals, and/or the program's expectations.
6
-
7
- Celluloid is a tight community who will be encouraging both mentors and students. But we will also be offering incentives to top performing students, offering prizes such as stickers, shirts, virtual server credits, internships at Celluloid supporting organizations, etc.
@@ -1,9 +0,0 @@
1
- ### How will you help your students stay on schedule to complete their projects?
2
-
3
- We will hold short but frequent status meetings every two weeks at the longest ( but aspiring to weekly ) - implementing the Agile and Scrum methodology's style of status and assistance meetings.
4
-
5
- We will treat the group of mentors as a team, the students as a team, the students and mentors as teams, and treat the entire organization as a pool of talent and assistance for all the other students and mentors in the organization. If anyone encounters a roadblock, they have plenty of support.
6
-
7
- Rather than treat projects as a water-tight compartments, we will cross-motivate students: We will share successes, draw attention to unique dilemmas, etc. We will encourage, showcase progress, and foster a spirit of respectful competition between projects for mentors and students alike.
8
-
9
- And as mentioned, will have a non-mentor organization administrator acting as a communications and performance monitor, mentor assistant, and "cheer-leader" for both students and mentors.
@@ -1,5 +0,0 @@
1
- ### How will you get your students involved in your community during GSoC?
2
-
3
- In addition to Ryver, we will be engaging students on GitHub, Hangouts, IRC, Twitter, Google Groups, even LinkedIn. These will be all introduced and utilized by students during the GSoC program. By the time the program is over, the students will be new community members who are each deeply connected.
4
-
5
- Our quick but frequent Agile-style meetings will further orient the students to the wider community, rather than just speaking with their mentor. By the end, everyone will know each other. Students will become aware of opportunities to work in the community, and community veterans will have a chance to observe -- then establish relationships which lead to their own businesses and other organizations engaging students as interns, future contractors, technical co-founders, and more.
@@ -1,5 +0,0 @@
1
- ### How will you keep students involved with your community after GSoC?
2
-
3
- Organizations who use Celluloid will be offering internships to top performing students. We have many disciplines a student start a career in after school, both in Open Source directly, and in organizations all over the world.
4
-
5
- In the past Celluloid mentors and students have been known to keep contact long after GSoC is over. We draw students into the organic relationships and community ties we normally have in our existing sub-culture.
@@ -1,16 +0,0 @@
1
- ### Answers to our GSoC Organization application questions:
2
-
3
- Please feel free to fork, edit, and request your changes be pulled in.
4
-
5
- * [Why does your org want to participate in Google Summer of Code?][1]
6
- * [How will you keep mentors engaged with their students?][2]
7
- * [How will you help your students stay on schedule to complete their projects?][3]
8
- * [How will you get your students involved in your community during GSoC?][4]
9
- * [How will you keep students involved with your community after GSoC?][5]
10
-
11
-
12
- [1]: https://github.com/celluloid/culture/blob/master/GSoC/1010-why_we_will_participate.md
13
- [2]: https://github.com/celluloid/culture/blob/master/GSoC/1020-how_mentors_stay_engaged.md
14
- [3]: https://github.com/celluloid/culture/blob/master/GSoC/1030-keeping_students_on_schedule.md
15
- [4]: https://github.com/celluloid/culture/blob/master/GSoC/1040-getting_students_involved.md
16
- [5]: https://github.com/celluloid/culture/blob/master/GSoC/1050-student_involvement_after.md
data/culture/Gemfile DELETED
@@ -1,9 +0,0 @@
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/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2012 Tony Arcieri, Donovan Keme
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/culture/README.md DELETED
@@ -1,22 +0,0 @@
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](https://github.com/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 DELETED
@@ -1,5 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- Dir["tasks/**/*.rake"].each { |task| load task }
4
-
5
- task default: "rubocop"
data/culture/SYNC.md DELETED
@@ -1,70 +0,0 @@
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
- ```
@@ -1,18 +0,0 @@
1
- # coding: utf-8
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "celluloid-culture"
5
- spec.version = "0.2"
6
- spec.authors = ["Tony Arcieri", "Donovan Keme"]
7
- spec.email = ["bascule@gmail.com", "code@extremist.digital"]
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
@@ -1,39 +0,0 @@
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)
@@ -1,93 +0,0 @@
1
- bundler:
2
- dependency: development
3
-
4
- nenv:
5
- dependency: development
6
-
7
- dotenv:
8
- dependency: development
9
-
10
- benchmark_suite:
11
- dependency: development
12
-
13
- rubocop:
14
- dependency: development
15
-
16
- transpec:
17
- dependency: development
18
-
19
- pry:
20
- dependency: development
21
-
22
- rake:
23
- dependency: development
24
-
25
- rspec:
26
- dependency: development
27
-
28
- listen:
29
- version: '3.0.3'
30
- dependency: development
31
-
32
- guard:
33
- version: '2.13.0'
34
- dependency: development
35
-
36
- guard-rspec:
37
- dependency: development
38
-
39
- rspec-retry:
40
- dependency: development
41
-
42
- coveralls:
43
- dependency: development
44
- gemfile:
45
- require: false
46
-
47
- celluloid:
48
- dependency: core
49
- version: ">= 0.17.2"
50
- gemfile:
51
- github: celluloid/celluloid
52
- branch: master
53
- submodules: true
54
-
55
- celluloid-essentials:
56
- dependency: module
57
- gemfile:
58
- github: celluloid/celluloid-essentials
59
- branch: master
60
- submodules: true
61
-
62
- celluloid-supervision:
63
- dependency: module
64
- gemfile:
65
- github: celluloid/celluloid-supervision
66
- branch: master
67
- submodules: true
68
-
69
- celluloid-pool:
70
- dependency: module
71
- gemfile:
72
- github: celluloid/celluloid-pool
73
- branch: master
74
- submodules: true
75
-
76
- celluloid-fsm:
77
- dependency: module
78
- gemfile:
79
- github: celluloid/celluloid-fsm
80
- branch: master
81
- submodules: true
82
-
83
- celluloid-extras:
84
- dependency: module
85
- gemfile:
86
- github: celluloid/celluloid-extras
87
- branch: master
88
- submodules: true
89
-
90
- timers:
91
- version: ">= 4.1.1"
92
- gemfile:
93
- github: celluloid/timers
@@ -1,101 +0,0 @@
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
- raise "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