rails_model_load_hook 0.2.0 → 0.2.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/CHANGELOG.md +0 -0
- data/MIT-LICENSE +1 -1
- data/README.md +39 -0
- data/Rakefile +5 -22
- data/app/assets/config/rails_model_load_hook_manifest.js +1 -0
- data/app/assets/stylesheets/rails_model_load_hook/application.css +15 -0
- data/app/controllers/rails_model_load_hook/application_controller.rb +4 -0
- data/app/helpers/rails_model_load_hook/application_helper.rb +4 -0
- data/app/jobs/rails_model_load_hook/application_job.rb +4 -0
- data/app/mailers/rails_model_load_hook/application_mailer.rb +6 -0
- data/{lib/rails_model_load_hook/active_record/on_load.rb → app/models/concerns/rails_model_load_hook/active_record.rb} +2 -2
- data/app/models/rails_model_load_hook/application_record.rb +5 -0
- data/app/views/layouts/rails_model_load_hook/application.html.erb +15 -0
- data/config/initializers/active_record.rb +3 -0
- data/config/routes.rb +2 -0
- data/lib/rails_model_load_hook/authors.rb +15 -0
- data/lib/rails_model_load_hook/version.rb +1 -1
- data/lib/rails_model_load_hook.rb +3 -2
- metadata +26 -26
- data/README.rdoc +0 -22
- data/lib/rails_model_load_hook/active_record.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d15400d3b6d8423c22056f4f6a6d7bc393b7171e4676337a95655ab72c400be2
|
4
|
+
data.tar.gz: c45064f10e3aba52c193bc5acf2d776cc3a1a4fed0b8dd9aa9c7e2b8b83e4cd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a0dbafd256e894ad2d0973685584ebb5ee8b1c7d35197f00709616dd7f3dd446adfd6ced2eec382eecb51360a4de9004964d11f7ad87ee4606dd9322e238534
|
7
|
+
data.tar.gz: dd2d6c18d72104aee7203c694284b643ec9e1594db4ed680061ae0b236479f4882b1a0b664b4b126c95d42669df7acb808ae5abd6d3faca2848e49833243eea2
|
data/CHANGELOG.md
ADDED
File without changes
|
data/MIT-LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Rails Model Load Hook
|
2
|
+
|
3
|
+
Adds `:model_class` loading hook for every `ActiveRecord` descendant.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
ActiveSupport.on_load :model_class do
|
9
|
+
# The code for your model class goes here…
|
10
|
+
end
|
11
|
+
```
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem "rails_model_load_hook"
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
```bash
|
22
|
+
$ bundle
|
23
|
+
```
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
```bash
|
27
|
+
$ gem install rails_model_load_hook
|
28
|
+
```
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
37
|
+
|
38
|
+
## License
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,25 +1,8 @@
|
|
1
|
-
|
2
|
-
begin
|
3
|
-
require 'bundler/setup'
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
1
|
+
require "bundler/setup"
|
14
2
|
|
15
|
-
|
16
|
-
|
17
|
-
rdoc.title = 'RailsModelLoadHook'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
22
5
|
|
6
|
+
load "rails/tasks/statistics.rake"
|
23
7
|
|
24
|
-
|
25
|
-
|
8
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/rails_model_load_hook .css
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Rails model load hook</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag "rails_model_load_hook/application", media: "all" %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<%= yield %>
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Author ||= Struct.new(
|
2
|
+
:name,
|
3
|
+
:email,
|
4
|
+
:github_url,
|
5
|
+
)
|
6
|
+
|
7
|
+
module RailsModelLoadHook
|
8
|
+
AUTHORS = [
|
9
|
+
Gem::Author.new(
|
10
|
+
name: 'Alexander Senko',
|
11
|
+
email: 'Alexander.Senko@gmail.com',
|
12
|
+
github_url: 'https://github.com/Alexander-Senko',
|
13
|
+
),
|
14
|
+
]
|
15
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_model_load_hook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Senko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.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: '
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: sqlite3
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
26
|
+
version: '7.1'
|
41
27
|
description: Adds :model_class load hook for every ActiveRecord descendant.
|
42
28
|
email:
|
43
29
|
- Alexander.Senko@gmail.com
|
@@ -45,19 +31,33 @@ executables: []
|
|
45
31
|
extensions: []
|
46
32
|
extra_rdoc_files: []
|
47
33
|
files:
|
34
|
+
- CHANGELOG.md
|
48
35
|
- MIT-LICENSE
|
49
|
-
- README.
|
36
|
+
- README.md
|
50
37
|
- Rakefile
|
38
|
+
- app/assets/config/rails_model_load_hook_manifest.js
|
39
|
+
- app/assets/stylesheets/rails_model_load_hook/application.css
|
40
|
+
- app/controllers/rails_model_load_hook/application_controller.rb
|
41
|
+
- app/helpers/rails_model_load_hook/application_helper.rb
|
42
|
+
- app/jobs/rails_model_load_hook/application_job.rb
|
43
|
+
- app/mailers/rails_model_load_hook/application_mailer.rb
|
44
|
+
- app/models/concerns/rails_model_load_hook/active_record.rb
|
45
|
+
- app/models/rails_model_load_hook/application_record.rb
|
46
|
+
- app/views/layouts/rails_model_load_hook/application.html.erb
|
47
|
+
- config/initializers/active_record.rb
|
48
|
+
- config/routes.rb
|
51
49
|
- lib/rails_model_load_hook.rb
|
52
|
-
- lib/rails_model_load_hook/
|
53
|
-
- lib/rails_model_load_hook/active_record/on_load.rb
|
50
|
+
- lib/rails_model_load_hook/authors.rb
|
54
51
|
- lib/rails_model_load_hook/engine.rb
|
55
52
|
- lib/rails_model_load_hook/version.rb
|
56
53
|
- lib/tasks/rails_model_load_hook_tasks.rake
|
57
54
|
homepage: https://github.com/Alexander-Senko/rails_model_load_hook
|
58
55
|
licenses:
|
59
56
|
- MIT
|
60
|
-
metadata:
|
57
|
+
metadata:
|
58
|
+
homepage_uri: https://github.com/Alexander-Senko/rails_model_load_hook
|
59
|
+
source_code_uri: https://github.com/Alexander-Senko/rails_model_load_hook
|
60
|
+
changelog_uri: https://github.com/Alexander-Senko/rails_model_load_hook/blob/v0.2.2/CHANGELOG.md
|
61
61
|
post_install_message:
|
62
62
|
rdoc_options: []
|
63
63
|
require_paths:
|
@@ -66,14 +66,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '2.
|
69
|
+
version: '2.7'
|
70
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
|
-
rubygems_version: 3.5.
|
76
|
+
rubygems_version: 3.5.3
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Load hook for Rails model classes.
|
data/README.rdoc
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
= Loading hook for Rails models
|
2
|
-
|
3
|
-
Adds <tt>:model_class</tt> loading hook for every <tt>ActiveRecord</tt> descendant.
|
4
|
-
|
5
|
-
|
6
|
-
== Installation
|
7
|
-
|
8
|
-
Just include the gem in <tt>Gemfile</tt> and <tt>bundle</tt> it.
|
9
|
-
|
10
|
-
|
11
|
-
== Usage
|
12
|
-
|
13
|
-
ActiveSupport.on_load :model_class do
|
14
|
-
# Put the code for your model here
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
== License
|
19
|
-
|
20
|
-
This project uses MIT-LICENSE.
|
21
|
-
|
22
|
-
© Alexander Senko, SoftPro Ltd.
|