pattern_patch 0.3.0 → 0.4.0

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: e6f3d56a8e098394dcb99213f11b443e2f9594f170c18e42bc7b542c66a5ce05
4
- data.tar.gz: 74ef513114b65d8dc6920d7780abfbbbb0f44434bf904315a5486a662302e944
3
+ metadata.gz: ac52acbe5d2cbcea1cf92737af537c6ade5e6f8bd6dbfc018379b775525a29c7
4
+ data.tar.gz: 956aef3784a209327d24f96c400ceeef0058308d35495ddcf78cafa715d0bbe3
5
5
  SHA512:
6
- metadata.gz: 9d1965026da862449372668c4c3b835203700d30d93e6baf84c2d5a8eccb674d4badb8ed74fbc3bca2f812d1b489668f2b6dcb1a79fab84f323b04afe1c534c5
7
- data.tar.gz: 043d8424830d6c8cd5ca3893c00c396bf49dafa2f4e425df222d046d04d7d2fa9a75862afd586580998cc4455b57b2495435a8f5060b4d9244e7574a7206168f
6
+ metadata.gz: 39f90a02313d5534c608b8df06d244ed17e353e9faeb413f62607f3e54aaafb475f072be1999a1ef596e23dfe58efe3e56b4b4fa7cdee6386721a806778c1b75
7
+ data.tar.gz: 18282ce5b40fb449f8156517e6e9a154c792acaccc9e692e02cf9cc302e2f75c24c4723475864024d685ed9f6e604aea56c91990246ea91c5cd6026642943162
@@ -1,4 +1,5 @@
1
1
  require "active_support/core_ext/hash"
2
+ require "erb"
2
3
  require "yaml"
3
4
 
4
5
  module PatternPatch
@@ -56,10 +57,16 @@ module PatternPatch
56
57
  offset = options[:offset] || 0
57
58
  files = [files] if files.kind_of? String
58
59
 
60
+ if options[:binding]
61
+ patch_text = ERB.new(text).result(options[:binding])
62
+ else
63
+ patch_text = text
64
+ end
65
+
59
66
  files.each do |path|
60
67
  modified = Utilities.apply_patch File.read(path),
61
68
  regexp,
62
- text,
69
+ patch_text,
63
70
  global,
64
71
  mode,
65
72
  offset
@@ -71,10 +78,16 @@ module PatternPatch
71
78
  offset = options[:offset] || 0
72
79
  files = [files] if files.kind_of? String
73
80
 
81
+ if options[:binding]
82
+ patch_text = ERB.new(text).result(options[:binding])
83
+ else
84
+ patch_text = text
85
+ end
86
+
74
87
  files.each do |path|
75
88
  modified = Utilities.revert_patch File.read(path),
76
89
  regexp,
77
- text,
90
+ patch_text,
78
91
  global,
79
92
  mode,
80
93
  offset
@@ -1,3 +1,3 @@
1
1
  module PatternPatch
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pattern_patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Dee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport