celluloid 0.17.3 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES.md +300 -73
- data/CONDUCT.md +13 -0
- data/CONTRIBUTING.md +39 -0
- data/README.md +54 -150
- data/REFACTOR.md +1 -0
- data/architecture.md +120 -0
- data/examples/basic_usage.rb +1 -1
- data/examples/configurations.rb +78 -0
- data/examples/futures.rb +1 -1
- data/examples/ring.rb +5 -4
- data/examples/simple_pmap.rb +1 -1
- data/examples/stack.rb +2 -2
- data/examples/supervisors_and_registry.rb +82 -0
- data/examples/timers.rb +2 -2
- data/lib/celluloid.rb +74 -64
- data/lib/celluloid/actor.rb +27 -17
- data/lib/celluloid/actor/system.rb +13 -29
- data/lib/celluloid/autostart.rb +6 -1
- data/lib/celluloid/call/async.rb +2 -0
- data/lib/celluloid/call/sync.rb +10 -3
- data/lib/celluloid/calls.rb +13 -12
- data/lib/celluloid/cell.rb +5 -9
- data/lib/celluloid/condition.rb +3 -3
- data/lib/celluloid/core_ext.rb +0 -2
- data/lib/celluloid/debug.rb +3 -0
- data/lib/celluloid/exceptions.rb +2 -2
- data/lib/celluloid/future.rb +8 -10
- data/lib/celluloid/group.rb +16 -6
- data/lib/celluloid/group/pool.rb +1 -3
- data/lib/celluloid/group/spawner.rb +2 -6
- data/lib/celluloid/internals/call_chain.rb +15 -0
- data/lib/celluloid/internals/cpu_counter.rb +62 -0
- data/lib/celluloid/internals/handlers.rb +42 -0
- data/lib/celluloid/internals/links.rb +38 -0
- data/lib/celluloid/internals/logger.rb +104 -0
- data/lib/celluloid/internals/method.rb +34 -0
- data/lib/celluloid/internals/properties.rb +32 -0
- data/lib/celluloid/internals/receivers.rb +64 -0
- data/lib/celluloid/internals/registry.rb +102 -0
- data/lib/celluloid/internals/responses.rb +46 -0
- data/lib/celluloid/internals/signals.rb +24 -0
- data/lib/celluloid/internals/stack.rb +74 -0
- data/lib/celluloid/internals/stack/dump.rb +12 -0
- data/lib/celluloid/internals/stack/states.rb +72 -0
- data/lib/celluloid/internals/stack/summary.rb +12 -0
- data/lib/celluloid/internals/task_set.rb +51 -0
- data/lib/celluloid/internals/thread_handle.rb +52 -0
- data/lib/celluloid/internals/uuid.rb +40 -0
- data/lib/celluloid/logging/incident.rb +21 -0
- data/lib/celluloid/logging/incident_logger.rb +147 -0
- data/lib/celluloid/logging/incident_reporter.rb +49 -0
- data/lib/celluloid/logging/log_event.rb +20 -0
- data/lib/celluloid/logging/ring_buffer.rb +64 -0
- data/lib/celluloid/mailbox.rb +22 -9
- data/lib/celluloid/mailbox/evented.rb +13 -5
- data/lib/celluloid/notifications.rb +95 -0
- data/lib/celluloid/pool.rb +6 -0
- data/lib/celluloid/probe.rb +81 -0
- data/lib/celluloid/proxy/abstract.rb +9 -9
- data/lib/celluloid/proxy/async.rb +1 -1
- data/lib/celluloid/proxy/block.rb +2 -2
- data/lib/celluloid/proxy/cell.rb +1 -1
- data/lib/celluloid/proxy/future.rb +2 -4
- data/lib/celluloid/proxy/sync.rb +1 -3
- data/lib/celluloid/rspec.rb +22 -33
- data/lib/celluloid/supervision.rb +17 -0
- data/lib/celluloid/supervision/configuration.rb +169 -0
- data/lib/celluloid/supervision/configuration/injections.rb +8 -0
- data/lib/celluloid/supervision/configuration/instance.rb +113 -0
- data/lib/celluloid/supervision/constants.rb +123 -0
- data/lib/celluloid/supervision/container.rb +144 -0
- data/lib/celluloid/supervision/container/behavior.rb +89 -0
- data/lib/celluloid/supervision/container/behavior/pool.rb +71 -0
- data/lib/celluloid/supervision/container/behavior/tree.rb +23 -0
- data/lib/celluloid/supervision/container/injections.rb +8 -0
- data/lib/celluloid/supervision/container/instance.rb +116 -0
- data/lib/celluloid/supervision/container/pool.rb +210 -0
- data/lib/celluloid/supervision/service.rb +27 -0
- data/lib/celluloid/supervision/supervise.rb +34 -0
- data/lib/celluloid/supervision/validation.rb +40 -0
- data/lib/celluloid/supervision/version.rb +5 -0
- data/lib/celluloid/system_events.rb +11 -6
- data/lib/celluloid/task.rb +25 -12
- data/lib/celluloid/task/fibered.rb +6 -2
- data/lib/celluloid/task/threaded.rb +3 -3
- data/lib/celluloid/test.rb +5 -2
- data/lib/celluloid/thread.rb +0 -2
- data/lib/celluloid/version.rb +1 -1
- data/spec/celluloid/block_spec.rb +29 -32
- data/spec/celluloid/calls_spec.rb +5 -15
- data/spec/celluloid/future_spec.rb +7 -1
- data/spec/celluloid/internals/cpu_counter_spec.rb +129 -0
- data/spec/celluloid/internals/links_spec.rb +43 -0
- data/spec/celluloid/internals/properties_spec.rb +40 -0
- data/spec/celluloid/internals/registry_spec.rb +62 -0
- data/spec/celluloid/internals/stack/dump_spec.rb +4 -0
- data/spec/celluloid/internals/stack/summary_spec.rb +4 -0
- data/spec/celluloid/internals/thread_handle_spec.rb +60 -0
- data/spec/celluloid/internals/uuid_spec.rb +9 -0
- data/spec/celluloid/logging/ring_buffer_spec.rb +36 -0
- data/spec/celluloid/mailbox/evented_spec.rb +11 -22
- data/spec/celluloid/misc/leak_spec.rb +3 -4
- data/spec/celluloid/notifications_spec.rb +140 -0
- data/spec/celluloid/probe_spec.rb +102 -0
- data/spec/celluloid/proxy_spec.rb +30 -30
- data/spec/celluloid/supervision/behavior_spec.rb +74 -0
- data/spec/celluloid/supervision/configuration_spec.rb +181 -0
- data/spec/celluloid/supervision/container_spec.rb +72 -0
- data/spec/celluloid/supervision/instance_spec.rb +13 -0
- data/spec/celluloid/supervision/root_spec.rb +28 -0
- data/spec/celluloid/supervision/supervisor_spec.rb +93 -0
- data/spec/celluloid/task/fibered_spec.rb +1 -3
- data/spec/celluloid/task/threaded_spec.rb +1 -3
- data/spec/shared/actor_examples.rb +58 -33
- data/spec/shared/group_examples.rb +2 -2
- data/spec/shared/mailbox_examples.rb +1 -1
- data/spec/shared/stack_examples.rb +87 -0
- data/spec/shared/task_examples.rb +2 -3
- data/spec/spec_helper.rb +2 -4
- data/spec/support/configure_rspec.rb +2 -3
- data/spec/support/coverage.rb +2 -4
- data/spec/support/crash_checking.rb +2 -2
- data/spec/support/examples/actor_class.rb +3 -8
- data/spec/support/examples/call_class.rb +2 -2
- data/spec/support/examples/container_class.rb +35 -0
- data/spec/support/examples/evented_mailbox_class.rb +1 -2
- data/spec/support/examples/stack_classes.rb +58 -0
- data/spec/support/examples/stack_methods.rb +23 -0
- data/spec/support/examples/subordinate_class.rb +19 -0
- data/spec/support/logging.rb +3 -34
- data/spec/support/loose_threads.rb +3 -16
- data/spec/support/reset_class_variables.rb +5 -1
- data/spec/support/stubbing.rb +1 -1
- metadata +91 -290
- data/culture/CONDUCT.md +0 -28
- data/culture/Gemfile +0 -9
- data/culture/LICENSE.txt +0 -22
- data/culture/README.md +0 -22
- data/culture/Rakefile +0 -5
- data/culture/SYNC.md +0 -70
- data/culture/celluloid-culture.gemspec +0 -18
- data/culture/gems/README.md +0 -39
- data/culture/gems/dependencies.yml +0 -85
- data/culture/gems/loader.rb +0 -101
- data/culture/rubocop/README.md +0 -38
- data/culture/rubocop/lint.yml +0 -8
- data/culture/rubocop/metrics.yml +0 -15
- data/culture/rubocop/perf.yml +0 -0
- data/culture/rubocop/rubocop.yml +0 -5
- data/culture/rubocop/style.yml +0 -57
- data/culture/spec/gems_spec.rb +0 -2
- data/culture/spec/spec_helper.rb +0 -0
- data/culture/spec/sync_spec.rb +0 -2
- data/culture/sync.rb +0 -56
- data/culture/tasks/rspec.rake +0 -5
- data/culture/tasks/rubocop.rake +0 -2
- data/lib/celluloid/actor/manager.rb +0 -7
- data/lib/celluloid/backported.rb +0 -2
- data/lib/celluloid/current.rb +0 -2
- data/lib/celluloid/deprecate.rb +0 -21
- data/lib/celluloid/fiber.rb +0 -32
- data/lib/celluloid/managed.rb +0 -3
- data/lib/celluloid/notices.rb +0 -15
- data/spec/deprecate/actor_system_spec.rb +0 -72
- data/spec/deprecate/block_spec.rb +0 -52
- data/spec/deprecate/calls_spec.rb +0 -39
- data/spec/deprecate/evented_mailbox_spec.rb +0 -34
- data/spec/deprecate/future_spec.rb +0 -32
- data/spec/deprecate/internal_pool_spec.rb +0 -4
- data/spec/support/env.rb +0 -21
data/culture/CONDUCT.md
DELETED
@@ -1,28 +0,0 @@
|
|
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
DELETED
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](/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
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
|
data/culture/gems/README.md
DELETED
@@ -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,85 +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
|
-
guard-rspec:
|
29
|
-
dependency: development
|
30
|
-
|
31
|
-
rspec-retry:
|
32
|
-
dependency: development
|
33
|
-
|
34
|
-
coveralls:
|
35
|
-
dependency: development
|
36
|
-
gemfile:
|
37
|
-
require: false
|
38
|
-
|
39
|
-
celluloid:
|
40
|
-
dependency: core
|
41
|
-
version: ">= 0.17.2"
|
42
|
-
gemfile:
|
43
|
-
github: celluloid/celluloid
|
44
|
-
branch: master
|
45
|
-
submodules: true
|
46
|
-
|
47
|
-
celluloid-essentials:
|
48
|
-
dependency: module
|
49
|
-
gemfile:
|
50
|
-
github: celluloid/celluloid-essentials
|
51
|
-
branch: master
|
52
|
-
submodules: true
|
53
|
-
|
54
|
-
celluloid-supervision:
|
55
|
-
dependency: module
|
56
|
-
gemfile:
|
57
|
-
github: celluloid/celluloid-supervision
|
58
|
-
branch: master
|
59
|
-
submodules: true
|
60
|
-
|
61
|
-
celluloid-pool:
|
62
|
-
dependency: module
|
63
|
-
gemfile:
|
64
|
-
github: celluloid/celluloid-pool
|
65
|
-
branch: master
|
66
|
-
submodules: true
|
67
|
-
|
68
|
-
celluloid-fsm:
|
69
|
-
dependency: module
|
70
|
-
gemfile:
|
71
|
-
github: celluloid/celluloid-fsm
|
72
|
-
branch: master
|
73
|
-
submodules: true
|
74
|
-
|
75
|
-
celluloid-extras:
|
76
|
-
dependency: module
|
77
|
-
gemfile:
|
78
|
-
github: celluloid/celluloid-extras
|
79
|
-
branch: master
|
80
|
-
submodules: true
|
81
|
-
|
82
|
-
timers:
|
83
|
-
version: ">= 4.1.1"
|
84
|
-
gemfile:
|
85
|
-
github: celluloid/timers
|
data/culture/gems/loader.rb
DELETED
@@ -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
|
-
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
|
data/culture/rubocop/README.md
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# About
|
2
|
-
[RuboCop](https://github.com/bbatsov/rubocop) is a ruby static code analyzer.
|
3
|
-
It's more than just a lint. It verifies the code against ruby best practices and performs code correctness analysis.
|
4
|
-
Celluloid culture doesn't always agree with all rubocop default policies and so we provide a rubocop configuration file that overrides its default behavior.
|
5
|
-
|
6
|
-
# Integration
|
7
|
-
|
8
|
-
[Integrate `celluloid/culture`](../README.md#integration), then include `culture/rupocop/.rubocop.yml` in your default rubocop config.
|
9
|
-
|
10
|
-
##### Add celluloid/culture as GIT submodule:
|
11
|
-
|
12
|
-
* See instructions: [Integrate the `celluloid/culture` sub-module](../README.md#integration)
|
13
|
-
|
14
|
-
##### Include `culture/rupocop/rubocop.yml` in the `.rubocop.yml` in the root of your project:
|
15
|
-
```yml
|
16
|
-
inherit_from:
|
17
|
-
- culture/rubocop/rubocop.yml
|
18
|
-
```
|
19
|
-
|
20
|
-
# How to add rubocop to your project
|
21
|
-
|
22
|
-
The `rubocop` gem is automatically included by `Celluloid::Sync.gems` when that is [implemented](../SYNC.md).
|
23
|
-
|
24
|
-
##### Add a 'rubocop' target in your `Rakefile`
|
25
|
-
|
26
|
-
# Hints
|
27
|
-
It's possible to use rubocop for autocorrection of minor problems.
|
28
|
-
|
29
|
-
Always verify these changes by running:
|
30
|
-
|
31
|
-
```sh
|
32
|
-
bundle exec rubocop
|
33
|
-
```
|
34
|
-
|
35
|
-
Once you are ready to auto-corret the issues you are shown, run it with the `-a` option:
|
36
|
-
```sh
|
37
|
-
bundle exec rubocop -a
|
38
|
-
```
|