web47core 0.4.0 → 0.4.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 +39 -39
- data/app/helpers/core_helper.rb +1 -1
- data/lib/app/jobs/cron/command.rb +0 -1
- data/lib/app/jobs/cron/trim_collection.rb +1 -0
- data/lib/app/models/audit_log.rb +1 -1
- data/lib/app/models/concerns/core_system_configuration.rb +1 -2
- data/lib/app/models/concerns/role_able.rb +5 -5
- data/lib/app/models/user_audit_log.rb +1 -0
- data/lib/web47core/engine.rb +3 -0
- data/lib/web47core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0668289593ebb640039ea238c5d21c7a295c8a4bce44f8f6408f4a16a5c2de1
|
|
4
|
+
data.tar.gz: 5ad884eade18f580dbc6fe4c6170e1c83ef86a48a94bc99234c99050e596b108
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5623f9e7e0116b31542a0b4a424390216b3c91d44952b73ec9652af18ebe510f9c317f0e8a87083608f402f9b20c3744abbf2cdcd72314db53c47f6d9f113e57
|
|
7
|
+
data.tar.gz: 5876f57a15e5ad4c48622f3d5c9b635b8b970a60073b5f9596c058c7fecff83c4284492aeca4590a7fab21ceee8fcf947dcf3640c4f56eb7dc2b39180a39a20e
|
data/README.md
CHANGED
|
@@ -3,14 +3,14 @@ Core components used commonly among all web apps for both App47 and RedMonocle
|
|
|
3
3
|
|
|
4
4
|
## We don't need no sticking badges
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
* [](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=App47/web47core&utm_campaign=Badge_Grade)
|
|
7
|
+
* [](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=App47/web47core&utm_campaign=Badge_Coverage)
|
|
8
|
+
* Develop: [](https://circleci.com/gh/App47/web47core/tree/develop)
|
|
9
|
+
* Master: [](https://circleci.com/gh/App47/web47core/tree/master)
|
|
10
10
|
|
|
11
11
|
## Requirements
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
* Ruby 2.4.1
|
|
14
14
|
|
|
15
15
|
### Working with Bundler and RVM
|
|
16
16
|
|
|
@@ -44,9 +44,9 @@ bundle exec rake test
|
|
|
44
44
|
## Deployment
|
|
45
45
|
The `web47core` project is a gem that will be deployed via [Ruby Gems](https://rubygems.org). When an update is ready, the following steps should be followed
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
1. Build the gem `gem build web47core.gemspec`
|
|
48
|
+
2. Push the new gem to [Ruby Gems](https://rubygems.org) `gem push web47core-version.gem`
|
|
49
|
+
3. There may be a delay when using the gem file
|
|
50
50
|
|
|
51
51
|
## Usage
|
|
52
52
|
### Importing the gem
|
|
@@ -69,31 +69,31 @@ gem 'web47core', git: 'git@github.com:App47/web47core.git', branch: :develop
|
|
|
69
69
|
_Please do not ship to production code using the git repo, as the production servers will not have keys to pull from the web47core repo_
|
|
70
70
|
|
|
71
71
|
### Remove the following files
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
1. `StandardModel` - Includes the common set of includes, Mongoid, Auditable, AutoClearCache, etc.
|
|
73
|
+
2. `CdnUrl` - Provide CDN URLs of your classes URLs when cdn_url is configured in system configuration
|
|
74
|
+
3. `AutoClearCache` - Clears your objects cache out of Rails.cache using the object's id
|
|
75
|
+
4. `Formable` - Consolidated into StandardModel, was used to provide common form operations for mongoid documents
|
|
76
|
+
5. `EmailNotification`
|
|
77
|
+
6. `EmailTemplate`
|
|
78
|
+
7. `Notification`
|
|
79
|
+
8. `NotificationTemplate`
|
|
80
|
+
9. `SlackNotification`
|
|
81
|
+
10. `SmsNotification`
|
|
82
|
+
11. `Template`
|
|
83
|
+
12. `App47Logger` and `App47LoggerTest`
|
|
84
|
+
13. `Emailable` or `EmailAble` and `EamailbleTest`, be sure to change `Emailable` to `EmailAble`
|
|
85
|
+
14. `RedisConfiguration` and `RedisConfgurationTest`
|
|
86
|
+
15. `Searchable` and `SearchableTest`, be sure to change `Searchable` to `SearchAble`
|
|
87
|
+
16. `TimezoneAble` and `TimezoneAbleTest`
|
|
88
|
+
17. `CronJobServer` and `CronJobServerTest`
|
|
89
|
+
18. `JobCronTab` and `JobCronTabTest`
|
|
90
|
+
19. `CronTab`
|
|
91
91
|
|
|
92
92
|
#### Models
|
|
93
93
|
##### Concerns
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
1. `StandardModel` - Includes the common set of includes, Mongoid, etc.
|
|
95
|
+
2. `CoreSystemConfiguration` - Base system configuration to be included in the app's SystemConfiguration Object
|
|
96
|
+
3. `CoreAccount` - Base account object that is related to notifications and the ilk.
|
|
97
97
|
##### System Configuration
|
|
98
98
|
Define a `SystemConfiguration` class in your project and import the core concern.
|
|
99
99
|
|
|
@@ -120,9 +120,9 @@ end
|
|
|
120
120
|
```
|
|
121
121
|
##### Cron
|
|
122
122
|
Cron infrastructure for running jobs every minute, hour, day, week, month or some combination
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
1. Remove `config/initializers/job_cron_tabs.rb` that was previous used to ensure cron tabs, they will be loaded automatically now
|
|
124
|
+
2. Remove the `Delayed::Backend::Mongoid::Job` class definition, not the settings from `config/initializers/delayed_job.rb`, these are included in this gem now.
|
|
125
|
+
3. Cron jobs should extend from `Cron::Job` now and specify `cron_tab_entry` within the class.
|
|
126
126
|
```ruby
|
|
127
127
|
module Cron
|
|
128
128
|
class MyJob < Job
|
|
@@ -134,12 +134,12 @@ module Cron
|
|
|
134
134
|
end
|
|
135
135
|
```
|
|
136
136
|
Allowed values of cron_tab_entry are
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
* `:always` Run every minute
|
|
138
|
+
* `:hourly` Run every hour
|
|
139
|
+
* `:daily` Run every day
|
|
140
|
+
* `:weekly` Run every week on Sunday
|
|
141
|
+
* `:monthly` Run every month on the first day of the month
|
|
142
|
+
* `'*/5 1,3 * 2 *'` Run according to unix crontab entry format. This would run every tuesday on the 1st and 3rd hour, for any minute divisible by 5, so 0, 5, 10, 15, etc..
|
|
143
143
|
|
|
144
144
|
Before starting the server, you need to run the database command
|
|
145
145
|
```mongo
|
data/app/helpers/core_helper.rb
CHANGED
data/lib/app/models/audit_log.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module CoreSystemConfiguration
|
|
4
|
+
extend ActiveSupport::Concern
|
|
4
5
|
#
|
|
5
6
|
# The System configuration. Various configuration items that can be updated/defined at run time
|
|
6
7
|
#
|
|
@@ -13,8 +14,6 @@ module CoreSystemConfiguration
|
|
|
13
14
|
# unless you are updating via the Admin or Stack UI, or during testing to setup a specific configuration
|
|
14
15
|
# for that.
|
|
15
16
|
#
|
|
16
|
-
extend ActiveSupport::Concern
|
|
17
|
-
|
|
18
17
|
def self.included(base)
|
|
19
18
|
base.class_eval do
|
|
20
19
|
#
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
# Constants for a role
|
|
5
5
|
#
|
|
6
6
|
module RoleAble
|
|
7
|
-
ROLE_NONE = 'none'
|
|
8
|
-
ROLE_VIEW = 'view'
|
|
9
|
-
ROLE_EDIT = 'edit'
|
|
10
|
-
ROLE_ADMIN = 'admin'
|
|
11
|
-
ROLE_SUPER_ADMIN = 'super_admin'
|
|
7
|
+
ROLE_NONE = 'none' unless defined? ROLE_NONE
|
|
8
|
+
ROLE_VIEW = 'view' unless defined? ROLE_VIEW
|
|
9
|
+
ROLE_EDIT = 'edit' unless defined? ROLE_EDIT
|
|
10
|
+
ROLE_ADMIN = 'admin' unless defined? ROLE_ADMIN
|
|
11
|
+
ROLE_SUPER_ADMIN = 'super_admin' unless defined? ROLE_SUPER_ADMIN
|
|
12
12
|
ALL_ROLES = [ROLE_NONE, ROLE_VIEW, ROLE_EDIT, ROLE_ADMIN].freeze unless defined? ALL_ROLES
|
|
13
13
|
unless defined? ALL_SUPER_ROLES
|
|
14
14
|
ALL_SUPER_ROLES = [ROLE_NONE, ROLE_VIEW, ROLE_EDIT, ROLE_ADMIN, ROLE_SUPER_ADMIN].freeze
|
data/lib/web47core/engine.rb
CHANGED
data/lib/web47core/version.rb
CHANGED