thecore_backend_commons 3.0.5 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c1cfad3c1fb497d61bd61d3af9e43cc19495f3596251155190d2c6146be7286
4
- data.tar.gz: 10c9e14880b8f21c1da6363fe96b8a8555779de19593c178f66413eddc9734a6
3
+ metadata.gz: a58eec9185a92cd2374ffe97eef0591e799f85a06896b9ddfa713ed3ed93b57e
4
+ data.tar.gz: a00535d3478d071d65e725e11a440c931455185d8aed7f1225c40e56f3e1830c
5
5
  SHA512:
6
- metadata.gz: af1e124dcf5ff5674febf7d827db80be4120a9309012894204434de211accb66d183c30386d60dcb1697fc12f56f1db37b83ffc35c2fb6ac1e8ed3715179113c
7
- data.tar.gz: b5ad464830850b9f771e0232027e5f8b7ad4df20f464b6a3a2a4df31b2a1a3f5f0260640f430b42308bd503141bfa196993e6d2806e34cc4f690f3f4b594013a
6
+ metadata.gz: 07f1c0975d36defb3c7352224827b7accf735ad95d1ffd830510ace11e47ce081e7190a3bace763759f45c04f79d9ad27798579da34c24c969fe07aca5561f81
7
+ data.tar.gz: a2efa54a92e6f41e4d446408130b43690312a6d9d016716126f4cb2ae8b9517584ad5916a5945e8c335feb4260aeb69f398d183840f764f499e51215ae353278
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,12 @@
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'
11
-
6
+ require "roo"
7
+ require "roo-xls"
12
8
  require "thecore_backend_commons/engine"
13
9
 
14
10
  module ThecoreBackendCommons
15
11
  # Your code goes here...
16
12
  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.5
4
+ version: 3.0.7
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-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_auth_commons
@@ -25,61 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rails-i18n
28
+ name: thecore_background_jobs
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '7.0'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '7.0'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: devise-i18n
42
+ name: rails-i18n
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.10'
47
+ version: '7.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.10'
54
+ version: '7.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: http_accept_language
56
+ name: devise-i18n
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.1'
61
+ version: '1.10'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.1'
68
+ version: '1.10'
69
69
  - !ruby/object:Gem::Dependency
70
- name: thecore_settings
70
+ name: http_accept_language
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '2.1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '2.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: roo
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -111,39 +111,37 @@ dependencies:
111
111
  description: Wrapper to keep all the common libraries and setups needed by Thecore
112
112
  UI Backend(s).
113
113
  email:
114
- - gabriele.tassoni@gmail.com
114
+ - g.tassoni@bancolini.com
115
115
  executables: []
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - MIT-LICENSE
120
119
  - README.md
121
120
  - 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
121
+ - config/initializers/abilities.rb
122
+ - config/initializers/add_to_db_migrations.rb
123
+ - config/initializers/after_initialize.rb
124
+ - config/initializers/application_config.rb
125
+ - config/initializers/concern_integer.rb
126
+ - config/initializers/concern_string.rb
127
+ - config/initializers/extension_nil.rb
128
+ - config/initializers/extension_string.rb
127
129
  - config/locales/en.devise.custom.yml
130
+ - config/locales/en.yml
128
131
  - config/locales/it.devise.custom.yml
129
- - config/routes.rb
132
+ - config/locales/it.yml
130
133
  - 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
134
  - lib/tasks/thecore_backend_commons_tasks.rake
139
135
  - lib/thecore_backend_commons.rb
140
136
  - lib/thecore_backend_commons/engine.rb
141
137
  - lib/thecore_backend_commons/version.rb
142
138
  homepage: https://github.com/gabrieletassoni/thecore_backend_commons
143
- licenses:
144
- - MIT
139
+ licenses: []
145
140
  metadata:
146
141
  allowed_push_host: https://rubygems.org
142
+ homepage_uri: https://github.com/gabrieletassoni/thecore_backend_commons
143
+ source_code_uri: https://github.com/gabrieletassoni/thecore_backend_commons
144
+ changelog_uri: https://github.com/gabrieletassoni/thecore_backend_commons/blob/master/CHANGELOG.md
147
145
  post_install_message:
148
146
  rdoc_options: []
149
147
  require_paths:
@@ -162,5 +160,5 @@ requirements: []
162
160
  rubygems_version: 3.3.26
163
161
  signing_key:
164
162
  specification_version: 4
165
- summary: Thecore 2 foundations for the Web UI Backend.
163
+ summary: Thecore 3 foundations for the Web UI Backend.
166
164
  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,21 +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
-
11
- # ActionMailer
12
- config.action_mailer.delivery_method = :smtp
13
- # AFTER INITIALIZE Good place to load things that must have a bit of initialization
14
- # setup on order to work (and not be overrided).
15
- config.after_initialize do
16
- # include the extensions
17
- ActiveRecord::Base.send(:include, ActiveRecordExtensions)
18
- Integer.send(:include, FixnumConcern)
19
- String.send(:include, StringConcern)
20
- end
21
- 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'