require_patch 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 9d9857f1703b6918ac46a093934f3d1fdeccacea
4
- data.tar.gz: 469862f29877ed780a9e195e634403bbbe6748c2
3
+ metadata.gz: 194f3b04e525afb6858c6f700795cf49eab23448
4
+ data.tar.gz: 09f421519b77b1425835ae650d47919f03e17cc9
5
5
  SHA512:
6
- metadata.gz: b448cc9f1aa70927a4a27e6c6e06a5ea437c5e954daad7271300eeff3db8d3a784bc5a581ae905eaa9411f8e1e9570a08a62422fb724962cad43508678463132
7
- data.tar.gz: 4437d745677ec3084798e5abac70a8b0facb0d79ded7c2373c01ad8cd9c6d931964f71ad7f0d1d2e6acb4744fa535ddc46840fb8956dfeda7ffa9eeeb56cbe38
6
+ metadata.gz: 33f42928543ea2384aa7c5fbc18b0ca5f3a987429aed85b439c7f3b10c03d45c7a1dc6d48ce7b07d90d405d3d0e27cbdbbaacb65a20f61bbe38f75796f014199
7
+ data.tar.gz: 5d074f866ebf364ea213b052dca7b593706f43205a814d5f469bb32129cc824f56e4635dc8029d17a44805ae94d70b1b18d6d32b3017e1a3be129fac4467186a
data/.gitignore CHANGED
@@ -1,8 +1,7 @@
1
+ *~
2
+ .*
1
3
  *.gem
2
4
  *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
5
  Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RequirePatch
2
2
 
3
- TODO: Write a gem description
3
+ The gem adds a command "require_patch" that connects patches plugins. It used by my team to develop Redmine plugins
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,16 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ plugins/awesome_plugin/lib/awesome_plugin
22
+ plugins/awesome_plugin/lib/awesome_plugin/user_patch.rb
23
+ plugins/awesome_plugin/lib/awesome_plugin/issue_patch.rb
24
+ plugins/awesome_plugin/lib/awesome_plugin/user_controller_patch.rb
25
+ plugins/awesome_plugin/lib/awesome_plugin/issue_helper_patch.rb
26
+
27
+ # plugins/awesome_plugin/init.rb
28
+ Rails.config.to_prepare do
29
+ require_patch 'awesome_plugin', 'user', 'issue', 'user_controller', 'issue_helper'
30
+ end
22
31
 
23
32
  ## Contributing
24
33
 
@@ -1,3 +1,3 @@
1
1
  module RequirePatch
2
- VERSION = "0.0.3"
2
+ VERSION = '0.0.4'
3
3
  end
data/lib/require_patch.rb CHANGED
@@ -1,9 +1,17 @@
1
- require "require_patch/version"
1
+ require 'require_patch/version'
2
2
 
3
3
  module RequirePatch
4
+
5
+ # It includes resources patches for plugin
6
+ # @param plugin_name [String] the plugin name
7
+ # @param *resources [String] names of resources which will need patching
8
+ # @example
9
+ # Rails.config.to_prepare do
10
+ # require_patch 'awesome_plugin', 'user', 'issue', 'user_controller', 'issue_helper'
11
+ # end
4
12
  def require_patch(plugin_name, *resources)
5
13
  resources.each do |resource|
6
- require_dependency resource
14
+ require_dependency resource rescue Rails.logger.warn "Can't find '#{resource}' for require_dependency"
7
15
 
8
16
  resource_patch = [plugin_name, [resource, 'patch'].join('_')].join('/')
9
17
  resource_constant, resource_patch_constant = [resource, resource_patch].map(&:camelize).map(&:constantize)
@@ -4,20 +4,20 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'require_patch/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "require_patch"
7
+ spec.name = 'require_patch'
8
8
  spec.version = RequirePatch::VERSION
9
- spec.authors = ["Roman Shipiev"]
10
- spec.email = ["roman@shipiev.pro"]
9
+ spec.authors = ['Roman Shipiev']
10
+ spec.email = ['roman@shipiev.pro']
11
11
  spec.summary = %q{The gem adds a command "require_patch" that connects patches plugins}
12
12
  spec.description = %q{The gem used by our team to develop Redmine plugins}
13
- spec.homepage = "https://github.com/shipiev/require_patch"
14
- spec.license = "MIT"
13
+ spec.homepage = 'https://github.com/shipiev/require_patch'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.5"
22
- spec.add_development_dependency "rake"
21
+ spec.add_development_dependency 'bundler', '~> 1.5'
22
+ spec.add_development_dependency 'rake'
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: require_patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Shipiev