patch_me_in 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/lib/generators/patch_me_in/USAGE +8 -0
- data/lib/generators/patch_me_in/patch_generator.rb +7 -0
- data/lib/generators/patch_me_in/templates/patch.tt +6 -0
- data/lib/patch_me_in/base.rb +30 -0
- data/lib/patch_me_in/engine.rb +14 -0
- data/lib/patch_me_in/version.rb +3 -0
- data/lib/patch_me_in.rb +6 -0
- data/lib/tasks/patch_tasks.rake +4 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ccd56a33604bf061638559fa85651256d7734fa31403376aad33b9348551ad5c
|
4
|
+
data.tar.gz: 285b3e836e1b0d35badab0857318925bd131786946c091bcaae4d926afc24aef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: efd300ef30791411441ec834beb8d630d7b236d51e7f480829a23bbbcde7ac9e499d2837a385edd865f001e59c8c8a634475d164c7dfeae62c587a7fa230f62d
|
7
|
+
data.tar.gz: 4721ba9a0e13440275c02d74ac1f52f7c839aaa75a7a1c3db3c6efd6485edebcf8dabb1bc47316133afe5554b6e7d3ac85c19f26a97596f8d16af103ac4578d8
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright Jeff Peterson
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Patch
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem "patch"
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install patch
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module PatchMeIn
|
2
|
+
module Base
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
@@patches = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
class_methods do
|
11
|
+
def patches(name)
|
12
|
+
name = name.name if name.is_a?(Module)
|
13
|
+
@@patches = name
|
14
|
+
end
|
15
|
+
|
16
|
+
def patched_name
|
17
|
+
@@patches || name.sub(/Patch$/, "")
|
18
|
+
end
|
19
|
+
|
20
|
+
def patched_module
|
21
|
+
patched_name.constantize
|
22
|
+
end
|
23
|
+
|
24
|
+
def apply!
|
25
|
+
puts "Applying #{patched_name} to #{self}"
|
26
|
+
patched_module.tap { _1.include self }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module PatchMeIn
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace PatchMeIn
|
4
|
+
|
5
|
+
initializer "patch_me_in.reloader" do |app|
|
6
|
+
app.reloader.to_prepare do
|
7
|
+
Dir.glob("**/*.rb", base: app.root / "app/patches") do |name|
|
8
|
+
puts "Patching #{name}"
|
9
|
+
name.sub(/\.rb$/, "").camelize.constantize.apply!
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/patch_me_in.rb
ADDED
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: patch_me_in
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeff Peterson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-10-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 8.0.0.beta1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 8.0.0.beta1
|
27
|
+
description: Easily patch objects in a Rails app with live-reload support.
|
28
|
+
email:
|
29
|
+
- jeff@yak.sh
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- lib/generators/patch_me_in/USAGE
|
38
|
+
- lib/generators/patch_me_in/patch_generator.rb
|
39
|
+
- lib/generators/patch_me_in/templates/patch.tt
|
40
|
+
- lib/patch_me_in.rb
|
41
|
+
- lib/patch_me_in/base.rb
|
42
|
+
- lib/patch_me_in/engine.rb
|
43
|
+
- lib/patch_me_in/version.rb
|
44
|
+
- lib/tasks/patch_tasks.rake
|
45
|
+
homepage: https://github.com/craft-concept/patch_me_in
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata:
|
49
|
+
homepage_uri: https://github.com/craft-concept/patch_me_in
|
50
|
+
source_code_uri: https://github.com/craft-concept/patch_me_in
|
51
|
+
changelog_uri: https://github.com/craft-concept/patch_me_in/blob/main/CHANGELOG.md
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubygems_version: 3.5.21
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: Easily patch objects in a Rails app with live-reload support.
|
71
|
+
test_files: []
|