thecore_backend_commons 3.0.6 → 3.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de3bed251c7994d541053661638d299e9c0500744d23efbf74507262ec0c5ee2
4
- data.tar.gz: d4958679fac2641f4fcfebcf0e519da9b85428980b10611a4dee98f30edcbc3d
3
+ metadata.gz: 4eafdf7afd79eee6e3186550a50f09383666bd115463885e4bb1a50547038473
4
+ data.tar.gz: 461f1e9f3955d015de5d192577e6ffc88f1854d51246aef3fab8380be2063800
5
5
  SHA512:
6
- metadata.gz: 7b983df4eb3ce979db36a9c87dcde58fb199629e9f43714da218250894c828f09f856fd19c365f8ed2707ae24323d2b8dde84c9c7ec1f69e7470f63bad1851dd
7
- data.tar.gz: 44347df89d6d13556550635c04fdf6a5ddbbeeb7ea54fa351df9293005b2d25482e24eedc8d4747136f4d71a7268eb7c341c01b02ebef35ced0e3a446b480dbc
6
+ metadata.gz: ab0c2ad2a49925c006214187d554b0a2bec41c4e2a98a382c02c02e285c8e3889f2fb7778ef02b732d55dc513cf9d4b381fa9568e84848cda93b98d4aae57d04
7
+ data.tar.gz: e5a136a0e3a2c89e25ce92e63fe38fa510a9ee3d836789c25780cd5dc05532238b2ef32b627949fb39449c7da3334f41c860ab475a846430657a8faf97b7d36d
data/README.md CHANGED
@@ -8,7 +8,7 @@ How to use my plugin.
8
8
  Add this line to your application's Gemfile:
9
9
 
10
10
  ```ruby
11
- gem 'thecore_backend_commons'
11
+ gem "thecore_backend_commons"
12
12
  ```
13
13
 
14
14
  And then execute:
data/Rakefile CHANGED
@@ -1,32 +1,3 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
1
+ require "bundler/setup"
6
2
 
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'ThecoreBackendCommons'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
- load 'rails/tasks/engine.rake'
19
-
20
- load 'rails/tasks/statistics.rake'
21
-
22
- require 'bundler/gem_tasks'
23
-
24
- require 'rake/testtask'
25
-
26
- Rake::TestTask.new(:test) do |t|
27
- t.libs << 'test'
28
- t.pattern = 'test/**/*_test.rb'
29
- t.verbose = false
30
- end
31
-
32
- task default: :test
3
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ module Abilities
2
+ class ThecoreBackendCommons
3
+ include CanCan::Ability
4
+ def initialize user
5
+ # Main abilities file for Thecore applications
6
+ if user.present?
7
+ # Users' abilities
8
+ if user.admin?
9
+ # Admins' abilities
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ # This method defines the migrations paths for the engine and adds them to the migrations paths of
2
+ # the parent Rails app by using ActiveRecord::Migrator.migrations_paths.concat.
3
+ # migrations_paths = [File.expand_path("../../db/migrate", __dir__)]
4
+ # ActiveRecord::Migrator.migrations_paths.concat(migrations_paths)
5
+ Rails.application.config.paths['db/migrate'] << File.expand_path("../../db/migrate", __dir__)
@@ -0,0 +1,6 @@
1
+ Rails.application.configure do
2
+ config.after_initialize do
3
+ Integer.send(:include, FixnumConcern)
4
+ String.send(:include, StringConcern)
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ Rails.application.config.active_storage.configure :Disk, root: Rails.root.join("storage")
2
+ Rails.application.config.action_mailer.delivery_method = :smtp
@@ -1,4 +1,3 @@
1
- # .gsub(/[^A-Za-z0-9]/, " ").split.join("%")
2
1
  require 'active_support/concern'
3
2
 
4
3
  module StringConcern
@@ -0,0 +1,8 @@
1
+ class NilClass
2
+ def self.to_bool
3
+ false
4
+ end
5
+ def to_bool
6
+ false
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ class String
2
+ def to_bool
3
+ return true if self.downcase == "true"
4
+ false
5
+ end
6
+ end
@@ -0,0 +1,18 @@
1
+ en:
2
+ tiered_times:
3
+ dd:
4
+ zero: "0 Days"
5
+ one: "%{count} Day"
6
+ other: "%{count} Days"
7
+ hh:
8
+ zero: "0 Hours"
9
+ one: "%{count} Hour"
10
+ other: "%{count} Hours"
11
+ mm:
12
+ zero: "0 Minutes"
13
+ one: "%{count} Minute"
14
+ other: "%{count} Minutes"
15
+ ss:
16
+ zero: "0 Seconds"
17
+ one: "%{count} Second"
18
+ other: "%{count} Seconds"
@@ -0,0 +1,18 @@
1
+ it:
2
+ tiered_times:
3
+ dd:
4
+ zero: "0 Giorni"
5
+ one: "%{count} Giorno"
6
+ other: "%{count} Giorni"
7
+ hh:
8
+ zero: "0 Ore"
9
+ one: "%{count} Ora"
10
+ other: "%{count} Ore"
11
+ mm:
12
+ zero: "0 Minuti"
13
+ one: "%{count} Minuto"
14
+ other: "%{count} Minuti"
15
+ ss:
16
+ zero: "0 Secondi"
17
+ one: "%{count} Secondo"
18
+ other: "%{count} Secondi"
@@ -1,15 +1,4 @@
1
1
  module ThecoreBackendCommons
2
2
  class Engine < ::Rails::Engine
3
- initializer 'thecore_backend_commons.add_to_migrations' do |app|
4
- # Adds the list of Thecore Engines, so to manage seeds loading, i.e.:
5
- # Thecore::Base.thecore_engines.each { |engine| engine.load_seed }
6
- Thecore::Base.thecore_engines << self.class
7
- unless app.root.to_s.match root.to_s
8
- # APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
9
- config.paths['db/migrate'].expanded.each do |expanded_path|
10
- app.config.paths['db/migrate'] << expanded_path
11
- end
12
- end
13
- end
14
3
  end
15
4
  end
@@ -1,33 +1,15 @@
1
1
  require 'thecore_auth_commons'
2
+ require 'thecore_background_jobs'
3
+ require 'rails-i18n'
2
4
  require 'devise-i18n'
3
5
  require 'http_accept_language'
4
- require 'rails-i18n'
5
- require 'thecore_settings'
6
-
7
- require 'patches/thecore'
8
-
9
- require 'roo'
10
- require 'roo-xls'
6
+ require "roo"
7
+ require "roo-xls"
8
+ require "active_storage_validations"
9
+ require 'ulid'
11
10
 
12
11
  require "thecore_backend_commons/engine"
13
12
 
14
13
  module ThecoreBackendCommons
15
14
  # Your code goes here...
16
15
  end
17
-
18
- module Thecore
19
- class Seed
20
- def self.save_setting ns, setting, value
21
- puts "Saving setting if nil #{ns}: #{setting} = #{value}"
22
- if Settings.ns(ns)[setting].blank?
23
- Settings.ns(ns)[setting] if value.blank?
24
- Settings.ns(ns)[setting] = value unless value.blank?
25
- end
26
- end
27
-
28
- def self.delete_setting ns, setting
29
- puts "Removing setting #{ns}: #{setting}"
30
- ThecoreSettings::Setting.where(ns: ns, key: setting).destroy_all
31
- end
32
- end
33
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_backend_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-07 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_auth_commons
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thecore_background_jobs
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rails-i18n
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,83 +81,95 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '2.1'
69
83
  - !ruby/object:Gem::Dependency
70
- name: thecore_settings
84
+ name: roo
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '3.0'
89
+ version: '2.9'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '3.0'
96
+ version: '2.9'
83
97
  - !ruby/object:Gem::Dependency
84
- name: roo
98
+ name: roo-xls
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '2.9'
103
+ version: '1.2'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '2.9'
110
+ version: '1.2'
97
111
  - !ruby/object:Gem::Dependency
98
- name: roo-xls
112
+ name: active_storage_validations
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '1.2'
117
+ version: '1.0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '1.2'
124
+ version: '1.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: ulid
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.3'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.3'
111
139
  description: Wrapper to keep all the common libraries and setups needed by Thecore
112
140
  UI Backend(s).
113
141
  email:
114
- - gabriele.tassoni@gmail.com
142
+ - g.tassoni@bancolini.com
115
143
  executables: []
116
144
  extensions: []
117
145
  extra_rdoc_files: []
118
146
  files:
119
- - MIT-LICENSE
120
147
  - README.md
121
148
  - Rakefile
122
- - app/assets/config/thecore_backend_commons_manifest.js
123
- - app/jobs/application_job.rb
124
- - app/mailers/application_mailer.rb
125
- - config/initializers/thecore_backend_commons_app_archetypes.rb
126
- - config/initializers/thecore_backend_commons_app_configs.rb
149
+ - config/initializers/abilities.rb
150
+ - config/initializers/add_to_db_migrations.rb
151
+ - config/initializers/after_initialize.rb
152
+ - config/initializers/application_config.rb
153
+ - config/initializers/concern_integer.rb
154
+ - config/initializers/concern_string.rb
155
+ - config/initializers/extension_nil.rb
156
+ - config/initializers/extension_string.rb
127
157
  - config/locales/en.devise.custom.yml
158
+ - config/locales/en.yml
128
159
  - config/locales/it.devise.custom.yml
129
- - config/routes.rb
160
+ - config/locales/it.yml
130
161
  - db/seeds.rb
131
- - lib/patches/active_record_extensions.rb
132
- - lib/patches/application_record_loader.rb
133
- - lib/patches/date_format.rb
134
- - lib/patches/integer_extensions.rb
135
- - lib/patches/postgresql_drop_replacement.rb
136
- - lib/patches/string_extensions.rb
137
- - lib/patches/thecore.rb
138
162
  - lib/tasks/thecore_backend_commons_tasks.rake
139
163
  - lib/thecore_backend_commons.rb
140
164
  - lib/thecore_backend_commons/engine.rb
141
165
  - lib/thecore_backend_commons/version.rb
142
166
  homepage: https://github.com/gabrieletassoni/thecore_backend_commons
143
- licenses:
144
- - MIT
167
+ licenses: []
145
168
  metadata:
146
169
  allowed_push_host: https://rubygems.org
170
+ homepage_uri: https://github.com/gabrieletassoni/thecore_backend_commons
171
+ source_code_uri: https://github.com/gabrieletassoni/thecore_backend_commons
172
+ changelog_uri: https://github.com/gabrieletassoni/thecore_backend_commons/blob/master/CHANGELOG.md
147
173
  post_install_message:
148
174
  rdoc_options: []
149
175
  require_paths:
@@ -162,5 +188,5 @@ requirements: []
162
188
  rubygems_version: 3.3.26
163
189
  signing_key:
164
190
  specification_version: 4
165
- summary: Thecore 2 foundations for the Web UI Backend.
191
+ summary: Thecore 3 foundations for the Web UI Backend.
166
192
  test_files: []
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright 2020
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,2 +0,0 @@
1
- class ApplicationJob < ActiveJob::Base
2
- end
@@ -1,4 +0,0 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- layout 'mailer'
3
- end
4
-
@@ -1,15 +0,0 @@
1
- class NilClass
2
- def self.to_bool
3
- false
4
- end
5
- def to_bool
6
- false
7
- end
8
- end
9
-
10
- class String
11
- def to_bool
12
- return true if self.downcase == "true"
13
- false
14
- end
15
- end
@@ -1,20 +0,0 @@
1
- Rails.application.configure do
2
- # Session Store
3
- config.session_store :cookie_store, expire_after: 1.year, domain: ".#{ENV["BASE_DOMAIN"].presence || "all"}"
4
- # I18n
5
- config.i18n.available_locales = %w(it en)
6
- config.i18n.default_locale = :it
7
- config.time_zone = 'Rome'
8
- # Active Storage
9
- config.active_storage.configure :Disk, root: Rails.root.join("storage")
10
- # ActionMailer
11
- config.action_mailer.delivery_method = :smtp
12
- # AFTER INITIALIZE Good place to load things that must have a bit of initialization
13
- # setup on order to work (and not be overrided).
14
- config.after_initialize do
15
- # include the extensions
16
- ActiveRecord::Base.send(:include, ActiveRecordExtensions)
17
- Integer.send(:include, FixnumConcern)
18
- String.send(:include, StringConcern)
19
- end
20
- end
data/config/routes.rb DELETED
@@ -1,2 +0,0 @@
1
- Rails.application.routes.draw do
2
- end
@@ -1,132 +0,0 @@
1
- module ActiveRecordExtensions
2
- extend ActiveSupport::Concern
3
-
4
- # add your static(class) methods here
5
- module ClassMethods
6
- #E.g: Order.top_ten
7
- def top_ten
8
- limit(10)
9
- end
10
-
11
- def identifier_starts_with letter
12
- # Se ha name o code o barcode, uso uno di questi:
13
- column = if self.column_names.include? "name"
14
- :name
15
- elsif self.column_names.include? "title"
16
- :title
17
- elsif self.column_names.include? "code"
18
- :code
19
- elsif self.column_names.include? "barcode"
20
- :barcode
21
- end
22
- # Ecco la ricerca dedicata a Postgres, la facciamo multiplatform? Fatto
23
- query = "#{letter}%"
24
- match = arel_table[column].matches(query)
25
- where(match)
26
- end
27
-
28
- def starts_with_a
29
- identifier_starts_with :a
30
- end
31
-
32
- def starts_with_b
33
- identifier_starts_with :b
34
- end
35
-
36
- def starts_with_c
37
- identifier_starts_with :c
38
- end
39
-
40
- def starts_with_d
41
- identifier_starts_with :d
42
- end
43
-
44
- def starts_with_e
45
- identifier_starts_with :e
46
- end
47
-
48
- def starts_with_f
49
- identifier_starts_with :f
50
- end
51
-
52
- def starts_with_g
53
- identifier_starts_with :g
54
- end
55
-
56
- def starts_with_h
57
- identifier_starts_with :h
58
- end
59
-
60
- def starts_with_i
61
- identifier_starts_with :i
62
- end
63
-
64
- def starts_with_j
65
- identifier_starts_with :j
66
- end
67
-
68
- def starts_with_k
69
- identifier_starts_with :k
70
- end
71
-
72
- def starts_with_l
73
- identifier_starts_with :l
74
- end
75
-
76
- def starts_with_m
77
- identifier_starts_with :m
78
- end
79
-
80
- def starts_with_n
81
- identifier_starts_with :n
82
- end
83
-
84
- def starts_with_o
85
- identifier_starts_with :o
86
- end
87
-
88
- def starts_with_p
89
- identifier_starts_with :p
90
- end
91
-
92
- def starts_with_q
93
- identifier_starts_with :q
94
- end
95
-
96
- def starts_with_r
97
- identifier_starts_with :r
98
- end
99
-
100
- def starts_with_s
101
- identifier_starts_with :s
102
- end
103
-
104
- def starts_with_t
105
- identifier_starts_with :t
106
- end
107
-
108
- def starts_with_u
109
- identifier_starts_with :u
110
- end
111
-
112
- def starts_with_v
113
- identifier_starts_with :v
114
- end
115
-
116
- def starts_with_w
117
- identifier_starts_with :w
118
- end
119
-
120
- def starts_with_x
121
- identifier_starts_with :x
122
- end
123
-
124
- def starts_with_y
125
- identifier_starts_with :y
126
- end
127
-
128
- def starts_with_z
129
- identifier_starts_with :z
130
- end
131
- end
132
- end
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
@@ -1,27 +0,0 @@
1
- # Date
2
- # ----------------------------
3
- #Date::DATE_FORMATS[:default] = "%Y-%m-%d" # 2013-11-03
4
- Date::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013
5
- #Date::DATE_FORMATS[:default] = "%e %b %Y" # 3 Nov 2013
6
- #Date::DATE_FORMATS[:default] = "%Y%m%d" # 20131103
7
- #Date::DATE_FORMATS[:default] = "%e %b" # 3 Nov
8
- #Date::DATE_FORMATS[:default] = "" # custom
9
-
10
- # DateTime
11
- # ----------------------------
12
- #DateTime::DATE_FORMATS[:default] = "%Y-%m-%d" # 2013-11-03 14:22:18
13
- DateTime::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013 14:22
14
- #DateTime::DATE_FORMATS[:default] = "%e %b %Y" # Sun, 3 Nov 2013 14:22:18 -0700
15
- #DateTime::DATE_FORMATS[:default] = "%Y%m%d" # 20131103142218
16
- #DateTime::DATE_FORMATS[:default] = "%e %b" # 3 Nov 14:22
17
- #DateTime::DATE_FORMATS[:default] = "" # custom
18
-
19
- # Time
20
- # ----------------------------
21
- #Time::DATE_FORMATS[:default] = "%Y-%m-%d %H:%M:%S" # 2013-11-03 14:22:18
22
- #Time::DATE_FORMATS[:default] = "%B %d, %Y %H:%M" # November 3, 2013 14:22
23
- #Time::DATE_FORMATS[:default] = "%a, %d %b %Y %H:%M:%S %z" # Sun, 3 Nov 2013 14:22:18 -0700
24
- #Time::DATE_FORMATS[:default] = "%d %b %H:%M" # 3 Nov 14:22
25
- #Time::DATE_FORMATS[:default] = "%Y%m%d%H%M%S" # 20131103142218
26
- Time::DATE_FORMATS[:default] = "%H:%M" # 14:22
27
- #Time::DATE_FORMATS[:default] = "" # custom
@@ -1,12 +0,0 @@
1
- # module ActiveRecord
2
- # module Tasks
3
- # class PostgreSQLDatabaseTasks
4
- # # Allows drop on DBs currently in use.
5
- # def drop
6
- # establish_master_connection
7
- # connection.select_all "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname='#{configuration['database']}' AND state='idle';"
8
- # connection.drop_database configuration['database']
9
- # end
10
- # end
11
- # end
12
- # end
@@ -1,9 +0,0 @@
1
- require 'patches/date_format'
2
-
3
- require 'patches/string_extensions'
4
- require 'patches/integer_extensions'
5
- require 'patches/active_record_extensions'
6
-
7
- require 'patches/postgresql_drop_replacement'
8
-
9
- require 'patches/application_record_loader'