matey 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.devcontainer/Dockerfile +17 -0
- data/.devcontainer/base.Dockerfile +43 -0
- data/.devcontainer/devcontainer.json +33 -0
- data/.rspec +3 -0
- data/.standard.yml +6 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +27 -0
- data/Gemfile.lock +259 -0
- data/LICENSE.txt +21 -0
- data/README.md +160 -0
- data/Rakefile +20 -0
- data/app/components/application_component.rb +10 -0
- data/app/components/matey/active_users_component.html.erb +15 -0
- data/app/components/matey/active_users_component.rb +16 -0
- data/app/components/matey/new_activity_component.html.erb +15 -0
- data/app/components/matey/new_activity_component.rb +14 -0
- data/app/components/matey/new_users_component.html.erb +15 -0
- data/app/components/matey/new_users_component.rb +11 -0
- data/app/components/matey/top_events_component.html.erb +29 -0
- data/app/components/matey/top_events_component.rb +11 -0
- data/app/components/matey/top_visited_pages_table_component.html.erb +27 -0
- data/app/components/matey/top_visited_pages_table_component.rb +11 -0
- data/images/.DS_Store +0 -0
- data/images/activeUsersComponent.png +0 -0
- data/images/newActivityComponent.png +0 -0
- data/images/newUsersComponent.png +0 -0
- data/images/topEventsComponent.png +0 -0
- data/images/topVisitedPages.png +0 -0
- data/lib/matey/version.rb +5 -0
- data/lib/matey.rb +15 -0
- data/matey.gemspec +43 -0
- data/sig/matey.rbs +4 -0
- metadata +183 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 66e49f6118a1523d6292998e3d8fa619215337fc30de9eb53ed9a80fbb0afe69
|
4
|
+
data.tar.gz: 5de9ddf3a9ba33dff9df9561ed67fab9ed95e996dfc0aa7d7a77bd89632de116
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1624664b60404d56131c260aa31f9cdfc6a5b5947d9b46ff49904011f0cfa2b180b46ce1aff9f21342d0ada07038920ef8ad1b5147ad8cbee548f820deddb246
|
7
|
+
data.tar.gz: fb0ef079b743b0976606b21e9952004fcb22d6959c3b28fd7fc87adff39ba44c62a8aadb877a151eae34da7357f2c0e95341bc7ded68dab8747ddd4c9cf3ac9f
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.1, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.1-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.1-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster
|
2
|
+
ARG VARIANT=2-bullseye
|
3
|
+
FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
|
4
|
+
|
5
|
+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
6
|
+
ARG NODE_VERSION="none"
|
7
|
+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
8
|
+
|
9
|
+
# [Optional] Uncomment this section to install additional OS packages.
|
10
|
+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
11
|
+
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
12
|
+
|
13
|
+
# [Optional] Uncomment this line to install additional gems.
|
14
|
+
# RUN gem install <your-gem-names-here>
|
15
|
+
|
16
|
+
# [Optional] Uncomment this line to install global node packages.
|
17
|
+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.1, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.1-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.1-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster
|
2
|
+
ARG VARIANT=2-bullseye
|
3
|
+
FROM ruby:${VARIANT}
|
4
|
+
|
5
|
+
# Copy library scripts to execute
|
6
|
+
COPY library-scripts/*.sh library-scripts/*.env /tmp/library-scripts/
|
7
|
+
|
8
|
+
# [Option] Install zsh
|
9
|
+
ARG INSTALL_ZSH="true"
|
10
|
+
# [Option] Upgrade OS packages to their latest versions
|
11
|
+
ARG UPGRADE_PACKAGES="true"
|
12
|
+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
|
13
|
+
ARG USERNAME=vscode
|
14
|
+
ARG USER_UID=1000
|
15
|
+
ARG USER_GID=$USER_UID
|
16
|
+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
17
|
+
# Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131
|
18
|
+
&& apt-get purge -y imagemagick imagemagick-6-common \
|
19
|
+
# Install common packages, non-root user, rvm, core build tools
|
20
|
+
&& bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
|
21
|
+
&& bash /tmp/library-scripts/ruby-debian.sh "none" "${USERNAME}" "true" "true" \
|
22
|
+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
23
|
+
|
24
|
+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
25
|
+
ARG NODE_VERSION="none"
|
26
|
+
ENV NVM_DIR=/usr/local/share/nvm
|
27
|
+
ENV NVM_SYMLINK_CURRENT=true \
|
28
|
+
PATH=${NVM_DIR}/current/bin:${PATH}
|
29
|
+
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
|
30
|
+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
31
|
+
|
32
|
+
# Remove library scripts for final image
|
33
|
+
RUN rm -rf /tmp/library-scripts
|
34
|
+
|
35
|
+
# [Optional] Uncomment this section to install additional OS packages.
|
36
|
+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
37
|
+
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
38
|
+
|
39
|
+
# [Optional] Uncomment this line to install additional gems.
|
40
|
+
# RUN gem install <your-gem-names-here>
|
41
|
+
|
42
|
+
# [Optional] Uncomment this line to install global node packages.
|
43
|
+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
@@ -0,0 +1,33 @@
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
2
|
+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.217.4/containers/ruby
|
3
|
+
{
|
4
|
+
"name": "Ruby",
|
5
|
+
"build": {
|
6
|
+
"dockerfile": "Dockerfile",
|
7
|
+
"args": {
|
8
|
+
// Update 'VARIANT' to pick a Ruby version: 3, 3.1, 3.0, 2, 2.7, 2.6
|
9
|
+
// Append -bullseye or -buster to pin to an OS version.
|
10
|
+
// Use -bullseye variants on local on arm64/Apple Silicon.
|
11
|
+
"VARIANT": "3.1",
|
12
|
+
// Options
|
13
|
+
"NODE_VERSION": "lts/*"
|
14
|
+
}
|
15
|
+
},
|
16
|
+
|
17
|
+
// Set *default* container specific settings.json values on container create.
|
18
|
+
"settings": {},
|
19
|
+
|
20
|
+
// Add the IDs of extensions you want installed when the container is created.
|
21
|
+
"extensions": [
|
22
|
+
"rebornix.Ruby"
|
23
|
+
],
|
24
|
+
|
25
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
26
|
+
// "forwardPorts": [],
|
27
|
+
|
28
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
29
|
+
// "postCreateCommand": "ruby --version",
|
30
|
+
|
31
|
+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
32
|
+
"remoteUser": "vscode"
|
33
|
+
}
|
data/.rspec
ADDED
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at chris@harled.ca. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# rails_version = "#{ENV['RAILS_VERSION'] || 'main'}"
|
7
|
+
rails_version = (ENV["RAILS_VERSION"] || "~> 7").to_s
|
8
|
+
gem "rails", rails_version == "main" ? {git: "https://github.com/rails/rails", ref: "main"} : rails_version
|
9
|
+
gem "sqlite3", ">= 1.4"
|
10
|
+
|
11
|
+
gem "rake", "~> 13.0"
|
12
|
+
|
13
|
+
gem "rspec", "~> 3.0"
|
14
|
+
gem "rspec-rails", "~> 5.0.0"
|
15
|
+
gem "factory_bot_rails"
|
16
|
+
|
17
|
+
gem "standard", "~> 1.3"
|
18
|
+
|
19
|
+
gem "debug", platforms: %i[mri mingw x64_mingw]
|
20
|
+
|
21
|
+
if RUBY_VERSION >= "3.1"
|
22
|
+
gem "net-imap", require: false
|
23
|
+
gem "net-pop", require: false
|
24
|
+
gem "net-smtp", require: false
|
25
|
+
end
|
26
|
+
|
27
|
+
gem "byebug", "~> 11.1", groups: [:development, :test]
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
matey (0.1.1)
|
5
|
+
ahoy_matey (~> 4.0)
|
6
|
+
view_component (~> 2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (7.0.2.3)
|
12
|
+
actionpack (= 7.0.2.3)
|
13
|
+
activesupport (= 7.0.2.3)
|
14
|
+
nio4r (~> 2.0)
|
15
|
+
websocket-driver (>= 0.6.1)
|
16
|
+
actionmailbox (7.0.2.3)
|
17
|
+
actionpack (= 7.0.2.3)
|
18
|
+
activejob (= 7.0.2.3)
|
19
|
+
activerecord (= 7.0.2.3)
|
20
|
+
activestorage (= 7.0.2.3)
|
21
|
+
activesupport (= 7.0.2.3)
|
22
|
+
mail (>= 2.7.1)
|
23
|
+
net-imap
|
24
|
+
net-pop
|
25
|
+
net-smtp
|
26
|
+
actionmailer (7.0.2.3)
|
27
|
+
actionpack (= 7.0.2.3)
|
28
|
+
actionview (= 7.0.2.3)
|
29
|
+
activejob (= 7.0.2.3)
|
30
|
+
activesupport (= 7.0.2.3)
|
31
|
+
mail (~> 2.5, >= 2.5.4)
|
32
|
+
net-imap
|
33
|
+
net-pop
|
34
|
+
net-smtp
|
35
|
+
rails-dom-testing (~> 2.0)
|
36
|
+
actionpack (7.0.2.3)
|
37
|
+
actionview (= 7.0.2.3)
|
38
|
+
activesupport (= 7.0.2.3)
|
39
|
+
rack (~> 2.0, >= 2.2.0)
|
40
|
+
rack-test (>= 0.6.3)
|
41
|
+
rails-dom-testing (~> 2.0)
|
42
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
43
|
+
actiontext (7.0.2.3)
|
44
|
+
actionpack (= 7.0.2.3)
|
45
|
+
activerecord (= 7.0.2.3)
|
46
|
+
activestorage (= 7.0.2.3)
|
47
|
+
activesupport (= 7.0.2.3)
|
48
|
+
globalid (>= 0.6.0)
|
49
|
+
nokogiri (>= 1.8.5)
|
50
|
+
actionview (7.0.2.3)
|
51
|
+
activesupport (= 7.0.2.3)
|
52
|
+
builder (~> 3.1)
|
53
|
+
erubi (~> 1.4)
|
54
|
+
rails-dom-testing (~> 2.0)
|
55
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
56
|
+
activejob (7.0.2.3)
|
57
|
+
activesupport (= 7.0.2.3)
|
58
|
+
globalid (>= 0.3.6)
|
59
|
+
activemodel (7.0.2.3)
|
60
|
+
activesupport (= 7.0.2.3)
|
61
|
+
activerecord (7.0.2.3)
|
62
|
+
activemodel (= 7.0.2.3)
|
63
|
+
activesupport (= 7.0.2.3)
|
64
|
+
activestorage (7.0.2.3)
|
65
|
+
actionpack (= 7.0.2.3)
|
66
|
+
activejob (= 7.0.2.3)
|
67
|
+
activerecord (= 7.0.2.3)
|
68
|
+
activesupport (= 7.0.2.3)
|
69
|
+
marcel (~> 1.0)
|
70
|
+
mini_mime (>= 1.1.0)
|
71
|
+
activesupport (7.0.2.3)
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
73
|
+
i18n (>= 1.6, < 2)
|
74
|
+
minitest (>= 5.1)
|
75
|
+
tzinfo (~> 2.0)
|
76
|
+
ahoy_matey (4.0.3)
|
77
|
+
activesupport (>= 5.2)
|
78
|
+
device_detector
|
79
|
+
safely_block (>= 0.2.1)
|
80
|
+
ast (2.4.2)
|
81
|
+
builder (3.2.4)
|
82
|
+
byebug (11.1.3)
|
83
|
+
concurrent-ruby (1.1.10)
|
84
|
+
crass (1.0.6)
|
85
|
+
debug (1.4.0)
|
86
|
+
irb (>= 1.3.6)
|
87
|
+
reline (>= 0.2.7)
|
88
|
+
device_detector (1.0.7)
|
89
|
+
diff-lcs (1.5.0)
|
90
|
+
digest (3.1.0)
|
91
|
+
errbase (0.2.2)
|
92
|
+
erubi (1.10.0)
|
93
|
+
factory_bot (6.2.1)
|
94
|
+
activesupport (>= 5.0.0)
|
95
|
+
factory_bot_rails (6.2.0)
|
96
|
+
factory_bot (~> 6.2.0)
|
97
|
+
railties (>= 5.0.0)
|
98
|
+
globalid (1.0.0)
|
99
|
+
activesupport (>= 5.0)
|
100
|
+
i18n (1.10.0)
|
101
|
+
concurrent-ruby (~> 1.0)
|
102
|
+
io-console (0.5.11)
|
103
|
+
io-wait (0.2.1)
|
104
|
+
irb (1.4.1)
|
105
|
+
reline (>= 0.3.0)
|
106
|
+
loofah (2.15.0)
|
107
|
+
crass (~> 1.0.2)
|
108
|
+
nokogiri (>= 1.5.9)
|
109
|
+
mail (2.7.1)
|
110
|
+
mini_mime (>= 0.1.1)
|
111
|
+
marcel (1.0.2)
|
112
|
+
method_source (1.0.0)
|
113
|
+
mini_mime (1.1.2)
|
114
|
+
minitest (5.15.0)
|
115
|
+
net-imap (0.2.3)
|
116
|
+
digest
|
117
|
+
net-protocol
|
118
|
+
strscan
|
119
|
+
net-pop (0.1.1)
|
120
|
+
digest
|
121
|
+
net-protocol
|
122
|
+
timeout
|
123
|
+
net-protocol (0.1.2)
|
124
|
+
io-wait
|
125
|
+
timeout
|
126
|
+
net-smtp (0.3.1)
|
127
|
+
digest
|
128
|
+
net-protocol
|
129
|
+
timeout
|
130
|
+
nio4r (2.5.8)
|
131
|
+
nokogiri (1.13.3-x86_64-darwin)
|
132
|
+
racc (~> 1.4)
|
133
|
+
nokogiri (1.13.3-x86_64-linux)
|
134
|
+
racc (~> 1.4)
|
135
|
+
parallel (1.22.1)
|
136
|
+
parser (3.1.1.0)
|
137
|
+
ast (~> 2.4.1)
|
138
|
+
racc (1.6.0)
|
139
|
+
rack (2.2.3)
|
140
|
+
rack-test (1.1.0)
|
141
|
+
rack (>= 1.0, < 3)
|
142
|
+
rails (7.0.2.3)
|
143
|
+
actioncable (= 7.0.2.3)
|
144
|
+
actionmailbox (= 7.0.2.3)
|
145
|
+
actionmailer (= 7.0.2.3)
|
146
|
+
actionpack (= 7.0.2.3)
|
147
|
+
actiontext (= 7.0.2.3)
|
148
|
+
actionview (= 7.0.2.3)
|
149
|
+
activejob (= 7.0.2.3)
|
150
|
+
activemodel (= 7.0.2.3)
|
151
|
+
activerecord (= 7.0.2.3)
|
152
|
+
activestorage (= 7.0.2.3)
|
153
|
+
activesupport (= 7.0.2.3)
|
154
|
+
bundler (>= 1.15.0)
|
155
|
+
railties (= 7.0.2.3)
|
156
|
+
rails-dom-testing (2.0.3)
|
157
|
+
activesupport (>= 4.2.0)
|
158
|
+
nokogiri (>= 1.6)
|
159
|
+
rails-html-sanitizer (1.4.2)
|
160
|
+
loofah (~> 2.3)
|
161
|
+
railties (7.0.2.3)
|
162
|
+
actionpack (= 7.0.2.3)
|
163
|
+
activesupport (= 7.0.2.3)
|
164
|
+
method_source
|
165
|
+
rake (>= 12.2)
|
166
|
+
thor (~> 1.0)
|
167
|
+
zeitwerk (~> 2.5)
|
168
|
+
rainbow (3.1.1)
|
169
|
+
rake (13.0.6)
|
170
|
+
regexp_parser (2.2.1)
|
171
|
+
reline (0.3.1)
|
172
|
+
io-console (~> 0.5)
|
173
|
+
rexml (3.2.5)
|
174
|
+
rspec (3.11.0)
|
175
|
+
rspec-core (~> 3.11.0)
|
176
|
+
rspec-expectations (~> 3.11.0)
|
177
|
+
rspec-mocks (~> 3.11.0)
|
178
|
+
rspec-core (3.11.0)
|
179
|
+
rspec-support (~> 3.11.0)
|
180
|
+
rspec-expectations (3.11.0)
|
181
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
182
|
+
rspec-support (~> 3.11.0)
|
183
|
+
rspec-mocks (3.11.0)
|
184
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
185
|
+
rspec-support (~> 3.11.0)
|
186
|
+
rspec-rails (5.0.3)
|
187
|
+
actionpack (>= 5.2)
|
188
|
+
activesupport (>= 5.2)
|
189
|
+
railties (>= 5.2)
|
190
|
+
rspec-core (~> 3.10)
|
191
|
+
rspec-expectations (~> 3.10)
|
192
|
+
rspec-mocks (~> 3.10)
|
193
|
+
rspec-support (~> 3.10)
|
194
|
+
rspec-support (3.11.0)
|
195
|
+
rubocop (1.26.0)
|
196
|
+
parallel (~> 1.10)
|
197
|
+
parser (>= 3.1.0.0)
|
198
|
+
rainbow (>= 2.2.2, < 4.0)
|
199
|
+
regexp_parser (>= 1.8, < 3.0)
|
200
|
+
rexml
|
201
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
202
|
+
ruby-progressbar (~> 1.7)
|
203
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
204
|
+
rubocop-ast (1.16.0)
|
205
|
+
parser (>= 3.1.1.0)
|
206
|
+
rubocop-performance (1.13.3)
|
207
|
+
rubocop (>= 1.7.0, < 2.0)
|
208
|
+
rubocop-ast (>= 0.4.0)
|
209
|
+
ruby-progressbar (1.11.0)
|
210
|
+
safely_block (0.3.0)
|
211
|
+
errbase (>= 0.1.1)
|
212
|
+
sprockets (4.0.3)
|
213
|
+
concurrent-ruby (~> 1.0)
|
214
|
+
rack (> 1, < 3)
|
215
|
+
sprockets-rails (3.2.2)
|
216
|
+
actionpack (>= 4.0)
|
217
|
+
activesupport (>= 4.0)
|
218
|
+
sprockets (>= 3.0.0)
|
219
|
+
sqlite3 (1.4.2)
|
220
|
+
standard (1.9.0)
|
221
|
+
rubocop (= 1.26.0)
|
222
|
+
rubocop-performance (= 1.13.3)
|
223
|
+
strscan (3.0.1)
|
224
|
+
thor (1.2.1)
|
225
|
+
timeout (0.2.0)
|
226
|
+
tzinfo (2.0.4)
|
227
|
+
concurrent-ruby (~> 1.0)
|
228
|
+
unicode-display_width (2.1.0)
|
229
|
+
view_component (2.52.0)
|
230
|
+
activesupport (>= 5.0.0, < 8.0)
|
231
|
+
method_source (~> 1.0)
|
232
|
+
websocket-driver (0.7.5)
|
233
|
+
websocket-extensions (>= 0.1.0)
|
234
|
+
websocket-extensions (0.1.5)
|
235
|
+
zeitwerk (2.5.4)
|
236
|
+
|
237
|
+
PLATFORMS
|
238
|
+
x86_64-darwin-21
|
239
|
+
x86_64-linux
|
240
|
+
|
241
|
+
DEPENDENCIES
|
242
|
+
byebug (~> 11.1)
|
243
|
+
debug
|
244
|
+
factory_bot (~> 6.0)
|
245
|
+
factory_bot_rails
|
246
|
+
matey!
|
247
|
+
net-imap
|
248
|
+
net-pop
|
249
|
+
net-smtp
|
250
|
+
rails (~> 7)
|
251
|
+
rake (~> 13.0)
|
252
|
+
rspec (~> 3.0)
|
253
|
+
rspec-rails (~> 5.0.0)
|
254
|
+
sprockets-rails (~> 3.2.2)
|
255
|
+
sqlite3 (>= 1.4)
|
256
|
+
standard (~> 1.3)
|
257
|
+
|
258
|
+
BUNDLED WITH
|
259
|
+
2.3.7
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Chris Young
|
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,160 @@
|
|
1
|
+
# Matey
|
2
|
+
|
3
|
+
![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/harled/matey)
|
4
|
+
![GitHub issues](https://img.shields.io/github/issues-raw/harled/matey)
|
5
|
+
![GitHub Repo stars](https://img.shields.io/github/stars/harled/matey?logoColor=purple&style=social)
|
6
|
+
|
7
|
+
📈 User Engagement Tracking Components for [Ahoy](https://github.com/ankane/ahoy) 🏴☠️
|
8
|
+
|
9
|
+
A suite of user engagment ViewComponents for plug and play use right from your Ahoy data!
|
10
|
+
No need to spend time finding what information you need and how to write the queries to set that up.
|
11
|
+
Simply install the gem, input the required data and track how your users are responding to your application!
|
12
|
+
|
13
|
+
Project Lead: Caitlin Henry
|
14
|
+
[**caitmich**](https://github.com/caitmich) | (*caitlin@harled.ca*)
|
15
|
+
|
16
|
+
This gem assumes that event data is coming from [Ahoy](https://github.com/ankane/ahoy) which is a fantastic library
|
17
|
+
for tracking visits and events. Your project must have Ahoy installed and configured in order to benefit from Matey.
|
18
|
+
|
19
|
+
This gem assumes that you have [Bootstrap 5.1](https://getbootstrap.com/docs/5.1/getting-started/introduction/) loaded in your project. It will work without Bootstrap, however, you will need to provide your own custom styling for the Bootstrap equivalent classes.
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
Add this line to your application's Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'matey', github: 'harled/matey', branch: 'main'
|
27
|
+
```
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
|
31
|
+
$ bundle install
|
32
|
+
|
33
|
+
You will now have the latest version of Matey on your project. Checkout the Usage section to see what components there are and how to use them in your app!
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
Look here to see what components Matey offers and how to use them 🛠️
|
38
|
+
|
39
|
+
### Common Flows
|
40
|
+
|
41
|
+
Some common flows to recognize how the named paramaters work for the components. This is what a Matey view component render line would look like in your view file:
|
42
|
+
|
43
|
+
```
|
44
|
+
<%= render Matey::ComponentName.new(events: Ahoy::Event.all, time_window: 1.week) %>
|
45
|
+
```
|
46
|
+
|
47
|
+
Here we can see that all components begin with **`Matey::`** followed by the name of the component. The **`data`** parameter will take in Ahoy data as an ***ActiveRecordRelation*** collection.
|
48
|
+
|
49
|
+
The **`time_window`** takes in an amount of time that the component will look calculate the data for and uses this to set the specific date range that the data will be taken from. This is an optional parameter and the default will be a 1 week time window.
|
50
|
+
|
51
|
+
In this example, the component will take the **`Ahoy::Events`** data and show information about the week of data.
|
52
|
+
|
53
|
+
**Note**: The data the component is completely limited by the extent of your [Ahoy](https://github.com/ankane/ahoy) data. Setting up events on each controller action can be seen [here](https://github.com/ankane/ahoy#ruby) and can be done in the base controller so that all other controllers inherit from here and will create Ahoy events.
|
54
|
+
|
55
|
+
Also, if you have a lot of data, you can cut down the data that you are passing through by reducing the time the events have occurred, however the comparison between the current and previous `time_window` will require two time windows worth of data (ie. for data from last week, this will compare to data from 2 weeks ago)
|
56
|
+
|
57
|
+
### New Users Component
|
58
|
+
|
59
|
+
![New Users Component](./images/newUsersComponent.png)
|
60
|
+
|
61
|
+
The New Users component will calculate the number of new users that have been created in the given time window and show you the amount and percentage change from the previous time period. The code should look like this:
|
62
|
+
|
63
|
+
```
|
64
|
+
<%= render Matey::NewUsersComponent.new(users: User.all, time_window: 2.month) %>
|
65
|
+
```
|
66
|
+
|
67
|
+
Here we are passing in all of our **User** model data for the component to find the new users that were made in the last 2 months, but we can filter this data to only include a specific subset of users or from a specific time period. The component will find the new users created in the past month and show us the increase/decrease since the last period.
|
68
|
+
### Active Users
|
69
|
+
|
70
|
+
![Active Users Component](./images/activeUsersComponent.png)
|
71
|
+
|
72
|
+
The Active Users component will calculate the number of active users that have been created in the given time window and show you the amount and percentage change from the previous time period. This component counts active users as those who have been involved in an Ahoy event in the given time window. The code should look like this:
|
73
|
+
|
74
|
+
```
|
75
|
+
<%= render Matey::ActiveUsersComponent.new(events: Ahoy::Event.all, time_window: 1.month) %>
|
76
|
+
```
|
77
|
+
|
78
|
+
Here we are passing in all of our **Ahoy::Event** model data for the component to find the user that were triggered some Ahoy Event, but we can filter this data to only include a specific subset of Ahoy Events or from a specific time period. The component will find the active users created in the past month and show us the increase/decrease since the last period.
|
79
|
+
|
80
|
+
### New Activity Component
|
81
|
+
|
82
|
+
![New Activity Component](./images/newActivityComponent.png)
|
83
|
+
|
84
|
+
The New Activity component will calculate the number of Ahoy events that have been created in the given time window and show you the amount and percentage change from the previous time period. The implementation should look like:
|
85
|
+
|
86
|
+
```
|
87
|
+
<%= render Matey::NewActivityComponent.new(events: Ahoy::Event.all, time_window: 1.month) %>
|
88
|
+
```
|
89
|
+
|
90
|
+
Here we are passing in all of our **Ahoy::Event** model data for the component to count all Ahoy Event, but we can filter this data to only include a specific subset of Ahoy Events or from a specific time period. The component will find the Ahoy events created in the past month and show us the increase/decrease since the last period.
|
91
|
+
### Top Visited Landing Pages Component
|
92
|
+
|
93
|
+
![Top Visited Landing Pages Component](./images/topVisitedPages.png)
|
94
|
+
|
95
|
+
The Top Visited Pages Table Component component will take advantage of **`Ahoy::Visit`** and gives you a list of the top visited paths. Just pass in the Ahoy::Visit.all and the component will calculate the top landing pages based on the visits that have been created in the given time window. The *`limit`* parameter limits the number of results and is 10 by default. The implementation should look like:
|
96
|
+
|
97
|
+
```
|
98
|
+
<%= render(Matey::TopVisitedPagesTableComponent.new(events: Ahoy::Visit.all, time_window: 1.month, limit: 10)) %>
|
99
|
+
```
|
100
|
+
|
101
|
+
### Top Events Component
|
102
|
+
|
103
|
+
![Top Events Component](./images/topEventsComponent.png)
|
104
|
+
|
105
|
+
The Top Events Component component will give you a list of the top Ahoy::Event's that are triggered by your users. Just pass in the Ahoy::Event.all and the component will calculate the top events that have been triggered in the given time window. The *`limit`* parameter limits the number of results and is 10 by default. The implementation should look like:
|
106
|
+
|
107
|
+
```
|
108
|
+
<%= render(Matey::TopEventsComponent.new(events: Ahoy::Event.all, time_window: 1.month, limit: 10)) %>
|
109
|
+
```
|
110
|
+
|
111
|
+
### Custom Card Component
|
112
|
+
*Coming Soon...*
|
113
|
+
### Custom Table Component
|
114
|
+
*Coming Soon...*
|
115
|
+
## Development
|
116
|
+
|
117
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
118
|
+
|
119
|
+
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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
120
|
+
|
121
|
+
A sample application is included in this repository to help with exploring the components and testing. To use the
|
122
|
+
sample application:
|
123
|
+
|
124
|
+
1. cd spec/sample
|
125
|
+
2. bundle
|
126
|
+
3. rails s
|
127
|
+
4. Open a browser to localhost:3000
|
128
|
+
|
129
|
+
## Testing
|
130
|
+
|
131
|
+
Use the folloiwng steps to run the test cases:
|
132
|
+
|
133
|
+
1. rails db:test:prepare
|
134
|
+
2. bundle exec rake
|
135
|
+
|
136
|
+
## Contributing
|
137
|
+
|
138
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/harled/matey. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/harled/matey/blob/master/CODE_OF_CONDUCT.md).
|
139
|
+
|
140
|
+
### Contribution Steps:
|
141
|
+
|
142
|
+
Want to help us out? Here are some steps to make sure you are contributing
|
143
|
+
|
144
|
+
1. Find an issue you like, or create a new issue [here](https://github.com/harled/matey/issues)
|
145
|
+
- Please ask for any questions or clarifications in the associated issues or in new issues! 🤔
|
146
|
+
2. Assign yourself to the issue and create a branch , following GitHub Issue's naming scheme. 🛠️
|
147
|
+
- The naming scheme should follow (#issueNumber-issue-name) ie. (#10-create-new-component)
|
148
|
+
3. Get on your local machine and [ensure you have the repo cloned](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository). Checkout the branch you just made with `git checkout branch-name` and pull the latest merged changes from the repo with `git pull origin main` to make sure you have the most up-to-date code from the repo. 👩💻
|
149
|
+
4. Add your amazing changes along with any documentation you feel would be useful. Then commit and push your changes. 🌟
|
150
|
+
5. Go back to the repo on GitHub and create a pull request! Then wait for an admin of the repo to get back to your pull request, address any comments and once you are finally approved, merge your code into Matey! 🎉
|
151
|
+
|
152
|
+
If you want some more tips on contributing to GitHub projects, [check out this resource from Data School](https://www.dataschool.io/how-to-contribute-on-github/).
|
153
|
+
|
154
|
+
## License
|
155
|
+
|
156
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
157
|
+
|
158
|
+
## Code of Conduct
|
159
|
+
|
160
|
+
Everyone interacting in the Matey project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/harled/matey/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "bundler/setup"
|
5
|
+
rescue LoadError
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
7
|
+
end
|
8
|
+
|
9
|
+
require "bundler/gem_tasks"
|
10
|
+
require "rspec/core/rake_task"
|
11
|
+
|
12
|
+
APP_RAKEFILE = File.expand_path("spec/sample/Rakefile", __dir__)
|
13
|
+
load "rails/tasks/engine.rake"
|
14
|
+
load "rails/tasks/statistics.rake"
|
15
|
+
|
16
|
+
RSpec::Core::RakeTask.new(:spec)
|
17
|
+
|
18
|
+
require "standard/rake"
|
19
|
+
|
20
|
+
task default: %i[spec standard]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="card bg-primary text-light">
|
2
|
+
<div class="card-body">
|
3
|
+
<div class="row">
|
4
|
+
<div class="col">
|
5
|
+
<h1><%= @current_period %></h1>
|
6
|
+
</div>
|
7
|
+
<div class="col-auto">
|
8
|
+
<p class="card-text text-end mb-0">
|
9
|
+
<%= (@change_active_number > 0 ? "+" : "") + @change_active_number.to_s + " / " + @change_active_percent.to_s + "%" %>
|
10
|
+
</p>
|
11
|
+
</div><!-- .col -->
|
12
|
+
</div><!-- .row -->
|
13
|
+
<h4 class="card-text my-2"><strong> Active Users </strong> since <%= time_ago_in_words(@time_window.ago).titleize %> ago (<%= @time_window.ago.strftime("%m/%d/%Y") %>)</h4>
|
14
|
+
</div><!-- .card-body -->
|
15
|
+
</div><!-- .card -->
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "ahoy_matey"
|
2
|
+
|
3
|
+
class Matey::ActiveUsersComponent < ApplicationComponent
|
4
|
+
def initialize(events:, time_window: 1.week)
|
5
|
+
raise ArgumentError unless events.is_a?(ActiveRecord::Relation)
|
6
|
+
raise ArgumentError unless time_window.is_a?(Integer)
|
7
|
+
|
8
|
+
@current_period = events.where(time: time_window.ago..Time.current).pluck(:user_id).uniq.count
|
9
|
+
previous_period = events.where(time: (2 * time_window).ago..time_window.ago).pluck(:user_id).uniq.count
|
10
|
+
|
11
|
+
@change_active_number = @current_period - previous_period
|
12
|
+
@change_active_percent = ((@change_active_number.to_f / (previous_period == 0 ? 1 : previous_period)) * 100).truncate(2)
|
13
|
+
|
14
|
+
@time_window = time_window
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="card bg-primary text-light">
|
2
|
+
<div class="card-body">
|
3
|
+
<div class="row">
|
4
|
+
<div class="col">
|
5
|
+
<h1><%= @current_period %></h1>
|
6
|
+
</div>
|
7
|
+
<div class="col-auto">
|
8
|
+
<p class="card-text text-end mb-0">
|
9
|
+
<%= (@change_active_number > 0 ? "+" : "") + @change_active_number.to_s + " / " + @change_active_percent.to_s + "%" %>
|
10
|
+
</p>
|
11
|
+
</div><!-- .col -->
|
12
|
+
</div><!-- .row -->
|
13
|
+
<h4 class="card-text my-2"><strong> New Activity </strong> since <%= time_ago_in_words(@time_window.ago).titleize %> ago (<%= @time_window.ago.strftime("%m/%d/%Y") %>)</h4>
|
14
|
+
</div><!-- .card-body -->
|
15
|
+
</div><!-- .card -->
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Matey::NewActivityComponent < ApplicationComponent
|
2
|
+
def initialize(events:, time_window: 1.week)
|
3
|
+
raise ArgumentError unless events.is_a?(ActiveRecord::Relation)
|
4
|
+
raise ArgumentError unless time_window.is_a?(Integer)
|
5
|
+
|
6
|
+
@current_period = events.where(time: time_window.ago..Time.current).count
|
7
|
+
previous_period = events.where(time: (2 * time_window).ago..time_window.ago).pluck(:user_id).count
|
8
|
+
|
9
|
+
@change_active_number = @current_period - previous_period
|
10
|
+
@change_active_percent = ((@change_active_number.to_f / (previous_period == 0 ? 1 : previous_period)) * 100).truncate(2)
|
11
|
+
|
12
|
+
@time_window = time_window
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="card bg-primary text-light">
|
2
|
+
<div class="card-body">
|
3
|
+
<div class="row">
|
4
|
+
<div class="col">
|
5
|
+
<h1><%= @current_period %></h1>
|
6
|
+
</div>
|
7
|
+
<div class="col-auto">
|
8
|
+
<p class="card-text text-end mb-0">
|
9
|
+
<%= (@change_new_number > 0 ? "+" : "") + @change_new_number.to_s + " / " + @change_new_percent.to_s + "%" %>
|
10
|
+
</p>
|
11
|
+
</div><!-- .col -->
|
12
|
+
</div><!-- .row -->
|
13
|
+
<h4 class="card-text my-2"><strong> New Users </strong> since <%= time_ago_in_words(@time_window.ago).titleize %> ago (<%= @time_window.ago.strftime("%m/%d/%Y") %>)</h4>
|
14
|
+
</div><!-- .card-body -->
|
15
|
+
</div><!-- .card -->
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Matey::NewUsersComponent < ApplicationComponent
|
2
|
+
def initialize(users:, time_window: 1.week)
|
3
|
+
@current_period = users.where(created_at: time_window.ago..Time.current).count
|
4
|
+
previous_period = users.where(created_at: (2 * time_window).ago..time_window.ago).count
|
5
|
+
|
6
|
+
@change_new_number = @current_period - previous_period
|
7
|
+
@change_new_percent = ((@change_new_number.to_f / (previous_period == 0 ? 1 : previous_period)) * 100).truncate(2)
|
8
|
+
|
9
|
+
@time_window = time_window
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
<div class="card bg-primary text-light">
|
4
|
+
<div class="card-body">
|
5
|
+
<h5>Top Events Since <%= time_ago_in_words(@time_window.ago).titleize %> Ago (<%= @time_window.ago.strftime("%m/%d/%Y") %>)</h5>
|
6
|
+
<div>
|
7
|
+
<table class="table table-hover table-borderless table-sm">
|
8
|
+
<thead class="table-dark">
|
9
|
+
<tr>
|
10
|
+
<th>Event</th>
|
11
|
+
<th>Count</th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
<tbody class="text-light">
|
15
|
+
<% @events.each do |action, count| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= action %></td>
|
18
|
+
<td class="text-end"><%= count %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
<tr class="table-dark">
|
22
|
+
<td><strong>Total:</strong></td>
|
23
|
+
<td class="text-end"><%= @events.sum {|controller_name_and_action, count| count} %></td>
|
24
|
+
</tr>
|
25
|
+
</tbody>
|
26
|
+
</table>
|
27
|
+
</div>
|
28
|
+
</div><!-- .card-body -->
|
29
|
+
</div><!-- .card -->
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Matey::TopEventsComponent < ApplicationComponent
|
4
|
+
def initialize(events:, time_window: 1.week, limit: 5)
|
5
|
+
raise ArgumentError unless events.is_a?(ActiveRecord::Relation)
|
6
|
+
raise ArgumentError unless time_window.is_a?(Integer)
|
7
|
+
|
8
|
+
@events = events.where(time: time_window.ago..Time.current).limit(limit).order("count(name) DESC").group(:name).count
|
9
|
+
@time_window = time_window
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<div class="card bg-primary text-light">
|
2
|
+
<div class="card-body">
|
3
|
+
<h5>Top Landing Page Visits Since <%= time_ago_in_words(@time_window.ago).titleize %> Ago (<%= @time_window.ago.strftime("%m/%d/%Y") %>)</h5>
|
4
|
+
<div>
|
5
|
+
<table class="table table-hover table-borderless table-sm">
|
6
|
+
<thead class="table-dark">
|
7
|
+
<tr>
|
8
|
+
<th>Path/Page</th>
|
9
|
+
<th>Count</th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody class="text-light">
|
13
|
+
<% @user_count_by_event.each do |controller_name_and_action, count| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= controller_name_and_action %></td>
|
16
|
+
<td class="text-end"><%= count %></td>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
<tr class="table-dark">
|
20
|
+
<td><strong>Total:</strong></td>
|
21
|
+
<td class="text-end"><%= @user_count_by_event.sum {|controller_name_and_action, count| count} %></td>
|
22
|
+
</tr>
|
23
|
+
</tbody>
|
24
|
+
</table>
|
25
|
+
</div>
|
26
|
+
</div><!-- .card-body -->
|
27
|
+
</div><!-- .card -->
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Matey::TopVisitedPagesTableComponent < ApplicationComponent
|
2
|
+
def initialize(events:, time_window: 1.week, limit: 10)
|
3
|
+
# Group events by controller (:name) and action. Aggregate number of unique user actions
|
4
|
+
@user_count_by_event = events.where(started_at: time_window.ago..).pluck(:landing_page).tally
|
5
|
+
|
6
|
+
# Filter for the top 10 elements by user actions
|
7
|
+
@user_count_by_event = @user_count_by_event.sort_by { |controller_name_and_action, count| count }.last(limit).reverse
|
8
|
+
|
9
|
+
@time_window = time_window
|
10
|
+
end
|
11
|
+
end
|
data/images/.DS_Store
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/matey.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "matey/version"
|
4
|
+
|
5
|
+
require_relative "../app/components/application_component"
|
6
|
+
require_relative "../app/components/matey/active_users_component"
|
7
|
+
require_relative "../app/components/matey/new_users_component"
|
8
|
+
require_relative "../app/components/matey/top_events_component"
|
9
|
+
require_relative "../app/components/matey/new_activity_component"
|
10
|
+
require_relative "../app/components/matey/top_visited_pages_table_component"
|
11
|
+
|
12
|
+
module Matey
|
13
|
+
class Error < StandardError; end
|
14
|
+
# Your code goes here...
|
15
|
+
end
|
data/matey.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative "lib/matey/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "matey"
|
5
|
+
spec.version = Matey::VERSION
|
6
|
+
spec.authors = ["Suvasan Krishnasamy", "Jon Loos", "Caitlin Henry", "Chris Young"]
|
7
|
+
spec.email = ["suvasan@harled.ca", "jon@harled.ca", "caitlin@harled.ca", "chris@harled.ca"]
|
8
|
+
|
9
|
+
spec.summary = "Track user engagement using Ahoy and ViewComponents."
|
10
|
+
spec.description = "ViewComponents that helpful in viewing user engagement metrics from Ahoy."
|
11
|
+
spec.homepage = "https://github.com/harled/matey"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = ">= 2.6.0"
|
14
|
+
|
15
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/harled/matey"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/harled/matey/blob/main/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency "view_component", "~> 2.0"
|
33
|
+
spec.add_dependency "ahoy_matey", "~> 4.0"
|
34
|
+
|
35
|
+
spec.add_development_dependency "rspec-rails", "~> 5.0"
|
36
|
+
spec.add_development_dependency "factory_bot", "~> 6.0"
|
37
|
+
spec.add_development_dependency "sprockets-rails", "~> 3.2.2"
|
38
|
+
spec.add_development_dependency "sqlite3", "~> 1.0"
|
39
|
+
spec.add_development_dependency "debug", "~> 1.0"
|
40
|
+
|
41
|
+
# For more information and examples about making a new gem, check out our
|
42
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
43
|
+
end
|
data/sig/matey.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: matey
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Suvasan Krishnasamy
|
8
|
+
- Jon Loos
|
9
|
+
- Caitlin Henry
|
10
|
+
- Chris Young
|
11
|
+
autorequire:
|
12
|
+
bindir: exe
|
13
|
+
cert_chain: []
|
14
|
+
date: 2022-04-26 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: view_component
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ahoy_matey
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - "~>"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '4.0'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.0'
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: rspec-rails
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '5.0'
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '5.0'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: factory_bot
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - "~>"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '6.0'
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '6.0'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: sprockets-rails
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - "~>"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 3.2.2
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 3.2.2
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: sqlite3
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '1.0'
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.0'
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: debug
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - "~>"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '1.0'
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '1.0'
|
114
|
+
description: ViewComponents that helpful in viewing user engagement metrics from Ahoy.
|
115
|
+
email:
|
116
|
+
- suvasan@harled.ca
|
117
|
+
- jon@harled.ca
|
118
|
+
- caitlin@harled.ca
|
119
|
+
- chris@harled.ca
|
120
|
+
executables: []
|
121
|
+
extensions: []
|
122
|
+
extra_rdoc_files: []
|
123
|
+
files:
|
124
|
+
- ".devcontainer/Dockerfile"
|
125
|
+
- ".devcontainer/base.Dockerfile"
|
126
|
+
- ".devcontainer/devcontainer.json"
|
127
|
+
- ".rspec"
|
128
|
+
- ".standard.yml"
|
129
|
+
- CHANGELOG.md
|
130
|
+
- CODE_OF_CONDUCT.md
|
131
|
+
- Gemfile
|
132
|
+
- Gemfile.lock
|
133
|
+
- LICENSE.txt
|
134
|
+
- README.md
|
135
|
+
- Rakefile
|
136
|
+
- app/components/application_component.rb
|
137
|
+
- app/components/matey/active_users_component.html.erb
|
138
|
+
- app/components/matey/active_users_component.rb
|
139
|
+
- app/components/matey/new_activity_component.html.erb
|
140
|
+
- app/components/matey/new_activity_component.rb
|
141
|
+
- app/components/matey/new_users_component.html.erb
|
142
|
+
- app/components/matey/new_users_component.rb
|
143
|
+
- app/components/matey/top_events_component.html.erb
|
144
|
+
- app/components/matey/top_events_component.rb
|
145
|
+
- app/components/matey/top_visited_pages_table_component.html.erb
|
146
|
+
- app/components/matey/top_visited_pages_table_component.rb
|
147
|
+
- images/.DS_Store
|
148
|
+
- images/activeUsersComponent.png
|
149
|
+
- images/newActivityComponent.png
|
150
|
+
- images/newUsersComponent.png
|
151
|
+
- images/topEventsComponent.png
|
152
|
+
- images/topVisitedPages.png
|
153
|
+
- lib/matey.rb
|
154
|
+
- lib/matey/version.rb
|
155
|
+
- matey.gemspec
|
156
|
+
- sig/matey.rbs
|
157
|
+
homepage: https://github.com/harled/matey
|
158
|
+
licenses:
|
159
|
+
- MIT
|
160
|
+
metadata:
|
161
|
+
homepage_uri: https://github.com/harled/matey
|
162
|
+
source_code_uri: https://github.com/harled/matey
|
163
|
+
changelog_uri: https://github.com/harled/matey/blob/main/CHANGELOG.md
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 2.6.0
|
173
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
requirements: []
|
179
|
+
rubygems_version: 3.3.7
|
180
|
+
signing_key:
|
181
|
+
specification_version: 4
|
182
|
+
summary: Track user engagement using Ahoy and ViewComponents.
|
183
|
+
test_files: []
|