commonbase 0.2.2 → 0.2.2.1

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: fa24b1079c8ed88f169d25bd1593f9932aedb4fc528bfc6688dab6f75abba0c6
4
- data.tar.gz: bb0cb63cadfeca465404375b0d9065808304b7f055f6ea994294ee26a326551f
3
+ metadata.gz: 739c8005df020b95dcf792727970e80d95ad7c3481a7117f421639d84407e653
4
+ data.tar.gz: 4c8502104ef432482e435151734aa472f703b1f5f45efc89de2b584dd69b8669
5
5
  SHA512:
6
- metadata.gz: 872f5ab793a13ae6c0674ebaaf7b6c28a6f8fe6c8260e1dcae2b49bd3f4b75ff212f0aed54d175fbaea5e7ed2c7de15a7279c951ce4ddf7298ee5b84b15894b5
7
- data.tar.gz: 6c838c0cb3d0eccd5deb8afdcca04295e715a7ca83229746d49c0aea275746523027704c77b9373d491f2aee56660071d993f275ab15c8096e3054db75602544
6
+ metadata.gz: e4b8fce6b2f444e26e354742b704341da8fb6bf0c2237a74816634896465b45eba185eb0075631f7163d7cde835bc981175a02939817abbfb4195284ecd95d5d
7
+ data.tar.gz: 4e0e77e8a6e0649fb0c5945c56640bef4e14f50e80a15660a84b861c5b41934fa0076a58fe78602d2bed2600e7eb85abafcc833b121cbb68220104dc38bbdd36
data/Rakefile CHANGED
@@ -1,5 +1,8 @@
1
1
  require "bundler/setup"
2
2
 
3
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
3
6
  load "rails/tasks/statistics.rake"
4
7
 
5
8
  require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ module Commonbase
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module Commonbase
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -1,6 +1,5 @@
1
1
  module Commonbase
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Commonbase
4
-
5
4
  end
6
5
  end
@@ -1,3 +1,3 @@
1
- module Commonbase
2
- VERSION = "0.2.2"
3
- end
1
+ module Commonbase
2
+ VERSION = "0.2.2.1"
3
+ end
data/lib/commonbase.rb CHANGED
@@ -1,11 +1,9 @@
1
- require "commonbase/version"
2
- require "commonbase/engine"
3
-
4
- require "commonbase/concerns/ransack_searchable"
5
- require "commonbase/concerns/date_validations"
6
- require "commonbase/helpers/log_helpers"
7
- require "commonbase/helpers/utils"
8
-
9
- module Commonbase
10
- # Your code goes here...
11
- end
1
+ require "commonbase/version"
2
+ require "commonbase/engine"
3
+
4
+ require "commonbase/helpers/log_helpers"
5
+ require "commonbase/helpers/utils"
6
+
7
+ module Commonbase
8
+ # Your code goes here...
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-12 00:00:00.000000000 Z
11
+ date: 2025-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: Commonbase module for other modules.
83
+ description: Commonbase module for other modules
84
84
  email:
85
85
  - juanonsoftware@gmail.com
86
86
  executables: []
@@ -92,24 +92,25 @@ files:
92
92
  - Rakefile
93
93
  - app/assets/config/commonbase_manifest.js
94
94
  - app/assets/stylesheets/commonbase/application.css
95
+ - app/controllers/commonbase/application_controller.rb
95
96
  - app/helpers/commonbase/application_helper.rb
96
97
  - app/jobs/commonbase/application_job.rb
97
98
  - app/mailers/commonbase/application_mailer.rb
99
+ - app/models/commonbase/application_record.rb
100
+ - app/models/concerns/commonbase/ransack_searchable.rb
98
101
  - app/views/layouts/commonbase/application.html.erb
99
102
  - config/routes.rb
100
103
  - lib/commonbase.rb
101
- - lib/commonbase/concerns/date_validations.rb
102
- - lib/commonbase/concerns/ransack_searchable.rb
103
104
  - lib/commonbase/engine.rb
104
105
  - lib/commonbase/helpers/log_helpers.rb
105
106
  - lib/commonbase/helpers/utils.rb
106
107
  - lib/commonbase/version.rb
107
108
  - lib/tasks/commonbase_tasks.rake
108
- homepage: https://abizvn.com
109
+ homepage: https://github.com/abizvncom/commonbase
109
110
  licenses:
110
111
  - MIT
111
112
  metadata:
112
- homepage_uri: https://abizvn.com
113
+ homepage_uri: https://github.com/abizvncom/commonbase
113
114
  source_code_uri: https://github.com/abizvncom/commonbase
114
115
  changelog_uri: https://github.com/abizvncom/commonbase
115
116
  post_install_message:
@@ -130,5 +131,5 @@ requirements: []
130
131
  rubygems_version: 3.4.19
131
132
  signing_key:
132
133
  specification_version: 4
133
- summary: Commonbase module.
134
+ summary: Commonbase module
134
135
  test_files: []
@@ -1,58 +0,0 @@
1
- module Commonbase
2
- module DateValidations
3
- extend ActiveSupport::Concern
4
-
5
- class_methods do
6
- # Validate if a date is in future. By default today is invalid. Set include_today to true to include today.
7
- def validate_future_date(attribute, options = {})
8
- validates_each attribute do |record, attr, value|
9
- next unless value.present?
10
-
11
- include_today = options[:include_today] || false
12
-
13
- if value < Date.today || (value == Date.today && include_today.equal?(false))
14
- record.errors.add(attr, options[:message] || "must be in the future")
15
- end
16
- end
17
- end
18
-
19
- # Validate if a date is in the past. By default today is invalid. Set include_today to true to include today.
20
- def validate_past_date(attribute, options = {})
21
- validates_each attribute do |record, attr, value|
22
- next unless value.present?
23
-
24
- include_today = options[:include_today] || false
25
-
26
- if value > Date.today || (value == Date.today && include_today.equal?(false))
27
- record.errors.add(attr, options[:message] || "must be in the past")
28
- end
29
- end
30
- end
31
-
32
- def validate_date_within_range(attribute, options = {})
33
- validates_each attribute do |record, attr, value|
34
- next unless value.present?
35
-
36
- begin_date = options[:begin].present? ? options[:begin] : nil
37
- end_date = options[:end].present? ? options[:end] : nil
38
-
39
- unless (value.to_date rescue nil).present?
40
- record.errors.add(attr, "must be a valid date")
41
- end
42
-
43
- unless (begin_date.to_date rescue nil).present? || (end_date.to_date rescue nil).present?
44
- record.errors.add(attr, "must have options with a valid date for begin or end")
45
- end
46
-
47
- if begin_date.present? && value < begin_date
48
- record.errors.add(attr, "must be after or equal to #{begin_date.strftime('%Y-%m-%d')}")
49
- end
50
-
51
- if end_date.present? && value > end_date
52
- record.errors.add(attr, "must be before or equal to #{end_date.strftime('%Y-%m-%d')}")
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end