meta_states 0.1.0
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 +7 -0
- data/CHANGELOG.md +46 -0
- data/LICENSE.txt +21 -0
- data/README.md +255 -0
- data/lib/generators/meta_states/install/install_generator.rb +43 -0
- data/lib/generators/meta_states/install/templates/create_indexes_on_meta_states_states.rb.erb +11 -0
- data/lib/generators/meta_states/install/templates/create_meta_states_states.rb.erb +18 -0
- data/lib/generators/meta_states/install/templates/initializer.rb.erb +42 -0
- data/lib/meta_states/base.rb +70 -0
- data/lib/meta_states/callback.rb +58 -0
- data/lib/meta_states/configuration/model_configuration.rb +64 -0
- data/lib/meta_states/configuration/state_type_configuration.rb +17 -0
- data/lib/meta_states/configuration.rb +142 -0
- data/lib/meta_states/railtie.rb +8 -0
- data/lib/meta_states/state.rb +5 -0
- data/lib/meta_states/stateable.rb +26 -0
- data/lib/meta_states/version.rb +5 -0
- data/lib/meta_states.rb +25 -0
- data/spec/dummy/Gemfile +40 -0
- data/spec/dummy/Gemfile.lock +308 -0
- data/spec/dummy/README.md +24 -0
- data/spec/dummy/Rakefile +8 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/jobs/application_job.rb +9 -0
- data/spec/dummy/app/models/application_record.rb +5 -0
- data/spec/dummy/app/models/company.rb +3 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/bin/brakeman +9 -0
- data/spec/dummy/bin/dev +4 -0
- data/spec/dummy/bin/docker-entrypoint +14 -0
- data/spec/dummy/bin/rails +6 -0
- data/spec/dummy/bin/rake +6 -0
- data/spec/dummy/bin/rubocop +10 -0
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/thrust +7 -0
- data/spec/dummy/config/application.rb +27 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/credentials.yml.enc +1 -0
- data/spec/dummy/config/database.yml +37 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +54 -0
- data/spec/dummy/config/environments/production.rb +69 -0
- data/spec/dummy/config/environments/test.rb +44 -0
- data/spec/dummy/config/initializers/cors.rb +18 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +10 -0
- data/spec/dummy/config/initializers/inflections.rb +18 -0
- data/spec/dummy/config/initializers/meta_states.rb +45 -0
- data/spec/dummy/config/locales/en.yml +31 -0
- data/spec/dummy/config/master.key +1 -0
- data/spec/dummy/config/puma.rb +43 -0
- data/spec/dummy/config/routes.rb +12 -0
- data/spec/dummy/config.ru +8 -0
- data/spec/dummy/db/migrate/20241221171423_create_test_models.rb +15 -0
- data/spec/dummy/db/migrate/20241223212128_create_has_states_states.rb +18 -0
- data/spec/dummy/db/migrate/20250114175939_create_indexes_on_has_states_states.rb +10 -0
- data/spec/dummy/db/schema.rb +44 -0
- data/spec/dummy/db/seeds.rb +11 -0
- data/spec/dummy/log/development.log +416 -0
- data/spec/dummy/log/test.log +55143 -0
- data/spec/dummy/public/robots.txt +1 -0
- data/spec/dummy/storage/development.sqlite3 +0 -0
- data/spec/dummy/storage/test.sqlite3 +0 -0
- data/spec/dummy/tmp/local_secret.txt +1 -0
- data/spec/factories/meta_states.rb +19 -0
- data/spec/generators/meta_states/install_generator_spec.rb +27 -0
- data/spec/generators/templates/config/initializers/meta_states.rb +42 -0
- data/spec/generators/templates/db/migrate/20250605170637_create_indexes_on_meta_states_states.rb +11 -0
- data/spec/generators/templates/db/migrate/20250605170637_create_meta_states_states.rb +18 -0
- data/spec/meta_states/callback_spec.rb +92 -0
- data/spec/meta_states/configuration_spec.rb +218 -0
- data/spec/meta_states/state_limit_spec.rb +107 -0
- data/spec/meta_states/state_metadata_schema_spec.rb +75 -0
- data/spec/meta_states/state_spec.rb +349 -0
- data/spec/meta_states/stateable_spec.rb +183 -0
- data/spec/meta_states_spec.rb +52 -0
- data/spec/rails_helper.rb +19 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/database_cleaner.rb +17 -0
- data/spec/support/factory_bot.rb +8 -0
- data/spec/support/shoulda_matchers.rb +10 -0
- data/spec/tmp/config/initializers/has_states.rb +12 -0
- data/spec/tmp/db/migrate/20241223004024_create_has_states_states.rb +20 -0
- metadata +141 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MetaStates
|
|
4
|
+
class Configuration
|
|
5
|
+
include Singleton
|
|
6
|
+
|
|
7
|
+
attr_reader :callbacks, :model_configurations
|
|
8
|
+
|
|
9
|
+
def initialize
|
|
10
|
+
@callbacks = {}
|
|
11
|
+
@next_callback_id = 0
|
|
12
|
+
@model_configurations = {}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Configure a model to use MetaStates
|
|
16
|
+
# @param model_class [Class] The model class to configure
|
|
17
|
+
# @return [Configuration::ModelConfiguration] The model configuration
|
|
18
|
+
# @raise [ArgumentError] If the model class is not an ActiveRecord model
|
|
19
|
+
def configure_model(model_class)
|
|
20
|
+
unless model_class.is_a?(Class) && model_class < ActiveRecord::Base
|
|
21
|
+
raise ArgumentError, "#{model_class} must be an ActiveRecord model"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
model_config = Configuration::ModelConfiguration.new(model_class)
|
|
25
|
+
|
|
26
|
+
yield(model_config)
|
|
27
|
+
|
|
28
|
+
@model_configurations[model_class] = model_config
|
|
29
|
+
model_class.include(Stateable) unless model_class.included_modules.include?(Stateable)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Check if a status is valid for a given state type
|
|
33
|
+
# @param model_class [Class] The model class
|
|
34
|
+
# @param state_type [String] The state type
|
|
35
|
+
# @param status [String] The status
|
|
36
|
+
# @return [Boolean] True if the status is valid, false otherwise
|
|
37
|
+
def valid_status?(model_class, state_type, status)
|
|
38
|
+
return false unless @model_configurations[model_class]&.state_types&.dig(state_type.to_s)
|
|
39
|
+
|
|
40
|
+
@model_configurations[model_class].state_types[state_type.to_s].statuses.include?(status)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Check if a state type is valid for a given model
|
|
44
|
+
# @param model_class [Class] The model class
|
|
45
|
+
# @param state_type [String] The state type
|
|
46
|
+
# @return [Boolean] True if the state type is valid, false otherwise
|
|
47
|
+
def valid_state_type?(model_class, state_type)
|
|
48
|
+
@model_configurations[model_class]&.state_types&.key?(state_type.to_s)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Get the configuration for a given state type
|
|
52
|
+
# @param model_class [Class] The model class
|
|
53
|
+
# @param state_type [String] The state type
|
|
54
|
+
# @return [Configuration::StateTypeConfiguration] The state type configuration
|
|
55
|
+
def config_for(model_class, state_type)
|
|
56
|
+
@model_configurations[model_class]&.state_types&.dig(state_type.to_s)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Get the state types for a given model
|
|
60
|
+
# @param model_class [Class] The model class
|
|
61
|
+
# @return [Hash] The state types for the model
|
|
62
|
+
def state_types_for(model_class)
|
|
63
|
+
@model_configurations[model_class]&.state_types
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Get the statuses for a given state type
|
|
67
|
+
# @param model_class [Class] The model class
|
|
68
|
+
# @param state_type [String] The state type
|
|
69
|
+
# @return [Array] The statuses for the state type
|
|
70
|
+
def statuses_for(model_class, state_type)
|
|
71
|
+
return nil unless (config = config_for(model_class, state_type))
|
|
72
|
+
|
|
73
|
+
config.statuses
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Get the limit for a given state type
|
|
77
|
+
# @param model_class [Class] The model class
|
|
78
|
+
# @param state_type [String] The state type
|
|
79
|
+
# @return [Integer] The limit for the state type
|
|
80
|
+
def limit_for(model_class, state_type)
|
|
81
|
+
return nil unless (config = config_for(model_class, state_type))
|
|
82
|
+
|
|
83
|
+
config.limit
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Get the metadata schema for a given state type
|
|
87
|
+
# @param model_class [Class] The model class
|
|
88
|
+
# @param state_type [String] The state type
|
|
89
|
+
# @return [Hash] The metadata schema for the state type
|
|
90
|
+
def metadata_schema_for(model_class, state_type)
|
|
91
|
+
return nil unless (config = config_for(model_class, state_type))
|
|
92
|
+
|
|
93
|
+
config.metadata_schema
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Register a callback for a given state type
|
|
97
|
+
# @param state_type [String] The state type
|
|
98
|
+
# @param id [Symbol] The callback id
|
|
99
|
+
# @param conditions [Hash] The conditions for the callback
|
|
100
|
+
# @param block [Proc] The callback block
|
|
101
|
+
# @return [Callback] The callback
|
|
102
|
+
def on(state_type, id: nil, **conditions, &block)
|
|
103
|
+
callback = Callback.new(state_type, conditions, block)
|
|
104
|
+
callback_id = id&.to_sym || generate_callback_id
|
|
105
|
+
@callbacks[callback_id] = callback
|
|
106
|
+
callback
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Remove a callback by id or callback object
|
|
110
|
+
# @param callback_or_id [Symbol, Callback] The callback id or callback object
|
|
111
|
+
# @return [Callback] The removed callback
|
|
112
|
+
def off(callback_or_id)
|
|
113
|
+
if callback_or_id.is_a?(Callback)
|
|
114
|
+
@callbacks.delete_if { |_, cb| cb == callback_or_id }
|
|
115
|
+
else
|
|
116
|
+
@callbacks.delete(callback_or_id)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Get the callbacks that match a given state
|
|
121
|
+
# @param state [State] The state
|
|
122
|
+
# @return [Array] The matching callbacks
|
|
123
|
+
def matching_callbacks(state)
|
|
124
|
+
@callbacks.values.select { |callback| callback.matches?(state) }
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Clear all callbacks
|
|
128
|
+
# @return [void]
|
|
129
|
+
def clear_callbacks!
|
|
130
|
+
@callbacks = {}
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
private
|
|
134
|
+
|
|
135
|
+
# Generate a unique callback id
|
|
136
|
+
# @return [Symbol] The generated callback id
|
|
137
|
+
def generate_callback_id
|
|
138
|
+
@next_callback_id += 1
|
|
139
|
+
:"callback_#{@next_callback_id}"
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MetaStates
|
|
4
|
+
module Stateable
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
|
|
7
|
+
included do
|
|
8
|
+
has_many :states, class_name: 'MetaStates::Base',
|
|
9
|
+
as: :stateable,
|
|
10
|
+
dependent: :destroy
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Instance methods for managing states
|
|
14
|
+
def add_state(type, status: 'pending', metadata: {}, state_class: MetaStates::State)
|
|
15
|
+
states.create!(type: state_class.name, state_type: type, status: status, metadata: metadata)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def current_state(type)
|
|
19
|
+
states.where(state_type: type).order(created_at: :desc).first
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def current_states(type)
|
|
23
|
+
states.where(state_type: type).order(created_at: :desc)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/meta_states.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'active_record'
|
|
4
|
+
require 'meta_states/version'
|
|
5
|
+
require 'meta_states/configuration'
|
|
6
|
+
require 'meta_states/configuration/model_configuration'
|
|
7
|
+
require 'meta_states/configuration/state_type_configuration'
|
|
8
|
+
|
|
9
|
+
module MetaStates
|
|
10
|
+
class << self
|
|
11
|
+
def configure
|
|
12
|
+
yield(configuration)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def configuration
|
|
16
|
+
Configuration.instance
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
require 'meta_states/base'
|
|
22
|
+
require 'meta_states/state'
|
|
23
|
+
require 'meta_states/callback'
|
|
24
|
+
require 'meta_states/stateable'
|
|
25
|
+
require 'meta_states/railtie' if defined?(Rails)
|
data/spec/dummy/Gemfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
|
+
|
|
5
|
+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
|
6
|
+
gem 'rails', '~> 8.0.1'
|
|
7
|
+
# Use sqlite3 as the database for Active Record
|
|
8
|
+
gem 'sqlite3', '>= 2.1'
|
|
9
|
+
# Use the Puma web server [https://github.com/puma/puma]
|
|
10
|
+
gem 'puma', '>= 5.0'
|
|
11
|
+
|
|
12
|
+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
|
13
|
+
# gem "bcrypt", "~> 3.1.7"
|
|
14
|
+
|
|
15
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
16
|
+
gem 'tzinfo-data', platforms: %i[windows jruby]
|
|
17
|
+
|
|
18
|
+
# Use the database-backed adapters for Rails.cache and Active Job
|
|
19
|
+
gem 'solid_cache'
|
|
20
|
+
gem 'solid_queue'
|
|
21
|
+
|
|
22
|
+
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
|
|
23
|
+
gem 'kamal', require: false
|
|
24
|
+
|
|
25
|
+
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
|
|
26
|
+
gem 'thruster', require: false
|
|
27
|
+
|
|
28
|
+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin Ajax possible
|
|
29
|
+
# gem "rack-cors"
|
|
30
|
+
|
|
31
|
+
group :development, :test do
|
|
32
|
+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
|
33
|
+
gem 'debug', platforms: %i[mri windows], require: 'debug/prelude'
|
|
34
|
+
|
|
35
|
+
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
|
36
|
+
gem 'brakeman', require: false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# MetaStates gem for state management and event system capabilities
|
|
40
|
+
gem 'meta_states', path: '../..' # This points to the root of your gem
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ../..
|
|
3
|
+
specs:
|
|
4
|
+
meta_states (0.1.0)
|
|
5
|
+
json-schema
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
actioncable (8.0.2)
|
|
11
|
+
actionpack (= 8.0.2)
|
|
12
|
+
activesupport (= 8.0.2)
|
|
13
|
+
nio4r (~> 2.0)
|
|
14
|
+
websocket-driver (>= 0.6.1)
|
|
15
|
+
zeitwerk (~> 2.6)
|
|
16
|
+
actionmailbox (8.0.2)
|
|
17
|
+
actionpack (= 8.0.2)
|
|
18
|
+
activejob (= 8.0.2)
|
|
19
|
+
activerecord (= 8.0.2)
|
|
20
|
+
activestorage (= 8.0.2)
|
|
21
|
+
activesupport (= 8.0.2)
|
|
22
|
+
mail (>= 2.8.0)
|
|
23
|
+
actionmailer (8.0.2)
|
|
24
|
+
actionpack (= 8.0.2)
|
|
25
|
+
actionview (= 8.0.2)
|
|
26
|
+
activejob (= 8.0.2)
|
|
27
|
+
activesupport (= 8.0.2)
|
|
28
|
+
mail (>= 2.8.0)
|
|
29
|
+
rails-dom-testing (~> 2.2)
|
|
30
|
+
actionpack (8.0.2)
|
|
31
|
+
actionview (= 8.0.2)
|
|
32
|
+
activesupport (= 8.0.2)
|
|
33
|
+
nokogiri (>= 1.8.5)
|
|
34
|
+
rack (>= 2.2.4)
|
|
35
|
+
rack-session (>= 1.0.1)
|
|
36
|
+
rack-test (>= 0.6.3)
|
|
37
|
+
rails-dom-testing (~> 2.2)
|
|
38
|
+
rails-html-sanitizer (~> 1.6)
|
|
39
|
+
useragent (~> 0.16)
|
|
40
|
+
actiontext (8.0.2)
|
|
41
|
+
actionpack (= 8.0.2)
|
|
42
|
+
activerecord (= 8.0.2)
|
|
43
|
+
activestorage (= 8.0.2)
|
|
44
|
+
activesupport (= 8.0.2)
|
|
45
|
+
globalid (>= 0.6.0)
|
|
46
|
+
nokogiri (>= 1.8.5)
|
|
47
|
+
actionview (8.0.2)
|
|
48
|
+
activesupport (= 8.0.2)
|
|
49
|
+
builder (~> 3.1)
|
|
50
|
+
erubi (~> 1.11)
|
|
51
|
+
rails-dom-testing (~> 2.2)
|
|
52
|
+
rails-html-sanitizer (~> 1.6)
|
|
53
|
+
activejob (8.0.2)
|
|
54
|
+
activesupport (= 8.0.2)
|
|
55
|
+
globalid (>= 0.3.6)
|
|
56
|
+
activemodel (8.0.2)
|
|
57
|
+
activesupport (= 8.0.2)
|
|
58
|
+
activerecord (8.0.2)
|
|
59
|
+
activemodel (= 8.0.2)
|
|
60
|
+
activesupport (= 8.0.2)
|
|
61
|
+
timeout (>= 0.4.0)
|
|
62
|
+
activestorage (8.0.2)
|
|
63
|
+
actionpack (= 8.0.2)
|
|
64
|
+
activejob (= 8.0.2)
|
|
65
|
+
activerecord (= 8.0.2)
|
|
66
|
+
activesupport (= 8.0.2)
|
|
67
|
+
marcel (~> 1.0)
|
|
68
|
+
activesupport (8.0.2)
|
|
69
|
+
base64
|
|
70
|
+
benchmark (>= 0.3)
|
|
71
|
+
bigdecimal
|
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
73
|
+
connection_pool (>= 2.2.5)
|
|
74
|
+
drb
|
|
75
|
+
i18n (>= 1.6, < 2)
|
|
76
|
+
logger (>= 1.4.2)
|
|
77
|
+
minitest (>= 5.1)
|
|
78
|
+
securerandom (>= 0.3)
|
|
79
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
80
|
+
uri (>= 0.13.1)
|
|
81
|
+
addressable (2.8.7)
|
|
82
|
+
public_suffix (>= 2.0.2, < 7.0)
|
|
83
|
+
base64 (0.2.0)
|
|
84
|
+
bcrypt_pbkdf (1.1.1)
|
|
85
|
+
bcrypt_pbkdf (1.1.1-arm64-darwin)
|
|
86
|
+
bcrypt_pbkdf (1.1.1-x86_64-darwin)
|
|
87
|
+
benchmark (0.4.0)
|
|
88
|
+
bigdecimal (3.1.9)
|
|
89
|
+
brakeman (7.0.0)
|
|
90
|
+
racc
|
|
91
|
+
builder (3.3.0)
|
|
92
|
+
concurrent-ruby (1.3.5)
|
|
93
|
+
connection_pool (2.5.0)
|
|
94
|
+
crass (1.0.6)
|
|
95
|
+
date (3.4.1)
|
|
96
|
+
debug (1.10.0)
|
|
97
|
+
irb (~> 1.10)
|
|
98
|
+
reline (>= 0.3.8)
|
|
99
|
+
dotenv (3.1.7)
|
|
100
|
+
drb (2.2.1)
|
|
101
|
+
ed25519 (1.3.0)
|
|
102
|
+
erubi (1.13.1)
|
|
103
|
+
et-orbi (1.2.11)
|
|
104
|
+
tzinfo
|
|
105
|
+
fugit (1.11.1)
|
|
106
|
+
et-orbi (~> 1, >= 1.2.11)
|
|
107
|
+
raabro (~> 1.4)
|
|
108
|
+
globalid (1.2.1)
|
|
109
|
+
activesupport (>= 6.1)
|
|
110
|
+
i18n (1.14.7)
|
|
111
|
+
concurrent-ruby (~> 1.0)
|
|
112
|
+
io-console (0.8.0)
|
|
113
|
+
irb (1.15.1)
|
|
114
|
+
pp (>= 0.6.0)
|
|
115
|
+
rdoc (>= 4.0.0)
|
|
116
|
+
reline (>= 0.4.2)
|
|
117
|
+
json-schema (5.1.1)
|
|
118
|
+
addressable (~> 2.8)
|
|
119
|
+
bigdecimal (~> 3.1)
|
|
120
|
+
kamal (2.5.3)
|
|
121
|
+
activesupport (>= 7.0)
|
|
122
|
+
base64 (~> 0.2)
|
|
123
|
+
bcrypt_pbkdf (~> 1.0)
|
|
124
|
+
concurrent-ruby (~> 1.2)
|
|
125
|
+
dotenv (~> 3.1)
|
|
126
|
+
ed25519 (~> 1.2)
|
|
127
|
+
net-ssh (~> 7.3)
|
|
128
|
+
sshkit (>= 1.23.0, < 2.0)
|
|
129
|
+
thor (~> 1.3)
|
|
130
|
+
zeitwerk (>= 2.6.18, < 3.0)
|
|
131
|
+
logger (1.6.6)
|
|
132
|
+
loofah (2.24.0)
|
|
133
|
+
crass (~> 1.0.2)
|
|
134
|
+
nokogiri (>= 1.12.0)
|
|
135
|
+
mail (2.8.1)
|
|
136
|
+
mini_mime (>= 0.1.1)
|
|
137
|
+
net-imap
|
|
138
|
+
net-pop
|
|
139
|
+
net-smtp
|
|
140
|
+
marcel (1.0.4)
|
|
141
|
+
mini_mime (1.1.5)
|
|
142
|
+
mini_portile2 (2.8.8)
|
|
143
|
+
minitest (5.25.5)
|
|
144
|
+
net-imap (0.5.6)
|
|
145
|
+
date
|
|
146
|
+
net-protocol
|
|
147
|
+
net-pop (0.1.2)
|
|
148
|
+
net-protocol
|
|
149
|
+
net-protocol (0.2.2)
|
|
150
|
+
timeout
|
|
151
|
+
net-scp (4.1.0)
|
|
152
|
+
net-ssh (>= 2.6.5, < 8.0.0)
|
|
153
|
+
net-sftp (4.0.0)
|
|
154
|
+
net-ssh (>= 5.0.0, < 8.0.0)
|
|
155
|
+
net-smtp (0.5.1)
|
|
156
|
+
net-protocol
|
|
157
|
+
net-ssh (7.3.0)
|
|
158
|
+
nio4r (2.7.4)
|
|
159
|
+
nokogiri (1.18.5)
|
|
160
|
+
mini_portile2 (~> 2.8.2)
|
|
161
|
+
racc (~> 1.4)
|
|
162
|
+
nokogiri (1.18.5-aarch64-linux-gnu)
|
|
163
|
+
racc (~> 1.4)
|
|
164
|
+
nokogiri (1.18.5-aarch64-linux-musl)
|
|
165
|
+
racc (~> 1.4)
|
|
166
|
+
nokogiri (1.18.5-arm-linux-gnu)
|
|
167
|
+
racc (~> 1.4)
|
|
168
|
+
nokogiri (1.18.5-arm-linux-musl)
|
|
169
|
+
racc (~> 1.4)
|
|
170
|
+
nokogiri (1.18.5-arm64-darwin)
|
|
171
|
+
racc (~> 1.4)
|
|
172
|
+
nokogiri (1.18.5-x86_64-darwin)
|
|
173
|
+
racc (~> 1.4)
|
|
174
|
+
nokogiri (1.18.5-x86_64-linux-gnu)
|
|
175
|
+
racc (~> 1.4)
|
|
176
|
+
nokogiri (1.18.5-x86_64-linux-musl)
|
|
177
|
+
racc (~> 1.4)
|
|
178
|
+
ostruct (0.6.1)
|
|
179
|
+
pp (0.6.2)
|
|
180
|
+
prettyprint
|
|
181
|
+
prettyprint (0.2.0)
|
|
182
|
+
psych (5.2.3)
|
|
183
|
+
date
|
|
184
|
+
stringio
|
|
185
|
+
public_suffix (6.0.2)
|
|
186
|
+
puma (6.6.0)
|
|
187
|
+
nio4r (~> 2.0)
|
|
188
|
+
raabro (1.4.0)
|
|
189
|
+
racc (1.8.1)
|
|
190
|
+
rack (3.1.12)
|
|
191
|
+
rack-session (2.1.0)
|
|
192
|
+
base64 (>= 0.1.0)
|
|
193
|
+
rack (>= 3.0.0)
|
|
194
|
+
rack-test (2.2.0)
|
|
195
|
+
rack (>= 1.3)
|
|
196
|
+
rackup (2.2.1)
|
|
197
|
+
rack (>= 3)
|
|
198
|
+
rails (8.0.2)
|
|
199
|
+
actioncable (= 8.0.2)
|
|
200
|
+
actionmailbox (= 8.0.2)
|
|
201
|
+
actionmailer (= 8.0.2)
|
|
202
|
+
actionpack (= 8.0.2)
|
|
203
|
+
actiontext (= 8.0.2)
|
|
204
|
+
actionview (= 8.0.2)
|
|
205
|
+
activejob (= 8.0.2)
|
|
206
|
+
activemodel (= 8.0.2)
|
|
207
|
+
activerecord (= 8.0.2)
|
|
208
|
+
activestorage (= 8.0.2)
|
|
209
|
+
activesupport (= 8.0.2)
|
|
210
|
+
bundler (>= 1.15.0)
|
|
211
|
+
railties (= 8.0.2)
|
|
212
|
+
rails-dom-testing (2.2.0)
|
|
213
|
+
activesupport (>= 5.0.0)
|
|
214
|
+
minitest
|
|
215
|
+
nokogiri (>= 1.6)
|
|
216
|
+
rails-html-sanitizer (1.6.2)
|
|
217
|
+
loofah (~> 2.21)
|
|
218
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
219
|
+
railties (8.0.2)
|
|
220
|
+
actionpack (= 8.0.2)
|
|
221
|
+
activesupport (= 8.0.2)
|
|
222
|
+
irb (~> 1.13)
|
|
223
|
+
rackup (>= 1.0.0)
|
|
224
|
+
rake (>= 12.2)
|
|
225
|
+
thor (~> 1.0, >= 1.2.2)
|
|
226
|
+
zeitwerk (~> 2.6)
|
|
227
|
+
rake (13.2.1)
|
|
228
|
+
rdoc (6.12.0)
|
|
229
|
+
psych (>= 4.0.0)
|
|
230
|
+
reline (0.6.0)
|
|
231
|
+
io-console (~> 0.5)
|
|
232
|
+
securerandom (0.4.1)
|
|
233
|
+
solid_cache (1.0.7)
|
|
234
|
+
activejob (>= 7.2)
|
|
235
|
+
activerecord (>= 7.2)
|
|
236
|
+
railties (>= 7.2)
|
|
237
|
+
solid_queue (1.1.4)
|
|
238
|
+
activejob (>= 7.1)
|
|
239
|
+
activerecord (>= 7.1)
|
|
240
|
+
concurrent-ruby (>= 1.3.1)
|
|
241
|
+
fugit (~> 1.11.0)
|
|
242
|
+
railties (>= 7.1)
|
|
243
|
+
thor (~> 1.3.1)
|
|
244
|
+
sqlite3 (2.6.0-aarch64-linux-gnu)
|
|
245
|
+
sqlite3 (2.6.0-aarch64-linux-musl)
|
|
246
|
+
sqlite3 (2.6.0-arm-linux-gnu)
|
|
247
|
+
sqlite3 (2.6.0-arm-linux-musl)
|
|
248
|
+
sqlite3 (2.6.0-arm64-darwin)
|
|
249
|
+
sqlite3 (2.6.0-x86-linux-gnu)
|
|
250
|
+
sqlite3 (2.6.0-x86-linux-musl)
|
|
251
|
+
sqlite3 (2.6.0-x86_64-darwin)
|
|
252
|
+
sqlite3 (2.6.0-x86_64-linux-gnu)
|
|
253
|
+
sqlite3 (2.6.0-x86_64-linux-musl)
|
|
254
|
+
sshkit (1.24.0)
|
|
255
|
+
base64
|
|
256
|
+
logger
|
|
257
|
+
net-scp (>= 1.1.2)
|
|
258
|
+
net-sftp (>= 2.1.2)
|
|
259
|
+
net-ssh (>= 2.8.0)
|
|
260
|
+
ostruct
|
|
261
|
+
stringio (3.1.5)
|
|
262
|
+
thor (1.3.2)
|
|
263
|
+
thruster (0.1.12)
|
|
264
|
+
thruster (0.1.12-aarch64-linux)
|
|
265
|
+
thruster (0.1.12-arm64-darwin)
|
|
266
|
+
thruster (0.1.12-x86_64-darwin)
|
|
267
|
+
thruster (0.1.12-x86_64-linux)
|
|
268
|
+
timeout (0.4.3)
|
|
269
|
+
tzinfo (2.0.6)
|
|
270
|
+
concurrent-ruby (~> 1.0)
|
|
271
|
+
uri (1.0.3)
|
|
272
|
+
useragent (0.16.11)
|
|
273
|
+
websocket-driver (0.7.7)
|
|
274
|
+
base64
|
|
275
|
+
websocket-extensions (>= 0.1.0)
|
|
276
|
+
websocket-extensions (0.1.5)
|
|
277
|
+
zeitwerk (2.7.2)
|
|
278
|
+
|
|
279
|
+
PLATFORMS
|
|
280
|
+
aarch64-linux
|
|
281
|
+
aarch64-linux-gnu
|
|
282
|
+
aarch64-linux-musl
|
|
283
|
+
arm-linux
|
|
284
|
+
arm-linux-gnu
|
|
285
|
+
arm-linux-musl
|
|
286
|
+
arm64-darwin
|
|
287
|
+
x86-linux
|
|
288
|
+
x86-linux-gnu
|
|
289
|
+
x86-linux-musl
|
|
290
|
+
x86_64-darwin
|
|
291
|
+
x86_64-linux-gnu
|
|
292
|
+
x86_64-linux-musl
|
|
293
|
+
|
|
294
|
+
DEPENDENCIES
|
|
295
|
+
brakeman
|
|
296
|
+
debug
|
|
297
|
+
kamal
|
|
298
|
+
meta_states!
|
|
299
|
+
puma (>= 5.0)
|
|
300
|
+
rails (~> 8.0.1)
|
|
301
|
+
solid_cache
|
|
302
|
+
solid_queue
|
|
303
|
+
sqlite3 (>= 2.1)
|
|
304
|
+
thruster
|
|
305
|
+
tzinfo-data
|
|
306
|
+
|
|
307
|
+
BUNDLED WITH
|
|
308
|
+
2.6.1
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
data/spec/dummy/Rakefile
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
4
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
5
|
+
|
|
6
|
+
require_relative 'config/application'
|
|
7
|
+
|
|
8
|
+
Rails.application.load_tasks
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class ApplicationJob < ActiveJob::Base
|
|
4
|
+
# Automatically retry jobs that encountered a deadlock
|
|
5
|
+
# retry_on ActiveRecord::Deadlocked
|
|
6
|
+
|
|
7
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
|
8
|
+
# discard_on ActiveJob::DeserializationError
|
|
9
|
+
end
|
data/spec/dummy/bin/dev
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/bash -e
|
|
2
|
+
|
|
3
|
+
# Enable jemalloc for reduced memory usage and latency.
|
|
4
|
+
if [ -z "${LD_PRELOAD+x}" ]; then
|
|
5
|
+
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
|
|
6
|
+
export LD_PRELOAD
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
# If running the rails server then create or migrate existing database
|
|
10
|
+
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
|
|
11
|
+
./bin/rails db:prepare
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
exec "${@}"
|
data/spec/dummy/bin/rake
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'bundler/setup'
|
|
6
|
+
|
|
7
|
+
# explicit rubocop config increases performance slightly while avoiding config confusion.
|
|
8
|
+
ARGV.unshift('--config', File.expand_path('../.rubocop.yml', __dir__))
|
|
9
|
+
|
|
10
|
+
load Gem.bin_path('rubocop', 'rubocop')
|