require_infector 0.1.0 → 0.2.0
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/README.md +8 -1
- data/lib/require_infector.rb +10 -1
- data/lib/require_infector/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf7083a443e7113c8f8d0c78bd59f3e9022ef419
|
4
|
+
data.tar.gz: b0f0b975167833bd18162dc56ff17203e8d6c596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 426abf443efb081f86a1702568b82b3a0b7247e236e6a8c28a63c0ec341d56e89b6a453637c12fd436436feee8ede14327b475650dd787958110e7773dd90474
|
7
|
+
data.tar.gz: d1404526b7e7f3feb7c947e9d3db1effca229d54657e70e4dadf4dd80b505f393383ebdfbf97cd8964b7047f7397d797550168bd9123ffb4919d455d06249ea1
|
data/README.md
CHANGED
@@ -32,9 +32,16 @@ Or install it yourself as:
|
|
32
32
|
# or require_infector 'awesome_plugin', 'form/builder', skip_require_dependency: true
|
33
33
|
end
|
34
34
|
|
35
|
+
## Options
|
36
|
+
|
37
|
+
skip_require_dependency - block require_dependency resource (default: false)
|
38
|
+
dir - directory for patches (default: 'infectors')
|
39
|
+
prefix - for patch-file (default: nil)
|
40
|
+
postfix - for patch-file (default: nil)
|
41
|
+
|
35
42
|
## Contributing
|
36
43
|
|
37
|
-
1. Fork it ( http://github.com
|
44
|
+
1. Fork it ( http://github.com/shipiev/require_infector/fork )
|
38
45
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
46
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
47
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/require_infector.rb
CHANGED
@@ -10,10 +10,19 @@ module RequireInfector
|
|
10
10
|
# require_infector 'awesome_plugin', ['user', 'issue', 'user_controller', 'issue_helper']
|
11
11
|
# end
|
12
12
|
def require_infector(plugin_name, resources, options = {})
|
13
|
+
default_options = {
|
14
|
+
dir: 'infectors',
|
15
|
+
prefix: nil,
|
16
|
+
postfix: nil
|
17
|
+
}
|
18
|
+
|
19
|
+
options = default_options.merge options
|
20
|
+
|
13
21
|
resources.to_a.each do |resource|
|
14
22
|
require_dependency resource unless options[:skip_require_dependency]
|
15
23
|
|
16
|
-
|
24
|
+
infector_name = [options[:prefix], resource, options[:postfix]].select(&:present?).join('_')
|
25
|
+
resource_patch = [plugin_name, options[:dir], infector_name].select(&:present?).join('/')
|
17
26
|
resource_constant, resource_patch_constant = [resource, resource_patch].map(&:camelize).map(&:constantize)
|
18
27
|
|
19
28
|
resource_constant.send(:include, resource_patch_constant) unless resource_constant.included_modules.include? resource_patch_constant
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: require_infector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Shipiev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
61
|
rubyforge_project:
|
62
|
-
rubygems_version: 2.
|
62
|
+
rubygems_version: 2.4.8
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
65
|
summary: The gem add 'require_infector' to ActionDispatch
|