text_injector 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/text_injector.rb +5 -5
- data/lib/text_injector/version.rb +1 -1
- data/spec/lib/text_injector_spec.rb +4 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac2d6aa94294adc0eca0d31e2573004581cd6ea2
|
4
|
+
data.tar.gz: 121a61b2ac08edfb1efce61646e6c421a70f53b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 821fb9de70678bd3ef2c65751dde24ee229e4e9c75334205a42332704512a149a37eb7a848decbacd42a1ac5add4a726c6b027da5f35ef74b1e081b95649ff5b
|
7
|
+
data.tar.gz: 50e1b3db767899c7fb003b3c3cc53c2827a9a749f41453b4338ccf094251049f126176151fe84252b832dd2641654e91bdb3857eb8b844c5eedacca0c5449fe7
|
data/lib/text_injector.rb
CHANGED
@@ -24,6 +24,10 @@ class TextInjector
|
|
24
24
|
puts msg unless @options[:mute]
|
25
25
|
end
|
26
26
|
|
27
|
+
def tmp_path
|
28
|
+
"#{@file}.tmp"
|
29
|
+
end
|
30
|
+
|
27
31
|
protected
|
28
32
|
|
29
33
|
def default_identifier
|
@@ -41,15 +45,11 @@ protected
|
|
41
45
|
@current_file = results
|
42
46
|
end
|
43
47
|
|
44
|
-
def tmp_path
|
45
|
-
"#{@file}.tmp"
|
46
|
-
end
|
47
|
-
|
48
48
|
def write_file(contents)
|
49
49
|
File.open(tmp_path, 'w') do |file|
|
50
50
|
file.write(contents)
|
51
51
|
end
|
52
|
-
if @options[:
|
52
|
+
if @options[:tmp_file]
|
53
53
|
say "Tmp file written to #{tmp_path}"
|
54
54
|
else
|
55
55
|
say "Updated #{@file}"
|
@@ -13,7 +13,7 @@ describe TextInjector do
|
|
13
13
|
TextInjector.new(
|
14
14
|
:mute => true,
|
15
15
|
:file => @file,
|
16
|
-
:
|
16
|
+
:tmp_file => @tmp_file,
|
17
17
|
:identifier => @identifier,
|
18
18
|
:content => @content
|
19
19
|
)
|
@@ -67,11 +67,10 @@ EOL
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should create temp file" do
|
70
|
-
@
|
70
|
+
@tmp_file = true
|
71
71
|
injector.run
|
72
|
-
|
73
|
-
|
74
|
-
FileUtils.rm_f(temp_file)
|
72
|
+
File.exist?(injector.tmp_path).should be_true
|
73
|
+
FileUtils.rm_f(injector.tmp_path)
|
75
74
|
end
|
76
75
|
end
|
77
76
|
end
|