rapids_rivers 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rapids_rivers/packet.rb +40 -0
- data/lib/rapids_rivers/packet_problems.rb +63 -0
- data/lib/rapids_rivers/rabbit_mq/rabbit_mq_rapids.rb +50 -0
- data/lib/rapids_rivers/rabbit_mq/rabbit_mq_river.rb +29 -0
- data/lib/rapids_rivers/rapids_connection.rb +26 -0
- data/lib/rapids_rivers/river.rb +145 -0
- data/lib/rapids_rivers/version.rb +3 -0
- data/lib/rapids_rivers.rb +6 -0
- data/rapids_rivers.gemspec +38 -0
- data/vendor/cache/amq-protocol-2.1.0.gem +0 -0
- data/vendor/cache/bunny-2.6.4.gem +0 -0
- data/vendor/cache/json-2.0.3.gem +0 -0
- data/vendor/cache/minitest-5.10.1.gem +0 -0
- data/vendor/cache/rake-12.0.0.gem +0 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6113dcdee59279d74f0602e8f3df478df19bd2f9
|
4
|
+
data.tar.gz: e3309bf86ac3a1bcfd8f2a6257016082794fa37f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5358b38231038648b3ed81e9c466da7e3749b9886c42b4ed5d4deea133c03c9d912fd942e19972cbfe3293989bf7a6266f3451e9abe8d5a5a57a39c44e89e938
|
7
|
+
data.tar.gz: d9597c6feae249acc74e7a1c81e083ab9d98389c61fd19b27574628497687891e2c3050680815fa4eb3a670b20ca847547b2c9eb6d29dfed85bd6b996342d589
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at TODO: Write your email address. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# RapidsRivers
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rapids_rivers`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rapids_rivers'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rapids_rivers
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rapids_rivers. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rapids_rivers"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module RapidsRivers
|
4
|
+
|
5
|
+
# Understands a specifc message
|
6
|
+
class Packet
|
7
|
+
# The following keys are reserved for system usage:
|
8
|
+
VISIT_COUNT = 'system_read_count'
|
9
|
+
CONTRIBUTING_SERVICES = 'contributing_services'
|
10
|
+
|
11
|
+
attr_reader :contributing_services
|
12
|
+
protected :contributing_services
|
13
|
+
|
14
|
+
def initialize(json_hash)
|
15
|
+
@json_hash = json_hash
|
16
|
+
@system_read_count = (@json_hash[VISIT_COUNT] || -1) + 1
|
17
|
+
@contributing_services = @json_hash[CONTRIBUTING_SERVICES] || []
|
18
|
+
@used_keys = [VISIT_COUNT, CONTRIBUTING_SERVICES]
|
19
|
+
end
|
20
|
+
|
21
|
+
def used_key(key)
|
22
|
+
@used_keys << key.to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
def clone_with_name(service_name)
|
26
|
+
self.clone.tap { |packet_copy| packet_copy.contributing_services << service_name }
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_json
|
30
|
+
@used_keys.each { |key| @json_hash[key] = instance_variable_get("@#{key}".to_sym) if instance_variable_get("@#{key}".to_sym) }
|
31
|
+
@json_hash.to_json
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
"Packet (in JSON): #{self.to_json}"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module RapidsRivers
|
4
|
+
|
5
|
+
# Understands issues about a particular JSON-formatted Packet
|
6
|
+
class PacketProblems
|
7
|
+
|
8
|
+
def initialize(original_json)
|
9
|
+
@json_string = original_json
|
10
|
+
@informational_messages, @warnings, @errors, @severe_errors = [], [], [], []
|
11
|
+
end
|
12
|
+
|
13
|
+
def errors?
|
14
|
+
@errors.any? || @severe_errors.any?
|
15
|
+
end
|
16
|
+
|
17
|
+
def messages?
|
18
|
+
errors? || @warnings.any? || @informational_messages.any?
|
19
|
+
end
|
20
|
+
|
21
|
+
def information(explanation)
|
22
|
+
@informational_messages << explanation
|
23
|
+
end
|
24
|
+
|
25
|
+
def warning(explanation)
|
26
|
+
@warnings << explanation
|
27
|
+
end
|
28
|
+
|
29
|
+
def error(explanation)
|
30
|
+
@errors << explanation
|
31
|
+
end
|
32
|
+
|
33
|
+
def severe_error(explanation)
|
34
|
+
@severe_errors << explanation
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
return("No errors detected in JSON:\n\t" + @json_string) if !messages?
|
39
|
+
results = "Errors and/or messages exist. Original JSON string is:\n\t"
|
40
|
+
results += @json_string
|
41
|
+
results += messages("Severe errors", @severe_errors)
|
42
|
+
results += messages("Errors", @errors)
|
43
|
+
results += messages("Warnings", @warnings)
|
44
|
+
results += messages("Information", @informational_messages)
|
45
|
+
results += "\n"
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def messages(label, messages)
|
51
|
+
return "" if messages.empty?
|
52
|
+
results = "\n"
|
53
|
+
results += ' '*5
|
54
|
+
results += label
|
55
|
+
results += ": "
|
56
|
+
results += messages.size.to_s
|
57
|
+
results += "\n\t"
|
58
|
+
results += messages.join("\n\t")
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'bunny'
|
2
|
+
|
3
|
+
require_relative '../rapids_connection'
|
4
|
+
require_relative './rabbit_mq_river'
|
5
|
+
|
6
|
+
module RapidsRivers
|
7
|
+
|
8
|
+
# Understands an event bus based on RabbitMQ
|
9
|
+
class RabbitMqRapids
|
10
|
+
include RapidsRivers::RapidsConnection
|
11
|
+
|
12
|
+
RAPIDS = 'rapids'
|
13
|
+
|
14
|
+
def initialize(host_ip, port)
|
15
|
+
@connection = Bunny.new(
|
16
|
+
:host => host_ip,
|
17
|
+
:port => port.to_i,
|
18
|
+
:automatically_recover => false)
|
19
|
+
end
|
20
|
+
|
21
|
+
def publish(packet)
|
22
|
+
exchange.publish packet.to_json
|
23
|
+
end
|
24
|
+
|
25
|
+
def queue queue_name = ""
|
26
|
+
channel.queue(queue_name || "", exclusive: true, auto_delete: true).tap do |queue|
|
27
|
+
queue.bind exchange
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def close
|
32
|
+
channel.close
|
33
|
+
@connection.close
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def channel
|
39
|
+
return @channel if @channel
|
40
|
+
@connection.start
|
41
|
+
@channel = @connection.create_channel
|
42
|
+
end
|
43
|
+
|
44
|
+
def exchange
|
45
|
+
@exchange ||= channel.fanout(RAPIDS, durable: true, auto_delete: true)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative '../river'
|
2
|
+
|
3
|
+
module RapidsRivers
|
4
|
+
|
5
|
+
# Understands a filtered message stream based on RabbitMQ
|
6
|
+
class RabbitMqRiver < RapidsRivers::River
|
7
|
+
|
8
|
+
alias_method :parent_register, :register
|
9
|
+
def register service
|
10
|
+
super
|
11
|
+
begin
|
12
|
+
queue(service).subscribe(:block => true) do |delivery_info, metadata, payload|
|
13
|
+
message @rapids_connection, payload
|
14
|
+
end
|
15
|
+
rescue Interrupt => _
|
16
|
+
@rapids_connection.close
|
17
|
+
exit(0)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def queue service
|
24
|
+
@queue ||= @rapids_connection.queue service.service_name
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module RapidsRivers
|
2
|
+
|
3
|
+
# Understands the protocol to an event bus
|
4
|
+
module RapidsConnection
|
5
|
+
|
6
|
+
def register(listener)
|
7
|
+
listeners << listener
|
8
|
+
end
|
9
|
+
|
10
|
+
def received_message(message)
|
11
|
+
listeners.each { |listener| listener.message(self, message) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def publish(packet)
|
15
|
+
throw "No implementation to send packets: \n\t #{packet.to_s}"
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def listeners
|
21
|
+
@listeners ||= []
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
require_relative './rapids_connection'
|
4
|
+
require_relative './packet'
|
5
|
+
require_relative './packet_problems'
|
6
|
+
|
7
|
+
module RapidsRivers
|
8
|
+
|
9
|
+
# Understands a filtered stream of JSON messages
|
10
|
+
class River
|
11
|
+
attr_reader :rapids_connection, :listening_services
|
12
|
+
protected :rapids_connection, :listening_services
|
13
|
+
|
14
|
+
def initialize rapids_connection
|
15
|
+
@rapids_connection = rapids_connection
|
16
|
+
@listening_services = []
|
17
|
+
@validations = []
|
18
|
+
rapids_connection.register(self);
|
19
|
+
end
|
20
|
+
|
21
|
+
def message send_port, message
|
22
|
+
packet_problems = RapidsRivers::PacketProblems.new message
|
23
|
+
packet = packet_from message, packet_problems
|
24
|
+
@listening_services.each do |ls|
|
25
|
+
next ls.on_error(send_port, packet_problems) if packet_problems.errors?
|
26
|
+
ls.packet send_port, packet.clone_with_name(ls.service_name), packet_problems
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def register service
|
31
|
+
@listening_services << service
|
32
|
+
end
|
33
|
+
|
34
|
+
def require *keys
|
35
|
+
keys.each do |key|
|
36
|
+
@validations << lambda do |json_hash, packet, packet_problems|
|
37
|
+
validate_required key, json_hash, packet_problems
|
38
|
+
create_accessors key, json_hash, packet
|
39
|
+
end
|
40
|
+
end
|
41
|
+
self
|
42
|
+
end
|
43
|
+
|
44
|
+
def forbid *keys
|
45
|
+
keys.each do |key|
|
46
|
+
@validations << lambda do |json_hash, packet, packet_problems|
|
47
|
+
validate_missing key, json_hash, packet_problems
|
48
|
+
create_accessors key, json_hash, packet
|
49
|
+
end
|
50
|
+
end
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
def require_values(key_value_hashes)
|
55
|
+
key_value_hashes.each do |key, value|
|
56
|
+
@validations << lambda do |json_hash, packet, packet_problems|
|
57
|
+
validate_value key.to_s, value, json_hash, packet_problems
|
58
|
+
create_accessors key.to_s, json_hash, packet
|
59
|
+
end
|
60
|
+
end
|
61
|
+
self
|
62
|
+
end
|
63
|
+
|
64
|
+
def interested_in *keys
|
65
|
+
keys.each do |key|
|
66
|
+
@validations << lambda do |json_hash, packet, packet_problems|
|
67
|
+
create_accessors key, json_hash, packet
|
68
|
+
end
|
69
|
+
end
|
70
|
+
self
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def packet_from message, packet_problems
|
76
|
+
begin
|
77
|
+
json_hash = JSON.parse(message)
|
78
|
+
packet = Packet.new json_hash
|
79
|
+
@validations.each { |v| v.call json_hash, packet, packet_problems }
|
80
|
+
packet
|
81
|
+
rescue JSON::ParserError
|
82
|
+
packet_problems.severe_error("Invalid JSON format. Please check syntax carefully.")
|
83
|
+
rescue Exception => e
|
84
|
+
packet_problems.severe_error("Packet creation issue:\n\t#{e}")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def validate_required key, json_hash, packet_problems
|
89
|
+
return packet_problems.error "Missing required key #{key}" unless json_hash[key]
|
90
|
+
return packet_problems.error "Empty required key #{key}" unless value?(json_hash[key])
|
91
|
+
end
|
92
|
+
|
93
|
+
def validate_missing key, json_hash, packet_problems
|
94
|
+
return unless json_hash.key? key
|
95
|
+
return unless value?(json_hash[key])
|
96
|
+
packet_problems.error "Forbidden key #{key} detected"
|
97
|
+
end
|
98
|
+
|
99
|
+
def validate_value key, value, json_hash, packet_problems
|
100
|
+
validate_required key, json_hash, packet_problems
|
101
|
+
return if json_hash[key] == value
|
102
|
+
packet_problems.error "Required value of key '#{key}' is '#{json_hash[key]}', not '#{value}'"
|
103
|
+
end
|
104
|
+
|
105
|
+
def create_accessors key, json_hash, packet
|
106
|
+
packet.used_key key
|
107
|
+
establish_variable key, json_hash[key], packet
|
108
|
+
define_getter key, packet
|
109
|
+
define_setter key, packet
|
110
|
+
end
|
111
|
+
|
112
|
+
def establish_variable key, value = nil, packet
|
113
|
+
variable = variable(key)
|
114
|
+
packet.instance_variable_set variable, value
|
115
|
+
end
|
116
|
+
|
117
|
+
def define_getter key, packet
|
118
|
+
variable = variable(key)
|
119
|
+
packet.define_singleton_method(key.to_sym) do
|
120
|
+
instance_variable_get variable
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def define_setter key, packet
|
125
|
+
variable = variable(key)
|
126
|
+
packet.define_singleton_method((key + '=').to_sym) do |new_value|
|
127
|
+
instance_variable_set variable, new_value
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def variable key
|
132
|
+
('@' + key.to_s).to_sym
|
133
|
+
end
|
134
|
+
|
135
|
+
def value? value_under_test
|
136
|
+
return false if value_under_test.nil?
|
137
|
+
return true if value_under_test.kind_of?(Numeric)
|
138
|
+
return false if value_under_test == ''
|
139
|
+
return false if value_under_test == []
|
140
|
+
true
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rapids_rivers/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rapids_rivers"
|
8
|
+
spec.version = RapidsRivers::VERSION
|
9
|
+
spec.authors = ["Fred George"]
|
10
|
+
spec.email = ["fredgeorge@acm.org"]
|
11
|
+
|
12
|
+
spec.summary = %q{Provides a Rapids/Rivers framework for asynchronous MicroServices}
|
13
|
+
spec.description = %q{Provides a generic Rapids/Rivers framework, and a specific implementation useing RabbitMQ as the event bus.}
|
14
|
+
spec.homepage = "https://github.com/fredgeorge/rapids_rivers"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
# "public gem pushes."
|
24
|
+
# end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
35
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
36
|
+
spec.add_development_dependency "bunny", "~> 2.6"
|
37
|
+
spec.add_development_dependency "json", "~> 2.0"
|
38
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rapids_rivers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fred George
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '12.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '12.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bunny
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
description: Provides a generic Rapids/Rivers framework, and a specific implementation
|
84
|
+
useing RabbitMQ as the event bus.
|
85
|
+
email:
|
86
|
+
- fredgeorge@acm.org
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- CODE_OF_CONDUCT.md
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/console
|
99
|
+
- bin/setup
|
100
|
+
- lib/rapids_rivers.rb
|
101
|
+
- lib/rapids_rivers/packet.rb
|
102
|
+
- lib/rapids_rivers/packet_problems.rb
|
103
|
+
- lib/rapids_rivers/rabbit_mq/rabbit_mq_rapids.rb
|
104
|
+
- lib/rapids_rivers/rabbit_mq/rabbit_mq_river.rb
|
105
|
+
- lib/rapids_rivers/rapids_connection.rb
|
106
|
+
- lib/rapids_rivers/river.rb
|
107
|
+
- lib/rapids_rivers/version.rb
|
108
|
+
- rapids_rivers.gemspec
|
109
|
+
- vendor/cache/amq-protocol-2.1.0.gem
|
110
|
+
- vendor/cache/bunny-2.6.4.gem
|
111
|
+
- vendor/cache/json-2.0.3.gem
|
112
|
+
- vendor/cache/minitest-5.10.1.gem
|
113
|
+
- vendor/cache/rake-12.0.0.gem
|
114
|
+
homepage: https://github.com/fredgeorge/rapids_rivers
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.6.10
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Provides a Rapids/Rivers framework for asynchronous MicroServices
|
138
|
+
test_files: []
|