minuteman 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +8 -5
- data/Gemfile +5 -0
- data/Gemfile.lock +37 -0
- data/README.md +1 -1
- data/lib/minuteman.rb +3 -0
- data/lib/minuteman/analyzable.rb +2 -4
- data/lib/minuteman/configuration.rb +3 -2
- data/lib/minuteman/lua/operations.lua +3 -3
- data/lib/minuteman/model.rb +3 -3
- data/minuteman.gemspec +5 -4
- data/test/minuteman_test.rb +3 -2
- metadata +25 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 06c04125f35ec867eacf2e102f8476d575c61a789d6be45ebd89dc2df9a7e5c4
|
4
|
+
data.tar.gz: 8d838dc119c07c2a08b5c85beb94183c065caf8e529c635a77a9e2e0d64142f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e78b8dc6d545d7facd148a09bc4fabb79c19d6912f99ea5338139af7f43417806aa608446bd8419d7a55fb7e5e3976b6af3cb21cd49ca429fbb7f32393778722
|
7
|
+
data.tar.gz: 2d0bd6fc10941a9578fcb12e3b601512268b8b18fb1833a7fc15f9f6d2a865df6ae25e43b4c146f11aec2a7b3324fe19c5e0224a49d227ce82a11e708a1afb91
|
data/.travis.yml
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
3
|
-
install: bash <(curl -s https://raw.githubusercontent.com/elcuervo/rpm/master/bin/rpm-install)
|
2
|
+
|
4
3
|
rvm:
|
5
|
-
-
|
6
|
-
-
|
4
|
+
- 2.1
|
5
|
+
- 2.2
|
6
|
+
- 2.3
|
7
|
+
- 2.4
|
8
|
+
- 2.5
|
9
|
+
|
7
10
|
services:
|
8
|
-
-
|
11
|
+
- redis-server
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
minuteman (3.0.0)
|
5
|
+
nest (~> 3.1.2)
|
6
|
+
ohm (~> 3.1.1)
|
7
|
+
redic (~> 1.5.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
clap (1.0.0)
|
13
|
+
cutest (1.2.3)
|
14
|
+
clap
|
15
|
+
hiredis (0.6.3)
|
16
|
+
nest (3.1.2)
|
17
|
+
redic
|
18
|
+
ohm (3.1.1)
|
19
|
+
nest (~> 3)
|
20
|
+
redic (~> 1.5.0)
|
21
|
+
stal
|
22
|
+
rake (12.3.2)
|
23
|
+
redic (1.5.1)
|
24
|
+
hiredis
|
25
|
+
stal (0.3.0)
|
26
|
+
redic (~> 1.5)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
cutest (~> 1.2.3)
|
33
|
+
minuteman!
|
34
|
+
rake
|
35
|
+
|
36
|
+
BUNDLED WITH
|
37
|
+
1.17.2
|
data/README.md
CHANGED
@@ -141,7 +141,7 @@ user.uid # => "787c8770-0ac2-4654-9fa4-e57d152fa341"
|
|
141
141
|
|
142
142
|
# User lookup works like this:
|
143
143
|
# And you can use that unique identifier as a key in a cookie to see what your
|
144
|
-
#
|
144
|
+
# users do when no one is looking
|
145
145
|
Minuteman::User['787c8770-0ac2-4654-9fa4-e57d152fa341']
|
146
146
|
|
147
147
|
# But since the point is to be able to get tied to your data you can promote a
|
data/lib/minuteman.rb
CHANGED
@@ -105,10 +105,13 @@ module Minuteman
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
+
# Helper method to easily access the analytics part
|
108
109
|
def Minuteman(action)
|
109
110
|
Minuteman.analyze(action)
|
110
111
|
end
|
111
112
|
|
113
|
+
# Why call this method so different from Minuteman?
|
114
|
+
# for the lulz: https://github.com/maccman/counterman/issues/1
|
112
115
|
def Counterman(action)
|
113
116
|
Minuteman.count(action)
|
114
117
|
end
|
data/lib/minuteman/analyzable.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'msgpack'
|
2
|
-
|
3
1
|
module Minuteman
|
4
2
|
module Analyzable
|
5
3
|
module ErrorPatterns
|
@@ -57,8 +55,8 @@ module Minuteman
|
|
57
55
|
return Minuteman::Result.new(destination_key)
|
58
56
|
end
|
59
57
|
|
60
|
-
script(Minuteman::LUA_OPERATIONS, 0, action.upcase.
|
61
|
-
events.map(&:key).
|
58
|
+
script(Minuteman::LUA_OPERATIONS, 0, action.upcase.to_json,
|
59
|
+
events.map(&:key).to_json, destination_key.to_json)
|
62
60
|
|
63
61
|
Minuteman::Result.new(destination_key)
|
64
62
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Minuteman
|
2
2
|
class Configuration
|
3
|
-
|
3
|
+
attr_reader :redis
|
4
|
+
attr_accessor :patterns, :prefix, :parallel, :operations_prefix
|
4
5
|
|
5
6
|
def initialize
|
6
7
|
@redis = Ohm.redis
|
@@ -13,7 +14,7 @@ module Minuteman
|
|
13
14
|
month: -> (time) { time.strftime("%Y-%m") },
|
14
15
|
day: -> (time) { time.strftime("%Y-%m-%d") },
|
15
16
|
hour: -> (time) { time.strftime("%Y-%m-%d %H") },
|
16
|
-
minute: -> (time) { time.strftime("%Y-%m-%d %H:%
|
17
|
+
minute: -> (time) { time.strftime("%Y-%m-%d %H:%M") },
|
17
18
|
}
|
18
19
|
end
|
19
20
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
---
|
2
2
|
redis.log(redis.LOG_NOTICE, 'Minuteman')
|
3
3
|
|
4
|
-
local action =
|
5
|
-
local keys =
|
6
|
-
local dest =
|
4
|
+
local action = cjson.decode(ARGV[1])
|
5
|
+
local keys = cjson.decode(ARGV[2])
|
6
|
+
local dest = cjson.decode(ARGV[3])
|
7
7
|
|
8
8
|
local function operate(action, keys)
|
9
9
|
if type(keys) == "string" then keys = { keys } end
|
data/lib/minuteman/model.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require "ohm"
|
2
|
+
require "nest"
|
2
3
|
|
3
4
|
module Minuteman
|
4
5
|
class Model < ::Ohm::Model
|
@@ -31,8 +32,7 @@ module Minuteman
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def key
|
34
|
-
"#{self.class.name}::#{type}:#{time}"
|
35
|
+
Nest.new("#{self.class.name}::#{type}:#{time}", Minuteman.config.redis)
|
35
36
|
end
|
36
|
-
|
37
37
|
end
|
38
38
|
end
|
data/minuteman.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "minuteman"
|
3
|
-
s.version = "
|
3
|
+
s.version = "3.0.0"
|
4
4
|
s.summary = "Bit Analytics"
|
5
5
|
s.description = "Fast and furious tracking system using Redis bitwise operations"
|
6
6
|
s.authors = ["elcuervo"]
|
@@ -10,8 +10,9 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.files = `git ls-files`.split("\n")
|
11
11
|
s.test_files = `git ls-files test`.split("\n")
|
12
12
|
|
13
|
-
s.add_dependency("redic", "~> 1.5
|
14
|
-
s.add_dependency("
|
13
|
+
s.add_dependency("redic", "~> 1.5")
|
14
|
+
s.add_dependency("nest", "~> 3.1")
|
15
|
+
s.add_dependency("ohm", "~> 3.1")
|
15
16
|
|
16
|
-
s.add_development_dependency("cutest", "~> 1.2
|
17
|
+
s.add_development_dependency("cutest", "~> 1.2")
|
17
18
|
end
|
data/test/minuteman_test.rb
CHANGED
@@ -21,7 +21,8 @@ test "a connection" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
test "models in minuteman namespace" do
|
24
|
-
|
24
|
+
namespace = Minuteman::User.create.key.to_s
|
25
|
+
assert_equal namespace, "Minuteman::User:1"
|
25
26
|
end
|
26
27
|
|
27
28
|
test "an anonymous user" do
|
@@ -51,7 +52,7 @@ test "track an user" do
|
|
51
52
|
assert Minuteman.track("login:successful", user)
|
52
53
|
|
53
54
|
analyzer = Minuteman.analyze("login:successful")
|
54
|
-
|
55
|
+
assert_equal analyzer.day(Time.now.utc).count, 1
|
55
56
|
end
|
56
57
|
|
57
58
|
test "tracks an anonymous user and the promotes it to a real one" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minuteman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- elcuervo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redic
|
@@ -16,42 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.5
|
19
|
+
version: '1.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.5
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: ohm
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: '3.1'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: '3.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: cutest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.2
|
61
|
+
version: '1.2'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.2
|
68
|
+
version: '1.2'
|
55
69
|
description: Fast and furious tracking system using Redis bitwise operations
|
56
70
|
email:
|
57
71
|
- yo@brunoaguirre.com
|
@@ -62,6 +76,8 @@ files:
|
|
62
76
|
- ".gems"
|
63
77
|
- ".gitignore"
|
64
78
|
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
65
81
|
- HUGS
|
66
82
|
- LICENSE
|
67
83
|
- ORIGIN.md
|
@@ -103,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
119
|
version: '0'
|
104
120
|
requirements: []
|
105
121
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.7.6
|
107
123
|
signing_key:
|
108
124
|
specification_version: 4
|
109
125
|
summary: Bit Analytics
|