web47core 3.0.6 → 3.2.2
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/README.md +4 -4
- data/app/controllers/status_controller.rb +2 -2
- data/bin/rails +4 -0
- data/bin/rake +4 -0
- data/bin/setup +25 -0
- data/config/application.rb +61 -0
- data/config/boot.rb +3 -0
- data/lib/app/jobs/application_job.rb +1 -1
- data/lib/app/models/concerns/api_tokenable.rb +1 -1
- data/lib/app/models/concerns/email_able.rb +2 -8
- data/lib/app/validators/email_format_validator.rb +66 -0
- data/lib/web47core/version.rb +1 -1
- data/lib/web47core.rb +4 -1
- metadata +39 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f759927404c37d2d4f513dbe6b08c02862507ede8891616c60768c4e8ef499d0
|
4
|
+
data.tar.gz: 83f86c5af7d98984438f593ebe2302ff713d45f861512b94a161102d517fc6c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7b4e3b27b3fdfd671cc6c13dda7124add31753bd1daffe5e26d09a53b0981cce749ee50682b46b290e54d906681b900629d69745e18bad1a90d108f507b6662
|
7
|
+
data.tar.gz: 82270b9fc47c61a4f24b80abaa3fffef06d881b674d3a5156fb36e41ae82cddbeab8c6a4aa94e17cb38b357974cd101dc2d71237a6ebd86e7ed61b801a3243cf
|
data/README.md
CHANGED
@@ -10,20 +10,20 @@ Core components used commonly among all web apps for both App47 and RedMonocle
|
|
10
10
|
|
11
11
|
## Requirements
|
12
12
|
|
13
|
-
* Ruby 3.
|
13
|
+
* Ruby 3.2.3
|
14
14
|
|
15
15
|
### Working with Bundler and RBENV
|
16
16
|
|
17
17
|
This project manages [RBENV](https://github.com/rbenv/rbenv) and manages dependencies via [Bundler](http://gembundler.com/).
|
18
18
|
|
19
19
|
You must first [install RBENV](https://github.com/rbenv/rbenv#installation).
|
20
|
-
Then install Ruby 3.
|
20
|
+
Then install Ruby 3.2.3 via RBENV
|
21
21
|
``` shell script
|
22
|
-
rbenv install 3.
|
22
|
+
rbenv install 3.2.3
|
23
23
|
```
|
24
24
|
You'll now notice that this project (as well as other App47 ones) contains a .ruby-version file, which is executed upon opening the project's root directory in a terminal (and IDE's like RubyMine). The .ruby-version file simply states `2.7.0` which tells RBENV to ensure the Ruby version to use for this project is 2.7.0.
|
25
25
|
|
26
|
-
Please note, your Ruby `3.
|
26
|
+
Please note, your Ruby `3.2.3` version might need bundler installed:
|
27
27
|
``` shell script
|
28
28
|
gem install bundler -v 2.5.4
|
29
29
|
```
|
@@ -17,7 +17,7 @@ class StatusController < ActionController::Base
|
|
17
17
|
|
18
18
|
respond_to do |format|
|
19
19
|
format.html { render :index, locals: { components: ui_decorators(components) }, layout: false }
|
20
|
-
format.json { render json: components.to_json, status: db_status(components)
|
20
|
+
format.json { render json: components.to_json, status: db_status(components) }
|
21
21
|
format.text { render plain: components.flatten, status: db_status(components) }
|
22
22
|
end
|
23
23
|
end
|
@@ -102,7 +102,7 @@ class StatusController < ActionController::Base
|
|
102
102
|
else
|
103
103
|
0
|
104
104
|
end
|
105
|
-
report_success
|
105
|
+
report_success("#{count} Jobs", { count: count, job_age: job_age })
|
106
106
|
rescue StandardError => error
|
107
107
|
report_error(error)
|
108
108
|
end
|
data/bin/rails
ADDED
data/bin/rake
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
6
|
+
|
7
|
+
def system!(*args)
|
8
|
+
system(*args, exception: true)
|
9
|
+
end
|
10
|
+
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts "== Installing dependencies =="
|
17
|
+
system! "gem install bundler --conservative"
|
18
|
+
system("bundle check") || system!("bundle install")
|
19
|
+
|
20
|
+
puts "\n== Removing old logs and tempfiles =="
|
21
|
+
system! "bin/rails log:clear tmp:clear"
|
22
|
+
|
23
|
+
puts "\n== Restarting application server =="
|
24
|
+
system! "bin/rails restart"
|
25
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# require File.expand_path('../../config/environment', __FILE__)
|
2
|
+
# Load the Rails application.
|
3
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
4
|
+
|
5
|
+
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
6
|
+
|
7
|
+
require 'rails'
|
8
|
+
|
9
|
+
%w[
|
10
|
+
action_controller/railtie
|
11
|
+
action_view/railtie
|
12
|
+
action_mailer/railtie
|
13
|
+
active_job/railtie
|
14
|
+
action_cable/engine
|
15
|
+
rails/test_unit/railtie
|
16
|
+
sprockets/railtie
|
17
|
+
].each do |railtie|
|
18
|
+
require railtie
|
19
|
+
rescue LoadError => error
|
20
|
+
puts 'Unable to load libraries'
|
21
|
+
puts error.message
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'haml'
|
25
|
+
require 'mail'
|
26
|
+
require 'cancancan'
|
27
|
+
|
28
|
+
# Require the gems listed in Gemfile, including any gems
|
29
|
+
# you've limited to :test, :development, or :production.
|
30
|
+
Bundler.require(*Rails.groups)
|
31
|
+
|
32
|
+
module WebCore
|
33
|
+
class Application < Rails::Application
|
34
|
+
# Settings in config/environments/* take precedence over those specified here.
|
35
|
+
# Application configuration should go into files in config/initializers
|
36
|
+
# -- all .rb files in that directory are automatically loaded.
|
37
|
+
# Configure redis cache
|
38
|
+
config.eager_load = false
|
39
|
+
config.cache_store = :redis_cache_store, { url: 'redis://127.0.0.1:6379/11' }
|
40
|
+
config.autoload_paths += %W[#{config.root}/lib]
|
41
|
+
config.generators do |g|
|
42
|
+
g.template_engine :haml
|
43
|
+
g.orm :mongoid
|
44
|
+
g.test_framework :shoulda
|
45
|
+
g.fallbacks[:shoulda] = :test_unit
|
46
|
+
g.fixture_replacement :factory_bot
|
47
|
+
end
|
48
|
+
config.active_job.queue_adapter = :delayed_job
|
49
|
+
|
50
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
51
|
+
config.encoding = 'utf-8'
|
52
|
+
config.logger = Logger.new($stdout)
|
53
|
+
config.logger.level = Logger::DEBUG
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
Delayed::Worker.delay_jobs = false
|
58
|
+
|
59
|
+
# Initialize the Rails application.
|
60
|
+
Rails.application.initialize!
|
61
|
+
Rails.application.config.filter_parameters += %w[password password_confirmation]
|
data/config/boot.rb
ADDED
@@ -36,7 +36,7 @@ class ApplicationJob < ActiveJob::Base
|
|
36
36
|
#
|
37
37
|
def self.valid_environment?
|
38
38
|
my_environments = valid_environments
|
39
|
-
|
39
|
+
my_environments.empty? || my_environments.include?(Rails.env)
|
40
40
|
end
|
41
41
|
|
42
42
|
#
|
@@ -1,9 +1,3 @@
|
|
1
|
-
begin
|
2
|
-
require 'email_format'
|
3
|
-
rescue LoadError
|
4
|
-
raise "You need to add gem 'email_format' to your Gemfile if you wish to use it."
|
5
|
-
end
|
6
|
-
|
7
1
|
#
|
8
2
|
# Objects that emails can be sent too...
|
9
3
|
#
|
@@ -21,7 +15,7 @@ module EmailAble
|
|
21
15
|
#
|
22
16
|
# Validations
|
23
17
|
#
|
24
|
-
validates :email, email_format: { strict: true
|
18
|
+
validates :email, email_format: { strict: true, allow_blank: true }
|
25
19
|
#
|
26
20
|
# Callbacks
|
27
21
|
#
|
@@ -91,7 +85,7 @@ module EmailAble
|
|
91
85
|
private
|
92
86
|
|
93
87
|
#
|
94
|
-
# Make sure emails are always
|
88
|
+
# Make sure emails are always down cased
|
95
89
|
#
|
96
90
|
def downcase_email
|
97
91
|
self.email = email.strip.downcase if email.present?
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Verify the email is a valid email format based on RFC8222
|
4
|
+
class EmailFormatValidator < ActiveModel::EachValidator
|
5
|
+
#
|
6
|
+
# RFC822, obsolete and more lax in most cases
|
7
|
+
#
|
8
|
+
# CTL = <any ASCII control ; ( 0- 37, 0.- 31.)
|
9
|
+
# SPACE = <ASCII SP, space> ; ( 40, 32.)
|
10
|
+
# specials = "(" / ")" / "<" / ">" / "@" ; Must be in quoted-
|
11
|
+
# / "," / ";" / ":" / "\" / <"> ; string, to use
|
12
|
+
# / "." / "[" / "]" ; within a word.
|
13
|
+
# atom = 1*<any CHAR except specials, SPACE and CTLs>
|
14
|
+
#
|
15
|
+
# qtext = <any CHAR excepting <">, ; => may be folded "\" & CR, and including linear-white-space>
|
16
|
+
# quoted-pair = "\" CHAR ; may quote any char
|
17
|
+
# quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or quoted chars.
|
18
|
+
# word = atom / quoted-string
|
19
|
+
#
|
20
|
+
# local-part = word *("." word) ; uninterpreted
|
21
|
+
#
|
22
|
+
# domain-ref = atom ; symbolic reference
|
23
|
+
# sub-domain = domain-ref / domain-literal
|
24
|
+
# domain = sub-domain *("." sub-domain)
|
25
|
+
#
|
26
|
+
# addr-spec = local-part "@" domain ; global address
|
27
|
+
#
|
28
|
+
|
29
|
+
ctl = '\x00-\x1f'
|
30
|
+
space = ' '
|
31
|
+
specials = '\(\)\<\>\@\,\;\:\\\"\.\[\]'
|
32
|
+
atom = "[^#{ctl}#{space}#{specials}]+?"
|
33
|
+
dot_atom = "#{atom}(?:\.#{atom})*" # in common use, allowed by RFC2822
|
34
|
+
|
35
|
+
qtext = '[^\"\`]+'
|
36
|
+
quoted_pair = '\\.'
|
37
|
+
quoted_string = "\"(?:#{qtext}|#{quoted_pair})+?\""
|
38
|
+
word = "(?:#{dot_atom}|#{quoted_string})"
|
39
|
+
|
40
|
+
local_part = word # ignore word[.word]
|
41
|
+
|
42
|
+
domain_ref = dot_atom
|
43
|
+
domain_literal = "\[#{atom}(?:[\.\:]#{atom})*\]" # only used for IPv4/IPv6 addresses
|
44
|
+
sub_domain = "(?:#{domain_ref}|#{domain_literal})"
|
45
|
+
domain = sub_domain
|
46
|
+
|
47
|
+
addr_spec = "#{local_part}\@#{domain}"
|
48
|
+
|
49
|
+
addr_ws = "\s*(#{addr_spec})\s*"
|
50
|
+
addr_list = "^#{addr_ws}(?:,#{addr_ws})*$"
|
51
|
+
|
52
|
+
EMAIL_ADDRESS_REGEX = /#{addr_list}/
|
53
|
+
|
54
|
+
def validate_each(record, attribute, value)
|
55
|
+
return if valid_email?(value, options[:strict])
|
56
|
+
record.errors.add(attribute, message: options[:message] || 'is invalid')
|
57
|
+
end
|
58
|
+
|
59
|
+
def valid_email?(email, strict = false)
|
60
|
+
if strict
|
61
|
+
!!(email =~ EMAIL_ADDRESS_REGEX)
|
62
|
+
else
|
63
|
+
!!(email =~ /^[\S&&[^@]]+@[\S&&[^@]]+$/)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/web47core/version.rb
CHANGED
data/lib/web47core.rb
CHANGED
@@ -72,7 +72,6 @@ require 'app/models/user_audit_log'
|
|
72
72
|
require 'app/models/user_action_audit_log'
|
73
73
|
require 'app/models/user_model_audit_log'
|
74
74
|
#
|
75
|
-
#
|
76
75
|
# Controllers
|
77
76
|
#
|
78
77
|
require 'web47core/engine'
|
@@ -84,3 +83,7 @@ require 'app/controllers/concerns/core_cron_controller'
|
|
84
83
|
require 'app/controllers/concerns/core_delayed_jobs_controller'
|
85
84
|
require 'app/controllers/concerns/core_delayed_job_metrics_controller'
|
86
85
|
require 'app/controllers/concerns/core_delayed_job_workers_controller'
|
86
|
+
#
|
87
|
+
# Validators
|
88
|
+
#
|
89
|
+
require 'app/validators/email_format_validator'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web47core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schroeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: email_format
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: haml
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,14 +170,14 @@ dependencies:
|
|
184
170
|
requirements:
|
185
171
|
- - "~>"
|
186
172
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
173
|
+
version: 7.1.3
|
188
174
|
type: :runtime
|
189
175
|
prerelease: false
|
190
176
|
version_requirements: !ruby/object:Gem::Requirement
|
191
177
|
requirements:
|
192
178
|
- - "~>"
|
193
179
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
180
|
+
version: 7.1.3
|
195
181
|
- !ruby/object:Gem::Dependency
|
196
182
|
name: railties
|
197
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -336,16 +322,16 @@ dependencies:
|
|
336
322
|
name: codacy-coverage
|
337
323
|
requirement: !ruby/object:Gem::Requirement
|
338
324
|
requirements:
|
339
|
-
- - "
|
325
|
+
- - ">="
|
340
326
|
- !ruby/object:Gem::Version
|
341
|
-
version:
|
327
|
+
version: '0'
|
342
328
|
type: :development
|
343
329
|
prerelease: false
|
344
330
|
version_requirements: !ruby/object:Gem::Requirement
|
345
331
|
requirements:
|
346
|
-
- - "
|
332
|
+
- - ">="
|
347
333
|
- !ruby/object:Gem::Version
|
348
|
-
version:
|
334
|
+
version: '0'
|
349
335
|
- !ruby/object:Gem::Dependency
|
350
336
|
name: database_cleaner-mongoid
|
351
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -473,7 +459,7 @@ dependencies:
|
|
473
459
|
- !ruby/object:Gem::Version
|
474
460
|
version: 4.0.0
|
475
461
|
- !ruby/object:Gem::Dependency
|
476
|
-
name: shoulda-
|
462
|
+
name: shoulda-context
|
477
463
|
requirement: !ruby/object:Gem::Requirement
|
478
464
|
requirements:
|
479
465
|
- - ">="
|
@@ -487,7 +473,7 @@ dependencies:
|
|
487
473
|
- !ruby/object:Gem::Version
|
488
474
|
version: '0'
|
489
475
|
- !ruby/object:Gem::Dependency
|
490
|
-
name: shoulda-
|
476
|
+
name: shoulda-matchers
|
491
477
|
requirement: !ruby/object:Gem::Requirement
|
492
478
|
requirements:
|
493
479
|
- - ">="
|
@@ -504,16 +490,30 @@ dependencies:
|
|
504
490
|
name: simplecov
|
505
491
|
requirement: !ruby/object:Gem::Requirement
|
506
492
|
requirements:
|
507
|
-
- -
|
493
|
+
- - ">="
|
494
|
+
- !ruby/object:Gem::Version
|
495
|
+
version: '0'
|
496
|
+
type: :development
|
497
|
+
prerelease: false
|
498
|
+
version_requirements: !ruby/object:Gem::Requirement
|
499
|
+
requirements:
|
500
|
+
- - ">="
|
501
|
+
- !ruby/object:Gem::Version
|
502
|
+
version: '0'
|
503
|
+
- !ruby/object:Gem::Dependency
|
504
|
+
name: simplecov-lcov
|
505
|
+
requirement: !ruby/object:Gem::Requirement
|
506
|
+
requirements:
|
507
|
+
- - ">="
|
508
508
|
- !ruby/object:Gem::Version
|
509
|
-
version: 0
|
509
|
+
version: '0'
|
510
510
|
type: :development
|
511
511
|
prerelease: false
|
512
512
|
version_requirements: !ruby/object:Gem::Requirement
|
513
513
|
requirements:
|
514
|
-
- -
|
514
|
+
- - ">="
|
515
515
|
- !ruby/object:Gem::Version
|
516
|
-
version: 0
|
516
|
+
version: '0'
|
517
517
|
- !ruby/object:Gem::Dependency
|
518
518
|
name: test-unit
|
519
519
|
requirement: !ruby/object:Gem::Requirement
|
@@ -548,6 +548,9 @@ email:
|
|
548
548
|
executables:
|
549
549
|
- cron_server
|
550
550
|
- delayed_job
|
551
|
+
- rails
|
552
|
+
- rake
|
553
|
+
- setup
|
551
554
|
extensions: []
|
552
555
|
extra_rdoc_files: []
|
553
556
|
files:
|
@@ -602,6 +605,11 @@ files:
|
|
602
605
|
- app/views/system_configurations/show.html.haml
|
603
606
|
- bin/cron_server
|
604
607
|
- bin/delayed_job
|
608
|
+
- bin/rails
|
609
|
+
- bin/rake
|
610
|
+
- bin/setup
|
611
|
+
- config/application.rb
|
612
|
+
- config/boot.rb
|
605
613
|
- config/brakeman.ignore
|
606
614
|
- config/brakeman.yml
|
607
615
|
- config/locales/en.yml
|
@@ -676,6 +684,7 @@ files:
|
|
676
684
|
- lib/app/models/user_action_audit_log.rb
|
677
685
|
- lib/app/models/user_audit_log.rb
|
678
686
|
- lib/app/models/user_model_audit_log.rb
|
687
|
+
- lib/app/validators/email_format_validator.rb
|
679
688
|
- lib/templates/email/notification_failure.liquid
|
680
689
|
- lib/templates/email/notification_failure.subject.liquid
|
681
690
|
- lib/templates/slack/error_message.liquid
|
@@ -696,14 +705,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
696
705
|
requirements:
|
697
706
|
- - "~>"
|
698
707
|
- !ruby/object:Gem::Version
|
699
|
-
version: 3.
|
708
|
+
version: '3.2'
|
700
709
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
701
710
|
requirements:
|
702
711
|
- - ">="
|
703
712
|
- !ruby/object:Gem::Version
|
704
713
|
version: '0'
|
705
714
|
requirements: []
|
706
|
-
rubygems_version: 3.
|
715
|
+
rubygems_version: 3.5.5
|
707
716
|
signing_key:
|
708
717
|
specification_version: 4
|
709
718
|
summary: App47 Web Core Library.
|