senna 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +49 -0
- data/LICENSE +5 -0
- data/README.md +1 -0
- data/bin/senna +13 -0
- data/lib/senna.rb +3 -0
- data/lib/senna/logger.rb +61 -0
- data/lib/senna/version.rb +5 -0
- data/senna.gemspec +23 -0
- data/spec/spec_helper.rb +83 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8be58f45f38cac9ea95ceeb1d61c4c09937740cb5b3cacf9cf37266928cc13bd
|
4
|
+
data.tar.gz: 53d2cf94e63be4de2e281ffdddd72380e6fff4cd272f143f4fd4b576568197c7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 608e3f5ac760344b47804c98a9314c03aec8c2d3f11eaea3b7dd4bf3587d17d830cbc1170840abbfe6f8f4b112fb7904d50b4ef2aba7c2ce6d82c23214c16857
|
7
|
+
data.tar.gz: 3df5d5615ef2e3e3886372aef2967a65922871c3107499a3a174156bb082b72de2e1b25cda698bd8bc9a8d571fa4e527e78c77b29cf21b14797a4e21485eb868
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
varsity (0.0.1)
|
5
|
+
async (~> 1.20)
|
6
|
+
async-container (~> 0.14)
|
7
|
+
async-io (~> 1.24)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
async (1.20.1)
|
13
|
+
console (~> 1.0)
|
14
|
+
nio4r (~> 2.3)
|
15
|
+
timers (~> 4.1)
|
16
|
+
async-container (0.14.1)
|
17
|
+
async (~> 1.0)
|
18
|
+
async-io (~> 1.4)
|
19
|
+
process-group
|
20
|
+
async-io (1.24.0)
|
21
|
+
async (~> 1.14)
|
22
|
+
console (1.4.0)
|
23
|
+
diff-lcs (1.3)
|
24
|
+
nio4r (2.4.0)
|
25
|
+
process-group (1.1.0)
|
26
|
+
rspec (3.8.0)
|
27
|
+
rspec-core (~> 3.8.0)
|
28
|
+
rspec-expectations (~> 3.8.0)
|
29
|
+
rspec-mocks (~> 3.8.0)
|
30
|
+
rspec-core (3.8.2)
|
31
|
+
rspec-support (~> 3.8.0)
|
32
|
+
rspec-expectations (3.8.4)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.8.0)
|
35
|
+
rspec-mocks (3.8.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.8.0)
|
38
|
+
rspec-support (3.8.2)
|
39
|
+
timers (4.3.0)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
rspec (= 3.8.0)
|
46
|
+
varsity!
|
47
|
+
|
48
|
+
BUNDLED WITH
|
49
|
+
1.17.2
|
data/LICENSE
ADDED
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Senna
|
data/bin/senna
ADDED
data/lib/senna.rb
ADDED
data/lib/senna/logger.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Senna
|
4
|
+
class Logger
|
5
|
+
|
6
|
+
COLORS = ::Hash[
|
7
|
+
black: 30,
|
8
|
+
red: 31,
|
9
|
+
green: 32,
|
10
|
+
yellow: 33,
|
11
|
+
blue: 34,
|
12
|
+
magenta: 35,
|
13
|
+
cyan: 36,
|
14
|
+
gray: 37,
|
15
|
+
light_cyan: 96,
|
16
|
+
white: 97
|
17
|
+
].freeze
|
18
|
+
|
19
|
+
def self.color_code(code)
|
20
|
+
COLORS.fetch(code) { raise(ArgumentError, "Color #{code} not supported.") }
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.colorize(input, color:)
|
24
|
+
"\e[#{color_code(color)}m#{input}\e[0m"
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.log(topic:, message:)
|
28
|
+
puts "#{print_topic(topic)} #{message}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.print_topic(topic)
|
32
|
+
topic_string = "[#{topic}]"
|
33
|
+
|
34
|
+
color = case topic.to_sym
|
35
|
+
when :primary_session
|
36
|
+
:green
|
37
|
+
when :previous_session, :back_to_session
|
38
|
+
:yellow
|
39
|
+
when :facebook, :twilio, :bandwidth
|
40
|
+
:blue
|
41
|
+
when :smooch
|
42
|
+
:magenta
|
43
|
+
when :alexa
|
44
|
+
:light_cyan
|
45
|
+
when :catch_all
|
46
|
+
:red
|
47
|
+
when :user
|
48
|
+
:white
|
49
|
+
else
|
50
|
+
:gray
|
51
|
+
end
|
52
|
+
|
53
|
+
colorize(topic_string, color: color)
|
54
|
+
end
|
55
|
+
|
56
|
+
class << self
|
57
|
+
alias_method :l, :log
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
data/senna.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "lib/senna/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'senna'
|
5
|
+
s.version = Senna::VERSION
|
6
|
+
s.summary = 'Senna'
|
7
|
+
s.description = 'High performance, background jobs for Ruby.'
|
8
|
+
s.authors = ['Mauricio Gomes']
|
9
|
+
s.email = 'mauricio@edge14.com'
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
s.homepage = 'http://github.com/mgomes/senna'
|
12
|
+
s.license = 'LGPLv3'
|
13
|
+
s.required_ruby_version = ">= 2.4.0"
|
14
|
+
s.executables = ['senna']
|
15
|
+
|
16
|
+
s.add_dependency 'async', '~> 1.20'
|
17
|
+
s.add_dependency 'async-io', '~> 1.24'
|
18
|
+
s.add_dependency 'async-container', '~> 0.14'
|
19
|
+
s.add_dependency 'redis', '>= 4.0.2'
|
20
|
+
|
21
|
+
s.add_development_dependency 'rspec', '= 3.8.0'
|
22
|
+
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.expect_with :rspec do |expectations|
|
8
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
9
|
+
# and `failure_message` of custom matchers include text for helper methods
|
10
|
+
# defined using `chain`, e.g.:
|
11
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
12
|
+
# # => "be bigger than 2 and smaller than 4"
|
13
|
+
# ...rather than:
|
14
|
+
# # => "be bigger than 2"
|
15
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
16
|
+
end
|
17
|
+
|
18
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
19
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
20
|
+
config.mock_with :rspec do |mocks|
|
21
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
22
|
+
# a real object. This is generally recommended, and will default to
|
23
|
+
# `true` in RSpec 4.
|
24
|
+
mocks.verify_partial_doubles = true
|
25
|
+
end
|
26
|
+
|
27
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
28
|
+
# have no way to turn it off -- the option exists only for backwards
|
29
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
30
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
31
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
32
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
33
|
+
|
34
|
+
# The settings below are suggested to provide a good initial experience
|
35
|
+
# with RSpec, but feel free to customize to your heart's content.
|
36
|
+
=begin
|
37
|
+
# This allows you to limit a spec run to individual examples or groups
|
38
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
39
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
40
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
41
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
42
|
+
config.filter_run_when_matching :focus
|
43
|
+
|
44
|
+
# Allows RSpec to persist some state between runs in order to support
|
45
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
46
|
+
# you configure your source control system to ignore this file.
|
47
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
48
|
+
|
49
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
50
|
+
# recommended. For more details, see:
|
51
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
52
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
53
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
54
|
+
config.disable_monkey_patching!
|
55
|
+
|
56
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
57
|
+
# file, and it's useful to allow more verbose output when running an
|
58
|
+
# individual spec file.
|
59
|
+
if config.files_to_run.one?
|
60
|
+
# Use the documentation formatter for detailed output,
|
61
|
+
# unless a formatter has already been configured
|
62
|
+
# (e.g. via a command-line flag).
|
63
|
+
config.default_formatter = 'doc'
|
64
|
+
end
|
65
|
+
|
66
|
+
# Print the 10 slowest examples and example groups at the
|
67
|
+
# end of the spec run, to help surface which specs are running
|
68
|
+
# particularly slow.
|
69
|
+
config.profile_examples = 10
|
70
|
+
|
71
|
+
# Run specs in random order to surface order dependencies. If you find an
|
72
|
+
# order dependency and want to debug it, you can fix the order by providing
|
73
|
+
# the seed, which is printed after each run.
|
74
|
+
# --seed 1234
|
75
|
+
config.order = :random
|
76
|
+
|
77
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
78
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
79
|
+
# test failures related to randomization by passing the same `--seed` value
|
80
|
+
# as the one that triggered the failure.
|
81
|
+
Kernel.srand config.seed
|
82
|
+
=end
|
83
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: senna
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mauricio Gomes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-07-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: async
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.20'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.20'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: async-io
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.24'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.24'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: async-container
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.14'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: redis
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.0.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.0.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.8.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.8.0
|
83
|
+
description: High performance, background jobs for Ruby.
|
84
|
+
email: mauricio@edge14.com
|
85
|
+
executables:
|
86
|
+
- senna
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- Gemfile
|
91
|
+
- Gemfile.lock
|
92
|
+
- LICENSE
|
93
|
+
- README.md
|
94
|
+
- bin/senna
|
95
|
+
- lib/senna.rb
|
96
|
+
- lib/senna/logger.rb
|
97
|
+
- lib/senna/version.rb
|
98
|
+
- senna.gemspec
|
99
|
+
- spec/spec_helper.rb
|
100
|
+
homepage: http://github.com/mgomes/senna
|
101
|
+
licenses:
|
102
|
+
- LGPLv3
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 2.4.0
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubygems_version: 3.0.3
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Senna
|
123
|
+
test_files: []
|