rails_model_load_hook 0.2.0 → 0.2.2

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: ecb45b5a7643cb562b40a2720d3b3d493e1a18edcc13f5350c7fe3dbcf75d9f5
4
- data.tar.gz: 25c5602d6d9006e2b9833a44b2368825f70df12bea69159668ba5c843a94e596
3
+ metadata.gz: d15400d3b6d8423c22056f4f6a6d7bc393b7171e4676337a95655ab72c400be2
4
+ data.tar.gz: c45064f10e3aba52c193bc5acf2d776cc3a1a4fed0b8dd9aa9c7e2b8b83e4cd9
5
5
  SHA512:
6
- metadata.gz: 6b7f8b85f6fac2fda99e9eb8c194238a14211b070ad8bfeece3d914a06bb64988bfd1a39dc06f2f5bc3e16c8573c4f4a342eecf0066cddd24bbf83499d7c76a9
7
- data.tar.gz: 4d9f25714d54a52321a63a42634f0ddc0d7516f0302dc114b731f200525802b6707172d4dc062f811402f9749a6924245bbce5f6ce82b1a04b745b2c98404ffe
6
+ metadata.gz: 2a0dbafd256e894ad2d0973685584ebb5ee8b1c7d35197f00709616dd7f3dd446adfd6ced2eec382eecb51360a4de9004964d11f7ad87ee4606dd9322e238534
7
+ data.tar.gz: dd2d6c18d72104aee7203c694284b643ec9e1594db4ed680061ae0b236479f4882b1a0b664b4b126c95d42669df7acb808ae5abd6d3faca2848e49833243eea2
data/CHANGELOG.md ADDED
File without changes
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2013 Alexander Senko, SoftPro Ltd.
1
+ Copyright Alexander Senko
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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
- #!/usr/bin/env rake
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
- RDoc::Task.new(:rdoc) do |rdoc|
16
- rdoc.rdoc_dir = 'rdoc'
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
- Bundler::GemHelper.install_tasks
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,4 @@
1
+ module RailsModelLoadHook
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module RailsModelLoadHook
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module RailsModelLoadHook
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module RailsModelLoadHook
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
- module RailsModelLoadHook::ActiveRecord
2
- concern :OnLoad do
1
+ module RailsModelLoadHook
2
+ concern :ActiveRecord do
3
3
  class_methods do
4
4
  private
5
5
 
@@ -0,0 +1,5 @@
1
+ module RailsModelLoadHook
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -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>
@@ -0,0 +1,3 @@
1
+ ActiveSupport.on_load :active_record do
2
+ prepend RailsModelLoadHook::ActiveRecord
3
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ RailsModelLoadHook::Engine.routes.draw do
2
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module RailsModelLoadHook
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -1,5 +1,6 @@
1
- require 'rails_model_load_hook/engine'
2
- require 'rails_model_load_hook/active_record'
1
+ require "rails_model_load_hook/version"
2
+ require "rails_model_load_hook/engine"
3
3
 
4
4
  module RailsModelLoadHook
5
+ # Your code goes here...
5
6
  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.0
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: 2023-12-20 00:00:00.000000000 Z
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: '4.1'
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: '4.1'
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.rdoc
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/active_record.rb
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.0'
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.0.dev
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.
@@ -1,5 +0,0 @@
1
- require 'rails_model_load_hook/active_record/on_load'
2
-
3
- ActiveSupport.on_load :active_record do
4
- prepend RailsModelLoadHook::ActiveRecord::OnLoad
5
- end