rails_base 0.74.0 → 0.75.0

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: 417d36c66840f75a28fca2998dce4862a4d7997cf6e13d374872a25e397a8bae
4
- data.tar.gz: 24c761421d3cfdb881ca30a658934ac4cf47fe1f6deb5ca41434b0a95222122d
3
+ metadata.gz: 4b7cc4c99a8861e23a405fee9f95898fb74a1e38a441f5b9dc9a84206d56230c
4
+ data.tar.gz: 4b8a5e9aed889ca066714baf9cec49dd3b46799abfbd9ec7e8d6a4bb04e6fcea
5
5
  SHA512:
6
- metadata.gz: 6a913f6bbed29e62177ce3bf3a5ee19026803486378a8a07402b9d87c60fa90204af60fa1e2ba9a8a902c7f13ed74beac2ec6995ebd79aa5b4ee351174e412d5
7
- data.tar.gz: 4545f9d272a1bcde9d4c349f7801e37f24a0994f5390b09356a7a6b78ef5c7992df0abb1ed0e0164f4b944a3229040d41f2f0edea8cbbfb941ee522d5e63fd8d
6
+ metadata.gz: a8413635e485186527c947d21a2cc9cf82e07952fd48c21508c7b17a6ccfb8a839b82e4af9621d2a5590c621e634d5179b7eb8ac3c268f12864d259c3afec36b
7
+ data.tar.gz: a24bb797c8f39f9b4b2ed4ceab735fdd0f4cd47d892dfdfa026ba553868119d0a0dea49d44b8934f30bb5f1723c02eeb533949638c501d27b5092936219ced4f
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # RailsBase
2
2
  Authentication is hard. Admin capabilties are hard. Two Factor Authentication is hard. Why rebuild that for every app that you make?
3
3
 
4
- The intent of RailsBase is to centralize how all of this data so that you can focus on what actuall matters -- Shipping your Rails Applicaion.
4
+ The intent of RailsBase is to centralize all of this data so that you can focus on what actually matters -- Shipping your Rails Applicaion.
5
5
 
6
6
  ## Usage
7
7
  Take a look at the [RailsBase Wiki](https://github.com/matt-taylor/rails_base/wiki/Basic-Setup).
@@ -25,8 +25,5 @@ Or install it yourself as:
25
25
  $ gem install rails_base
26
26
  ```
27
27
 
28
- ## Contributing
29
- Contribution directions go here.
30
-
31
28
  ## License
32
29
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,3 +1,6 @@
1
+ # Load Application record from the upstream
2
+ require "application_record"
3
+
1
4
  module RailsBase
2
5
  class ApplicationRecord < ::ApplicationRecord
3
6
  self.abstract_class = true
@@ -23,15 +23,11 @@ module RailsBase
23
23
  RailsBase::Configuration::Base._unset_allow_write! if RailsBase.___execute_initializer___?
24
24
  end
25
25
 
26
- initializer 'rails_base.magic_convenience_methods.model', after: 'active_record.initialize_database' do |app|
26
+ initializer 'rails_base.magic_convenience_methods.model', before: 'after_initialize' do |app|
27
27
  if RailsBase.___execute_initializer___?
28
- # need to eager load Models
29
- Rails.application.eager_load!
30
-
31
- # create a connection
32
28
  ActiveRecord::Base.retrieve_connection
33
29
 
34
- #explicitly load engine routes
30
+ # explicitly load engine routes
35
31
  RailsBase::ApplicationRecord.descendants.each do |model|
36
32
  model._magically_defined_time_objects
37
33
  end
@@ -1,6 +1,6 @@
1
1
  module RailsBase
2
2
  MAJOR = '0'
3
- MINOR = '74'
3
+ MINOR = '75'
4
4
  PATCH = '0'
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
6
 
data/lib/rails_base.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "rails_base/engine"
2
2
 
3
3
  # explicitly require gems that provide assets
4
- # when engine loads, this adds assets to Main apps ssets pipeline
4
+ # when engine loads, this adds assets to Main apps assets pipeline
5
5
  # (Only a problem for lazy loaded non prod ENVs)
6
6
  require 'jquery_mask_rails'
7
7
  require 'allow_numeric'
@@ -19,7 +19,7 @@ require 'rails_base/config'
19
19
  module RailsBase
20
20
 
21
21
  def self.___execute_initializer___?
22
- # Fixes rails 6 changes to ARGV's -- dont reun initializers during rake tasks
22
+ # Fixes rails 6 changes to ARGV's -- dont rerun initializers during rake tasks
23
23
  return false if Rake.application.top_level_tasks.any? { |task| task.include?(":") } rescue nil
24
24
 
25
25
  # Only execute when not doing DB actions
@@ -27,7 +27,7 @@ module RailsBase
27
27
  boolean = false if boolean && ARGV[0]&.include?('db') # when its the DB rake tasks
28
28
  boolean = false if boolean && ARGV[0]&.include?('asset') # when its an asset
29
29
  boolean = false if boolean && ARGV[0]&.include?(':') # else this delim should never be included
30
- boolean = false if ENV['SKIP_CUSTOM_INIT']=='true' # explicitly set the variable to skip shit
30
+ boolean = false if ENV['SKIP_CUSTOM_INIT'] == 'true' # explicitly set the variable to skip shit
31
31
 
32
32
  boolean
33
33
  end
@@ -41,11 +41,7 @@ module RailsBase
41
41
  end
42
42
 
43
43
  def self.default_app_name
44
- if ::Rails::VERSION::MAJOR >= 6
45
- ::Rails.application.class.module_parent_name
46
- else
47
- ::Rails.application.class.parent_name
48
- end
44
+ ::Rails.application.class.module_parent_name
49
45
  end
50
46
 
51
47
  def self.route_exist?(path)
@@ -73,5 +69,26 @@ module RailsBase
73
69
  config.reset_config!
74
70
  end
75
71
 
72
+ # This method allows the downstream service to explicitly set the paths to reload
73
+ # This can be very useful if you want to add new methods to already defined classes from RailsBase
74
+ # EG: You want to add a new method to the User Model
75
+ # EG: You want to overload a method for the services/rails_base/name_change.rb
76
+ def self.reloadable_paths!(relative_path:, skip_files: [])
77
+ unless Array === skip_files
78
+ raise ArgumentError, "When `skip_files` provided, it is expected to be an array"
79
+ end
80
+
81
+ overrides = Rails.root.join(relative_path)
82
+ Rails.autoloaders.main.ignore(overrides)
83
+
84
+ Rails.configuration.to_prepare do
85
+ Dir.glob("#{overrides}/**/*.rb").sort.each do |override|
86
+ next if skip_files.any? { override.include?(_1) }
87
+
88
+ load override
89
+ end
90
+ end
91
+ end
92
+
76
93
  AdminStruct = Struct.new(:original_attribute, :new_attribute, :user)
77
94
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.74.0
4
+ version: 0.75.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Taylor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '6.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: zeitwerk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.6.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.6.5
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: mysql2
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -212,20 +226,6 @@ dependencies:
212
226
  - - ">="
213
227
  - !ruby/object:Gem::Version
214
228
  version: '0'
215
- - !ruby/object:Gem::Dependency
216
- name: dalli
217
- requirement: !ruby/object:Gem::Requirement
218
- requirements:
219
- - - ">="
220
- - !ruby/object:Gem::Version
221
- version: '0'
222
- type: :runtime
223
- prerelease: false
224
- version_requirements: !ruby/object:Gem::Requirement
225
- requirements:
226
- - - ">="
227
- - !ruby/object:Gem::Version
228
- version: '0'
229
229
  - !ruby/object:Gem::Dependency
230
230
  name: browser
231
231
  requirement: !ruby/object:Gem::Requirement
@@ -367,7 +367,35 @@ dependencies:
367
367
  - !ruby/object:Gem::Version
368
368
  version: '0'
369
369
  - !ruby/object:Gem::Dependency
370
- name: byebug
370
+ name: pry
371
+ requirement: !ruby/object:Gem::Requirement
372
+ requirements:
373
+ - - ">="
374
+ - !ruby/object:Gem::Version
375
+ version: '0'
376
+ type: :development
377
+ prerelease: false
378
+ version_requirements: !ruby/object:Gem::Requirement
379
+ requirements:
380
+ - - ">="
381
+ - !ruby/object:Gem::Version
382
+ version: '0'
383
+ - !ruby/object:Gem::Dependency
384
+ name: pry-nav
385
+ requirement: !ruby/object:Gem::Requirement
386
+ requirements:
387
+ - - ">="
388
+ - !ruby/object:Gem::Version
389
+ version: '0'
390
+ type: :development
391
+ prerelease: false
392
+ version_requirements: !ruby/object:Gem::Requirement
393
+ requirements:
394
+ - - ">="
395
+ - !ruby/object:Gem::Version
396
+ version: '0'
397
+ - !ruby/object:Gem::Dependency
398
+ name: pry-stack_explorer
371
399
  requirement: !ruby/object:Gem::Requirement
372
400
  requirements:
373
401
  - - ">="
@@ -618,7 +646,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
618
646
  - !ruby/object:Gem::Version
619
647
  version: '0'
620
648
  requirements: []
621
- rubygems_version: 3.3.11
649
+ rubygems_version: 3.4.19
622
650
  signing_key:
623
651
  specification_version: 4
624
652
  summary: Rails engine that takes care of the stuff you dont want to!