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 +4 -4
- data/lib/pattern_patch/patch.rb +15 -2
- data/lib/pattern_patch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac52acbe5d2cbcea1cf92737af537c6ade5e6f8bd6dbfc018379b775525a29c7
|
4
|
+
data.tar.gz: 956aef3784a209327d24f96c400ceeef0058308d35495ddcf78cafa715d0bbe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39f90a02313d5534c608b8df06d244ed17e353e9faeb413f62607f3e54aaafb475f072be1999a1ef596e23dfe58efe3e56b4b4fa7cdee6386721a806778c1b75
|
7
|
+
data.tar.gz: 18282ce5b40fb449f8156517e6e9a154c792acaccc9e692e02cf9cc302e2f75c24c4723475864024d685ed9f6e604aea56c91990246ea91c5cd6026642943162
|
data/lib/pattern_patch/patch.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
90
|
+
patch_text,
|
78
91
|
global,
|
79
92
|
mode,
|
80
93
|
offset
|
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.
|
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-
|
11
|
+
date: 2017-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|