pattern_patch 0.5.5 → 1.0.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: 8f6f40628b47488df4f90cfa6a5b50d081920599c96d010fd74885dad790e0b8
4
- data.tar.gz: f0cb442292000db601602c3e8540a6989b87c99efbc43aa8736ca5331cb51cc3
3
+ metadata.gz: fc0d437672f9e3a7d51040cb109563f95a8784a4a42e9c6ade0e1e2a54b01089
4
+ data.tar.gz: 6567f0afb3fa497a023388c9f44096ab909d8594bbc7473c9e68e6c9874b541d
5
5
  SHA512:
6
- metadata.gz: 6f0267701568351d0fb97de38756fa62c8ffb1700784ba0ebaed121e19d544600565f5f58eb76ce1ae3fd1cca76c23547963133cba9989590d74008ef924d569
7
- data.tar.gz: cb8c146fc40df297a83d2579e8dc8580fd5c959d75934fc2e0354c6edea87f8aa370a538dc4aa1833dfa2ad9505c59d34151737576025b53612e113eec98d73a
6
+ metadata.gz: d976644d1f3f65ced40eab70cdc1a33eee7dabf8fe0613d8b30f2717c228a8ce5637d064e0a3f587bd1e61b8739361216f8cbc55b89f1e1f094210827b3ae4a0
7
+ data.tar.gz: 7a15306a3d1f4cba0ec4b1212756948de3042fa4462738fbc07e5b5c161e66a05e01dc63272e74e51e86a7b230323dfe540469ad11d1bf85d94a22e384303ad3
@@ -46,9 +46,36 @@ module PatternPatch
46
46
  # @raise [ConfigurationError] If patch_dir is nil or is not a valid directory path
47
47
  def patch(name)
48
48
  raise ConfigurationError, "patch_dir has not been set" if patch_dir.nil?
49
- raise ConfigurationError, "patch_dir is not a directory" unless Dir.exist?(patch_dir)
49
+ raise ConfigurationError, "patch_dir #{patch_dir} is not a directory" unless Dir.exist?(patch_dir)
50
+
50
51
  Patch.from_yaml File.join(patch_dir, "#{name}.yml")
51
52
  end
53
+
54
+ # Useful to configure PatternPatch without using the class
55
+ # (PatternPatch.patch_dir=), ivar (@patch_dir) or explicit
56
+ # setter (self.patch_dir=).
57
+ #
58
+ # include PatternPatch::Methods
59
+ # patch_config do |c|
60
+ # c.patch_dir = 'lib/assets/patches'
61
+ # c.trim_mode = '<>'
62
+ # end
63
+ #
64
+ # or
65
+ #
66
+ # include PatternPatch::Methods
67
+ # patch_config.patch_dir = 'lib/assets/patches'
68
+ # patch_config.trim_mode = '<>'
69
+ #
70
+ # @yield self if block_given?
71
+ # @return self or return value of block
72
+ def patch_config(&block)
73
+ if block_given?
74
+ yield self
75
+ else
76
+ self
77
+ end
78
+ end
52
79
  end
53
80
 
54
81
  class << self
@@ -29,6 +29,7 @@ module PatternPatch
29
29
 
30
30
  contents = "#{matches.pre_match}#{patched_pattern}#{matches.post_match}"
31
31
  break unless global
32
+
32
33
  search_position = matches.pre_match.length + patched_pattern.length
33
34
  end
34
35
  contents
@@ -71,6 +72,7 @@ module PatternPatch
71
72
  reverted_text = matches[0].sub(text.apply_matches(matches), '')
72
73
  contents = "#{matches.pre_match}#{reverted_text}#{matches.post_match}"
73
74
  break unless global
75
+
74
76
  search_position = matches.pre_match.length + reverted_text.length
75
77
  end
76
78
 
@@ -1,3 +1,3 @@
1
1
  module PatternPatch
2
- VERSION = "0.5.5"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,111 +1,117 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pattern_patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 1.0.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-12-29 00:00:00.000000000 Z
11
+ date: 2019-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: 4.0.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 4.0.2
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '4.2'
32
+ version: '6'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - '>='
37
+ - - ">="
32
38
  - !ruby/object:Gem::Version
33
39
  version: '0'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - '>='
44
+ - - ">="
39
45
  - !ruby/object:Gem::Version
40
46
  version: '0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: pry
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - '>='
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - '>='
58
+ - - ">="
53
59
  - !ruby/object:Gem::Version
54
60
  version: '0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - '>='
65
+ - - ">="
60
66
  - !ruby/object:Gem::Version
61
67
  version: '0'
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - '>='
72
+ - - ">="
67
73
  - !ruby/object:Gem::Version
68
74
  version: '0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rspec
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - '>='
79
+ - - ">="
74
80
  - !ruby/object:Gem::Version
75
81
  version: '0'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - '>='
86
+ - - ">="
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: rspec-simplecov
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
- - - '>='
93
+ - - ">="
88
94
  - !ruby/object:Gem::Version
89
95
  version: '0'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
- - - '>='
100
+ - - ">="
95
101
  - !ruby/object:Gem::Version
96
102
  version: '0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: rspec_junit_formatter
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
- - - '>='
107
+ - - ">="
102
108
  - !ruby/object:Gem::Version
103
109
  version: '0'
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
- - - '>='
114
+ - - ">="
109
115
  - !ruby/object:Gem::Version
110
116
  version: '0'
111
117
  - !ruby/object:Gem::Dependency
@@ -114,40 +120,40 @@ dependencies:
114
120
  requirements:
115
121
  - - '='
116
122
  - !ruby/object:Gem::Version
117
- version: 0.50.0
123
+ version: 0.65.0
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - '='
123
129
  - !ruby/object:Gem::Version
124
- version: 0.50.0
130
+ version: 0.65.0
125
131
  - !ruby/object:Gem::Dependency
126
132
  name: simplecov
127
133
  requirement: !ruby/object:Gem::Requirement
128
134
  requirements:
129
- - - '>='
135
+ - - ">="
130
136
  - !ruby/object:Gem::Version
131
137
  version: '0'
132
138
  type: :development
133
139
  prerelease: false
134
140
  version_requirements: !ruby/object:Gem::Requirement
135
141
  requirements:
136
- - - '>='
142
+ - - ">="
137
143
  - !ruby/object:Gem::Version
138
144
  version: '0'
139
145
  - !ruby/object:Gem::Dependency
140
146
  name: yard
141
147
  requirement: !ruby/object:Gem::Requirement
142
148
  requirements:
143
- - - '>='
149
+ - - ">="
144
150
  - !ruby/object:Gem::Version
145
151
  version: '0'
146
152
  type: :development
147
153
  prerelease: false
148
154
  version_requirements: !ruby/object:Gem::Requirement
149
155
  requirements:
150
- - - '>='
156
+ - - ">="
151
157
  - !ruby/object:Gem::Version
152
158
  version: '0'
153
159
  description: This is a utility gem that identifies positions in any text using regular
@@ -174,17 +180,16 @@ require_paths:
174
180
  - lib
175
181
  required_ruby_version: !ruby/object:Gem::Requirement
176
182
  requirements:
177
- - - '>='
183
+ - - ">="
178
184
  - !ruby/object:Gem::Version
179
- version: 2.0.0
185
+ version: 2.3.0
180
186
  required_rubygems_version: !ruby/object:Gem::Requirement
181
187
  requirements:
182
- - - '>='
188
+ - - ">="
183
189
  - !ruby/object:Gem::Version
184
190
  version: '0'
185
191
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.7.4
192
+ rubygems_version: 3.0.3
188
193
  signing_key:
189
194
  specification_version: 4
190
195
  summary: Apply and revert pattern-based patches to text files of any kind