Class: Rake::FileList

Inherits:
Object
  • Object
show all
Defined in:
lib/txt_file_mutator.rb

Instance Method Summary collapse

Instance Method Details

#append_line(content) ⇒ Object



234
235
236
237
238
# File 'lib/txt_file_mutator.rb', line 234

def append_line(content)
  each do |file|
    TextFileMutator.append_line file, content
  end
end

#comment_line(file, line) ⇒ Object



204
205
206
207
208
# File 'lib/txt_file_mutator.rb', line 204

def comment_line(file, line)  
  each do |file|
    TextFileMutator.comment_line file, line
  end    
end

#comment_line_w_contents(file, part1, part2) ⇒ Object



210
211
212
213
214
# File 'lib/txt_file_mutator.rb', line 210

def comment_line_w_contents(file, part1, part2)  
  each do |file|
    TextFileMutator.comment_line_w_contents file, part1, part2
  end    
end

#has_any_content?(content) ⇒ Boolean

Returns:

  • (Boolean)


141
142
143
144
145
146
147
# File 'lib/txt_file_mutator.rb', line 141

def has_any_content?(content)
  each do |file|
    t = TextFileMutator.has_multiple_content_after?(file.read, content)
    return t if t
  end    
  false
end

#has_any_content_after?(content, after) ⇒ Boolean

Returns:

  • (Boolean)


165
166
167
168
169
170
171
# File 'lib/txt_file_mutator.rb', line 165

def has_any_content_after?(content, after)
  each do |file|
    t = TextFileMutator.has_any_content_after?(file.read, content, after)
    return t if t
  end    
  false
end

#has_any_multiple_content_after?(content, after) ⇒ Boolean

Returns:

  • (Boolean)


157
158
159
160
161
162
163
# File 'lib/txt_file_mutator.rb', line 157

def has_any_multiple_content_after?(content, after)
  each do |file|
    t = TextFileMutator.has_multiple_content_after?(file.read, content, after)
    return t if t
  end    
  false
end

#has_content_before?(content, before) ⇒ Boolean

Returns:

  • (Boolean)


133
134
135
136
137
138
139
# File 'lib/txt_file_mutator.rb', line 133

def has_content_before?(content, before) 
  each do |file|
    t = TextFileMutator.has_multiple_content_after?(file.read, content, before)
    return t if t
  end    
  false
end

#has_multiple_content_before?(content, before) ⇒ Boolean

Returns:

  • (Boolean)


125
126
127
128
129
130
131
# File 'lib/txt_file_mutator.rb', line 125

def has_multiple_content_before?(content, before) 
  each do |file|
    t = TextFileMutator.has_multiple_content_before?(file.read, content, before)
    return t if t
  end    
  false
end

#have_all_content?(content) ⇒ Boolean

Returns:

  • (Boolean)


149
150
151
152
153
154
155
# File 'lib/txt_file_mutator.rb', line 149

def have_all_content?(content)
  each do |file|
    t = TextFileMutator.has_multiple_content_after?(file.read, content)
    return false if !t
  end    
  true
end

#insert_after(file, line, txt_after, exist_check = true) ⇒ Object



179
180
181
182
183
# File 'lib/txt_file_mutator.rb', line 179

def insert_after(file, line, txt_after, exist_check=true) 
  each do |file|
    TextFileMutator.insert_after line, txt_after, exist_check
  end    
end

#insert_before(file, line, txt_before, exist_check = true) ⇒ Object



173
174
175
176
177
# File 'lib/txt_file_mutator.rb', line 173

def insert_before(file, line, txt_before, exist_check=true)
  each do |file|
    TextFileMutator.insert_before line, txt_before, exist_check
  end    
end

#remove_content(line) ⇒ Object



216
217
218
219
220
# File 'lib/txt_file_mutator.rb', line 216

def remove_content(line)  
  each do |file|
    TextFileMutator.remove_content file, line
  end    
end

#remove_duplicate_lines(file) ⇒ Object



185
186
187
188
189
# File 'lib/txt_file_mutator.rb', line 185

def remove_duplicate_lines(file)
  each do |file|
    TextFileMutator.remove_duplicate_lines
  end    
end

#remove_line(line) ⇒ Object



222
223
224
225
226
# File 'lib/txt_file_mutator.rb', line 222

def remove_line(line)  
  each do |file|
    TextFileMutator.remove_line file, line
  end    
end

#remove_line_w_contents(file, part1, part2) ⇒ Object

TODO: support both ” and “”



198
199
200
201
202
# File 'lib/txt_file_mutator.rb', line 198

def remove_line_w_contents(file, part1, part2)
  each do |file|
    TextFileMutator.remove_line_w_contents file, part1, part2
  end    
end

#remove_require(file, line) ⇒ Object



191
192
193
194
195
# File 'lib/txt_file_mutator.rb', line 191

def remove_require(file, line)
  each do |file|
    TextFileMutator.remove_require file, line
  end    
end

#replace_line(line, replacement) ⇒ Object



228
229
230
231
232
# File 'lib/txt_file_mutator.rb', line 228

def replace_line(line, replacement)  
  each do |file|
    TextFileMutator.replace_line file, line, replacement
  end    
end