skadi 0.4.0.beta.3 → 0.4.0.beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/generators/skadi/install/install_generator.rb +38 -4
- data/lib/generators/skadi/install/templates/skadi_initializer.rb +84 -0
- data/lib/skadi/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 69c9f96eeeec38ea33c8eb352d9c12d9466ec10294c6f293bad4a8d0011bcd03
|
|
4
|
+
data.tar.gz: 07f70d68d1da2bf863770b29b284d2a6083c157854def0052075ec3a1dcbb13b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a33409c7b1adc14884970673422fda594d2af59ba5a7a72d5705430e43c9d66ced9b9db915d31a1132fd4471c46ca4b22dfda79243ae4f1347ce3d0f42e3180
|
|
7
|
+
data.tar.gz: a5ca6dc6342300c4fd459f16e0595877e788f684ca197810c3b8168a91e00420f5a91f4e0ea9a0f5f5c8b6ec68a78c020acaf1550bc53c4baa1d8e51a93c0073
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## 0.4.0.beta.4 [2026-09-03]
|
|
2
|
+
- Add initializer to install script
|
|
3
|
+
- Change migration generator to detect the Rails database engine from config
|
|
4
|
+
- Use :jsonb data type for SQLite 3.45.0+
|
|
5
|
+
|
|
1
6
|
## 0.4.0.beta.3 [2026-09-01]
|
|
2
7
|
- Add "Traffic type" demographic to count bot vs human traffic
|
|
3
8
|
- Change demographic names to be more consistent
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
First-party, privacy-by-default analytics for Rails.
|
|
4
4
|
|
|
5
|
-
Skadi adds flexible and lightweight first-party analytics to your Rails
|
|
5
|
+
Skadi adds flexible and lightweight first-party analytics and a data dashboard to your Rails application. Track page views and events, perform A/B testing and more, giving you everything you need to improve your website.
|
|
6
6
|
|
|
7
7
|
Skadi is privacy-by-default, which means it respects users' privacy without any additional configuration. It gives you the power to be compliant with privacy laws*, while still collecting useful usage data about your site.
|
|
8
8
|
|
|
@@ -14,8 +14,7 @@ module Skadi
|
|
|
14
14
|
VALID_DB_ENGINES = [ :postgres, :mysql, :sqlite ]
|
|
15
15
|
class_option :db_engine,
|
|
16
16
|
type: :string,
|
|
17
|
-
|
|
18
|
-
desc: "Database engine (postgres, mysql, sqlite)"
|
|
17
|
+
desc: "Database engine (postgres, mysql, sqlite). Auto-detected from the app's database config when omitted."
|
|
19
18
|
|
|
20
19
|
VALID_USER_ID_TYPES = [ :bigint, :integer, :uuid, :string ]
|
|
21
20
|
class_option :user_id_type,
|
|
@@ -33,14 +32,49 @@ module Skadi
|
|
|
33
32
|
"db/migrate/install_skadi.rb"
|
|
34
33
|
end
|
|
35
34
|
|
|
35
|
+
def create_initializer
|
|
36
|
+
template "skadi_initializer.rb", "config/initializers/skadi.rb"
|
|
37
|
+
end
|
|
38
|
+
|
|
36
39
|
# Thor requires us to use a private block rather than private on individual definitions
|
|
37
40
|
private
|
|
38
41
|
|
|
39
42
|
def user_id_type = options[:user_id_type].to_sym
|
|
40
|
-
def db_engine = options[:db_engine].to_sym
|
|
43
|
+
def db_engine = (options[:db_engine] || detect_db_engine || :sqlite).to_sym
|
|
41
44
|
def uuid_column_type = (db_engine == :postgres) ? :uuid : :string
|
|
42
45
|
def uuid_column_options = (db_engine == :postgres) ? "" : ", limit: 36"
|
|
43
|
-
def json_column_type
|
|
46
|
+
def json_column_type
|
|
47
|
+
@_json_column_type ||= case db_engine
|
|
48
|
+
when :mysql
|
|
49
|
+
:json
|
|
50
|
+
when :postgres
|
|
51
|
+
:jsonb
|
|
52
|
+
when :sqlite
|
|
53
|
+
if defined?(ActiveRecord::Base) && ActiveRecord::Base.connection.database_version >= "3.45.0"
|
|
54
|
+
:jsonb
|
|
55
|
+
else
|
|
56
|
+
:json
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
rescue StandardError
|
|
60
|
+
# ActiveRecord::Base.connection can throw if the database cannot be reached, in which case we fallback to :json
|
|
61
|
+
return @_json_column_type ||= :json
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def detect_db_engine
|
|
65
|
+
return unless defined? ActiveRecord::Base
|
|
66
|
+
|
|
67
|
+
case ActiveRecord::Base.connection_db_config.adapter
|
|
68
|
+
when "postgresql"
|
|
69
|
+
:postgres
|
|
70
|
+
when "mysql2", "trilogy"
|
|
71
|
+
:mysql
|
|
72
|
+
when "sqlite3"
|
|
73
|
+
:sqlite
|
|
74
|
+
end
|
|
75
|
+
rescue StandardError
|
|
76
|
+
nil
|
|
77
|
+
end
|
|
44
78
|
end
|
|
45
79
|
end
|
|
46
80
|
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# This auto-generated file contains the configuration options that you are most
|
|
2
|
+
# likely to change. Refer to the Skadi configuration class to see the full list
|
|
3
|
+
# of configuration options and their descriptions.
|
|
4
|
+
# @see {Skadi::Configuration}
|
|
5
|
+
|
|
6
|
+
Skadi.configure do |config|
|
|
7
|
+
# Enables anonymity sets without requiring consent. A hash of the user's IP
|
|
8
|
+
# and User Agent is used to track them across the same day. This data is
|
|
9
|
+
# aggregated at the end of the day, anonymising it. Defaults to false.
|
|
10
|
+
#
|
|
11
|
+
# config.use_anonymity_sets = true
|
|
12
|
+
|
|
13
|
+
# Enables tracking users without requiring consent. The current user will be
|
|
14
|
+
# attached to site visits and used to de-duplicate visitors.
|
|
15
|
+
#
|
|
16
|
+
# config.track_users = true
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# A string containing the user model class for the application.
|
|
20
|
+
#
|
|
21
|
+
# config.user_model = "User"
|
|
22
|
+
|
|
23
|
+
# The method to call within your ApplicationController to get the current user.
|
|
24
|
+
#
|
|
25
|
+
# config.user_controller_method = :current_user
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Methods to call within your ApplicationController to authenticate users for
|
|
29
|
+
# using the Skadi dashboard. These methods should return a boolean.
|
|
30
|
+
#
|
|
31
|
+
# config.dashboard_view_controller_method = :skadi_dashboard_can_view
|
|
32
|
+
# config.dashboard_edit_controller_method = :skadi_dashboard_can_edit
|
|
33
|
+
# config.dashboard_dangerously_use_sql_controller_method = :skadi_dashboard_can_dangerously_use_sql
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Add custom fields to the events table in the Skadi dashboard.
|
|
37
|
+
# @see [Skadi::Schema]
|
|
38
|
+
#
|
|
39
|
+
# config.dashboard_custom_event_fields = {
|
|
40
|
+
# http_verb: {
|
|
41
|
+
# # How the field is displayed in the dashboard. A label is auto-generated
|
|
42
|
+
# # if omitted ("http_verb" => "Http Verb").
|
|
43
|
+
# label: "HTTP Verb",
|
|
44
|
+
# # Additional information displayed with this field in the dashboard.
|
|
45
|
+
# description: "Typically, GET requests are page views, and POST, PUT, PATCH and DELETE are form submissions.",
|
|
46
|
+
# # The datatype, one of: :one_of, :date, :string, :number, :boolean.
|
|
47
|
+
# # Defaults to :string if omitted.
|
|
48
|
+
# type: :one_of,
|
|
49
|
+
# # Options for filtering in the dashboard when the :one_of type is used
|
|
50
|
+
# options: %w[GET POST PUT PATCH DELETE],
|
|
51
|
+
# # Whether this field can be selected for tables
|
|
52
|
+
# select: true,
|
|
53
|
+
# # Whether users can filter by this field
|
|
54
|
+
# filter: true,
|
|
55
|
+
# # Whether this field can be used to split a chart view
|
|
56
|
+
# split: true,
|
|
57
|
+
# # The SQL expression used to get this field
|
|
58
|
+
# sql: "properties->>'http_verb'",
|
|
59
|
+
# },
|
|
60
|
+
# }
|
|
61
|
+
|
|
62
|
+
# Add your own database tables to the Skadi dashboard.
|
|
63
|
+
# @see [Skadi::Schema] for format and examples.
|
|
64
|
+
#
|
|
65
|
+
# config.dashboard_custom_schema = {
|
|
66
|
+
# user: {
|
|
67
|
+
# model: "User",
|
|
68
|
+
# fields: {
|
|
69
|
+
# username: {
|
|
70
|
+
# select: true,
|
|
71
|
+
# filter: true,
|
|
72
|
+
# split: true,
|
|
73
|
+
# },
|
|
74
|
+
# name: {
|
|
75
|
+
# label: "Full name",
|
|
76
|
+
# sql: "CONCAT(users.first_name, ' ', users.last_name)",
|
|
77
|
+
# select: true,
|
|
78
|
+
# filter: true,
|
|
79
|
+
# split: true,
|
|
80
|
+
# },
|
|
81
|
+
# },
|
|
82
|
+
# },
|
|
83
|
+
# }
|
|
84
|
+
end
|
data/lib/skadi/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: skadi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.0.beta.
|
|
4
|
+
version: 0.4.0.beta.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Simon J
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-09-
|
|
10
|
+
date: 2026-09-03 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -155,6 +155,7 @@ files:
|
|
|
155
155
|
- config/routes.rb
|
|
156
156
|
- lib/generators/skadi/install/USAGE
|
|
157
157
|
- lib/generators/skadi/install/install_generator.rb
|
|
158
|
+
- lib/generators/skadi/install/templates/skadi_initializer.rb
|
|
158
159
|
- lib/generators/skadi/install/templates/skadi_migration.rb.erb
|
|
159
160
|
- lib/skadi.rb
|
|
160
161
|
- lib/skadi/analytics.rb
|