carnivore-actor 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/CONTRIBUTING.md +25 -0
- data/LICENSE +13 -0
- data/carnivore-actor.gemspec +1 -0
- data/lib/carnivore-actor/actor.rb +18 -2
- data/lib/carnivore-actor/version.rb +3 -1
- data/test/specs/actor.rb +1 -1
- metadata +6 -4
- data/Gemfile.lock +0 -30
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
## Branches
|
4
|
+
|
5
|
+
### `master` branch
|
6
|
+
|
7
|
+
The master branch is the current stable released version.
|
8
|
+
|
9
|
+
### `develop` branch
|
10
|
+
|
11
|
+
The develop branch is the current edge of development.
|
12
|
+
|
13
|
+
## Pull requests
|
14
|
+
|
15
|
+
* https://github.com/carnivore-rb/carnivore-actor/pulls
|
16
|
+
|
17
|
+
Please base all pull requests of the `develop` branch. Merges to
|
18
|
+
`master` only occur through the `develop` branch. Pull requests
|
19
|
+
based on `master` will likely be cherry picked.
|
20
|
+
|
21
|
+
## Issues
|
22
|
+
|
23
|
+
Need to report an issue? Use the github issues:
|
24
|
+
|
25
|
+
* https://github.com/carnivore-rb/carnivore-actor/issues
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2014 Chris Roberts
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/carnivore-actor.gemspec
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.email = 'code@chrisroberts.org'
|
9
9
|
s.homepage = 'https://github.com/carnivore-rb/carnivore-actor'
|
10
10
|
s.description = 'Carnivore actor source'
|
11
|
+
s.license = 'Apache 2.0'
|
11
12
|
s.require_path = 'lib'
|
12
13
|
s.add_dependency 'carnivore', '> 0.1.10'
|
13
14
|
s.files = Dir['**/*']
|
@@ -2,22 +2,38 @@ require 'carnivore/source'
|
|
2
2
|
|
3
3
|
module Carnivore
|
4
4
|
class Source
|
5
|
+
# Actor based Carnivore source
|
5
6
|
class Actor < Source
|
6
7
|
|
8
|
+
# Initialize source storage
|
9
|
+
#
|
10
|
+
# @return [TrueClass]
|
7
11
|
def setup(*args)
|
8
12
|
@messages = []
|
13
|
+
true
|
9
14
|
end
|
10
15
|
|
16
|
+
# Receive messages
|
17
|
+
#
|
18
|
+
# @return [Array<Object>]
|
11
19
|
def receive(*args)
|
12
20
|
wait(:available_messages)
|
13
21
|
current_messages
|
14
22
|
end
|
15
23
|
|
16
|
-
|
17
|
-
|
24
|
+
# Send messages
|
25
|
+
#
|
26
|
+
# @param payload [Object]
|
27
|
+
# @return [TrueClass]
|
28
|
+
def transmit(payload, *args)
|
29
|
+
@messages << payload
|
18
30
|
signal(:available_messages)
|
31
|
+
true
|
19
32
|
end
|
20
33
|
|
34
|
+
# Get current messages and clear store
|
35
|
+
#
|
36
|
+
# @return [Array<Object>]
|
21
37
|
def current_messages
|
22
38
|
msgs = @messages.dup
|
23
39
|
@messages.clear
|
data/test/specs/actor.rb
CHANGED
@@ -38,7 +38,7 @@ describe 'Carnivore::Source::Actor' do
|
|
38
38
|
|
39
39
|
it 'should receive messages' do
|
40
40
|
Carnivore::Supervisor.supervisor[:actor_source].transmit('test message 2')
|
41
|
-
source_wait
|
41
|
+
source_wait{ MessageStore.messages.include?('test message 2') }
|
42
42
|
MessageStore.messages.must_include 'test message 2'
|
43
43
|
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carnivore-actor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: carnivore
|
@@ -41,10 +41,12 @@ files:
|
|
41
41
|
- test/specs/actor.rb
|
42
42
|
- Gemfile
|
43
43
|
- README.md
|
44
|
+
- LICENSE
|
44
45
|
- CHANGELOG.md
|
45
|
-
-
|
46
|
+
- CONTRIBUTING.md
|
46
47
|
homepage: https://github.com/carnivore-rb/carnivore-actor
|
47
|
-
licenses:
|
48
|
+
licenses:
|
49
|
+
- Apache 2.0
|
48
50
|
post_install_message:
|
49
51
|
rdoc_options: []
|
50
52
|
require_paths:
|
data/Gemfile.lock
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
carnivore-actor (0.1.0)
|
5
|
-
carnivore (> 0.1.10)
|
6
|
-
|
7
|
-
PATH
|
8
|
-
remote: ../carnivore
|
9
|
-
specs:
|
10
|
-
carnivore (0.1.11)
|
11
|
-
celluloid
|
12
|
-
mixlib-config
|
13
|
-
multi_json
|
14
|
-
|
15
|
-
GEM
|
16
|
-
remote: https://rubygems.org/
|
17
|
-
specs:
|
18
|
-
celluloid (0.15.2)
|
19
|
-
timers (~> 1.1.0)
|
20
|
-
mixlib-config (2.1.0)
|
21
|
-
multi_json (1.8.2)
|
22
|
-
timers (1.1.0)
|
23
|
-
|
24
|
-
PLATFORMS
|
25
|
-
java
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
carnivore!
|
30
|
-
carnivore-actor!
|