celluloid 0.18.0.pre → 0.18.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +114 -39
  3. data/CONDUCT.md +13 -0
  4. data/CONTRIBUTING.md +39 -0
  5. data/README.md +59 -55
  6. data/architecture.md +120 -0
  7. data/examples/basic_usage.rb +1 -1
  8. data/examples/configurations.rb +78 -0
  9. data/examples/futures.rb +1 -1
  10. data/examples/ring.rb +5 -4
  11. data/examples/simple_pmap.rb +1 -1
  12. data/examples/stack.rb +2 -2
  13. data/examples/supervisors_and_registry.rb +82 -0
  14. data/examples/timers.rb +1 -1
  15. data/lib/celluloid.rb +72 -47
  16. data/lib/celluloid/actor.rb +27 -17
  17. data/lib/celluloid/actor/system.rb +13 -29
  18. data/lib/celluloid/autostart.rb +5 -5
  19. data/lib/celluloid/backported.rb +6 -2
  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/current.rb +3 -1
  27. data/lib/celluloid/debug.rb +3 -0
  28. data/lib/celluloid/exceptions.rb +2 -2
  29. data/lib/celluloid/future.rb +7 -9
  30. data/lib/celluloid/group.rb +12 -8
  31. data/lib/celluloid/group/pool.rb +1 -3
  32. data/lib/celluloid/group/spawner.rb +2 -6
  33. data/lib/celluloid/internals/call_chain.rb +15 -0
  34. data/lib/celluloid/internals/cpu_counter.rb +62 -0
  35. data/lib/celluloid/internals/handlers.rb +42 -0
  36. data/lib/celluloid/internals/links.rb +38 -0
  37. data/lib/celluloid/internals/logger.rb +104 -0
  38. data/lib/celluloid/internals/method.rb +34 -0
  39. data/lib/celluloid/internals/properties.rb +32 -0
  40. data/lib/celluloid/internals/receivers.rb +64 -0
  41. data/lib/celluloid/internals/registry.rb +102 -0
  42. data/lib/celluloid/internals/responses.rb +46 -0
  43. data/lib/celluloid/internals/signals.rb +24 -0
  44. data/lib/celluloid/internals/stack.rb +74 -0
  45. data/lib/celluloid/internals/stack/dump.rb +12 -0
  46. data/lib/celluloid/internals/stack/states.rb +72 -0
  47. data/lib/celluloid/internals/stack/summary.rb +12 -0
  48. data/lib/celluloid/internals/task_set.rb +51 -0
  49. data/lib/celluloid/internals/thread_handle.rb +52 -0
  50. data/lib/celluloid/internals/uuid.rb +40 -0
  51. data/lib/celluloid/logging/incident.rb +21 -0
  52. data/lib/celluloid/logging/incident_logger.rb +147 -0
  53. data/lib/celluloid/logging/incident_reporter.rb +49 -0
  54. data/lib/celluloid/logging/log_event.rb +20 -0
  55. data/lib/celluloid/logging/ring_buffer.rb +64 -0
  56. data/lib/celluloid/mailbox.rb +22 -9
  57. data/lib/celluloid/mailbox/evented.rb +13 -5
  58. data/lib/celluloid/managed.rb +6 -3
  59. data/lib/celluloid/notifications.rb +95 -0
  60. data/lib/celluloid/pool.rb +6 -0
  61. data/lib/celluloid/probe.rb +81 -0
  62. data/lib/celluloid/proxy/abstract.rb +9 -9
  63. data/lib/celluloid/proxy/async.rb +1 -1
  64. data/lib/celluloid/proxy/block.rb +2 -2
  65. data/lib/celluloid/proxy/cell.rb +1 -1
  66. data/lib/celluloid/proxy/future.rb +2 -4
  67. data/lib/celluloid/proxy/sync.rb +1 -3
  68. data/lib/celluloid/rspec.rb +22 -33
  69. data/lib/celluloid/supervision.rb +17 -0
  70. data/lib/celluloid/supervision/configuration.rb +169 -0
  71. data/lib/celluloid/supervision/configuration/injections.rb +8 -0
  72. data/lib/celluloid/supervision/configuration/instance.rb +113 -0
  73. data/lib/celluloid/supervision/constants.rb +123 -0
  74. data/lib/celluloid/supervision/container.rb +144 -0
  75. data/lib/celluloid/supervision/container/behavior.rb +89 -0
  76. data/lib/celluloid/supervision/container/behavior/pool.rb +71 -0
  77. data/lib/celluloid/supervision/container/behavior/tree.rb +23 -0
  78. data/lib/celluloid/supervision/container/injections.rb +8 -0
  79. data/lib/celluloid/supervision/container/instance.rb +116 -0
  80. data/lib/celluloid/supervision/container/pool.rb +210 -0
  81. data/{culture/rubocop/perf.yml → lib/celluloid/supervision/container/tree.rb} +0 -0
  82. data/lib/celluloid/supervision/deprecate.rb +9 -0
  83. data/lib/celluloid/supervision/deprecate/supervise.rb +105 -0
  84. data/lib/celluloid/supervision/deprecate/validation.rb +54 -0
  85. data/lib/celluloid/supervision/service.rb +27 -0
  86. data/lib/celluloid/supervision/supervise.rb +34 -0
  87. data/lib/celluloid/supervision/validation.rb +40 -0
  88. data/lib/celluloid/supervision/version.rb +5 -0
  89. data/lib/celluloid/system_events.rb +11 -6
  90. data/lib/celluloid/task.rb +25 -12
  91. data/lib/celluloid/task/fibered.rb +2 -0
  92. data/lib/celluloid/task/threaded.rb +3 -3
  93. data/lib/celluloid/test.rb +5 -2
  94. data/lib/celluloid/thread.rb +0 -2
  95. data/lib/celluloid/version.rb +1 -1
  96. data/spec/celluloid/block_spec.rb +29 -32
  97. data/spec/celluloid/calls_spec.rb +5 -15
  98. data/spec/celluloid/future_spec.rb +2 -2
  99. data/spec/celluloid/internals/cpu_counter_spec.rb +129 -0
  100. data/spec/celluloid/internals/links_spec.rb +43 -0
  101. data/spec/celluloid/internals/properties_spec.rb +40 -0
  102. data/spec/celluloid/internals/registry_spec.rb +62 -0
  103. data/spec/celluloid/internals/stack/dump_spec.rb +4 -0
  104. data/spec/celluloid/internals/stack/summary_spec.rb +4 -0
  105. data/spec/celluloid/internals/thread_handle_spec.rb +60 -0
  106. data/spec/celluloid/internals/uuid_spec.rb +9 -0
  107. data/spec/celluloid/logging/ring_buffer_spec.rb +36 -0
  108. data/spec/celluloid/mailbox/evented_spec.rb +11 -22
  109. data/spec/celluloid/misc/leak_spec.rb +3 -4
  110. data/spec/celluloid/notifications_spec.rb +140 -0
  111. data/spec/celluloid/probe_spec.rb +102 -0
  112. data/spec/celluloid/proxy_spec.rb +30 -30
  113. data/spec/celluloid/supervision/behavior_spec.rb +74 -0
  114. data/spec/celluloid/supervision/configuration_spec.rb +181 -0
  115. data/spec/celluloid/supervision/container_spec.rb +72 -0
  116. data/spec/celluloid/supervision/instance_spec.rb +13 -0
  117. data/spec/celluloid/supervision/root_spec.rb +28 -0
  118. data/spec/celluloid/supervision/supervisor_spec.rb +93 -0
  119. data/spec/celluloid/task/fibered_spec.rb +1 -3
  120. data/spec/celluloid/task/threaded_spec.rb +1 -3
  121. data/spec/shared/actor_examples.rb +58 -33
  122. data/spec/shared/group_examples.rb +2 -2
  123. data/spec/shared/mailbox_examples.rb +1 -1
  124. data/spec/shared/stack_examples.rb +87 -0
  125. data/spec/shared/task_examples.rb +2 -3
  126. data/spec/spec_helper.rb +2 -4
  127. data/spec/support/configure_rspec.rb +2 -3
  128. data/spec/support/coverage.rb +2 -4
  129. data/spec/support/crash_checking.rb +2 -2
  130. data/spec/support/examples/actor_class.rb +3 -8
  131. data/spec/support/examples/call_class.rb +2 -2
  132. data/spec/support/examples/container_class.rb +35 -0
  133. data/spec/support/examples/evented_mailbox_class.rb +1 -2
  134. data/spec/support/examples/stack_classes.rb +58 -0
  135. data/spec/support/examples/stack_methods.rb +23 -0
  136. data/spec/support/examples/subordinate_class.rb +19 -0
  137. data/spec/support/logging.rb +2 -34
  138. data/spec/support/loose_threads.rb +3 -16
  139. data/spec/support/reset_class_variables.rb +5 -1
  140. data/spec/support/stubbing.rb +1 -1
  141. metadata +91 -316
  142. data/culture/CONDUCT.md +0 -38
  143. data/culture/GSoC/1010-why_we_will_participate.md +0 -17
  144. data/culture/GSoC/1020-how_mentors_stay_engaged.md +0 -7
  145. data/culture/GSoC/1030-keeping_students_on_schedule.md +0 -9
  146. data/culture/GSoC/1040-getting_students_involved.md +0 -5
  147. data/culture/GSoC/1050-student_involvement_after.md +0 -5
  148. data/culture/GSoC/README.md +0 -16
  149. data/culture/Gemfile +0 -9
  150. data/culture/LICENSE.txt +0 -22
  151. data/culture/README.md +0 -22
  152. data/culture/Rakefile +0 -5
  153. data/culture/SYNC.md +0 -70
  154. data/culture/celluloid-culture.gemspec +0 -18
  155. data/culture/gems/README.md +0 -39
  156. data/culture/gems/dependencies.yml +0 -93
  157. data/culture/gems/loader.rb +0 -101
  158. data/culture/rubocop/README.md +0 -38
  159. data/culture/rubocop/lint.yml +0 -8
  160. data/culture/rubocop/metrics.yml +0 -15
  161. data/culture/rubocop/rubocop.yml +0 -5
  162. data/culture/rubocop/style.yml +0 -61
  163. data/culture/spec/gems_spec.rb +0 -2
  164. data/culture/spec/spec_helper.rb +0 -0
  165. data/culture/spec/sync_spec.rb +0 -2
  166. data/culture/sync.rb +0 -56
  167. data/culture/tasks/rspec.rake +0 -5
  168. data/culture/tasks/rubocop.rake +0 -2
  169. data/lib/celluloid/actor/manager.rb +0 -7
  170. data/lib/celluloid/deprecate.rb +0 -34
  171. data/lib/celluloid/fiber.rb +0 -32
  172. data/lib/celluloid/notices.rb +0 -15
  173. data/spec/deprecate/actor_system_spec.rb +0 -72
  174. data/spec/deprecate/block_spec.rb +0 -52
  175. data/spec/deprecate/calls_spec.rb +0 -39
  176. data/spec/deprecate/evented_mailbox_spec.rb +0 -34
  177. data/spec/deprecate/future_spec.rb +0 -32
  178. data/spec/deprecate/internal_pool_spec.rb +0 -4
  179. data/spec/support/env.rb +0 -21
@@ -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
@@ -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
@@ -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.
@@ -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).
@@ -1,5 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- Dir["tasks/**/*.rake"].each { |task| load task }
4
-
5
- task default: "rubocop"
@@ -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