txt_file_mutator 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -1
- data/README +17 -0
- data/README.rdoc +8 -1
- data/VERSION +1 -1
- data/lib/txt_file_mutator.rb +6 -2
- data/test/test_txt_file_mutator.rb +1 -1
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
13-11-2009: Initial release
|
2
|
+
|
data/README
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
txt_file_mutator
|
2
|
+
================
|
3
|
+
Kristian Mandrup, kmandrup@gmail.com
|
4
|
+
---
|
5
|
+
|
6
|
+
Contains utility functions for doing simple file mutations/transformations such as:
|
7
|
+
|
8
|
+
* Inserting content BEFORE a line with some specific content
|
9
|
+
* Inserting content AFTER a line with some specific content
|
10
|
+
|
11
|
+
* Commenting a line with some specific content
|
12
|
+
* Commenting a config.gem statement for a specific gem
|
13
|
+
|
14
|
+
* Remove a line
|
15
|
+
* Remove a require statement
|
16
|
+
|
17
|
+
(more to come in later versions...!)
|
data/README.rdoc
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
= txt_file_mutator
|
2
2
|
|
3
|
-
|
3
|
+
Contains utility functions for doing simple file mutations/transformations such as:
|
4
|
+
* Inserting content BEFORE a line with some specific content
|
5
|
+
* Inserting content AFTER a line with some specific content
|
6
|
+
* Commenting a line with some specific content
|
7
|
+
* Commenting a config.gem statement for a specific gem
|
8
|
+
* Remove a line
|
9
|
+
* Remove a require statement
|
10
|
+
|
4
11
|
|
5
12
|
== Note on Patches/Pull Requests
|
6
13
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/txt_file_mutator.rb
CHANGED
@@ -17,10 +17,14 @@ module TextFileMutator
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.remove_require(file, line)
|
21
|
+
gsub_file file, /(require.+'#{Regexp.escape(line)}'.+)/mi do |match|
|
22
|
+
""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
20
26
|
def self.comment_line(file, line)
|
21
|
-
puts "comment line: #{line}"
|
22
27
|
gsub_file file, /^#?(#{Regexp.escape(line)})/mi do |match|
|
23
|
-
puts "match: #{match}"
|
24
28
|
"# " + "#{match}"
|
25
29
|
end
|
26
30
|
end
|