expansions 0.1.5 → 0.1.6
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.
- data/lib/core/file_merge.rb +11 -3
- data/lib/core/version.rb +1 -1
- metadata +2 -2
data/lib/core/file_merge.rb
CHANGED
@@ -21,18 +21,26 @@ module Expansions
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run
|
24
|
-
|
24
|
+
copy_name = File.join(File.dirname(@output_file),"copy_of_#{File.basename(@output_file)}")
|
25
|
+
FileUtils.cp @output_file, copy_name if File.exist?(@output_file)
|
25
26
|
FileUtils.rm_f @output_file
|
26
27
|
File.open_for_write(@output_file) do |file|
|
27
28
|
merge_files(@before_files,file)
|
28
|
-
file
|
29
|
+
write_contents(file,copy_name) if @read_original_contents && File.exist?(copy_name)
|
29
30
|
merge_files(@after_files,file)
|
30
31
|
end
|
32
|
+
FileUtils.rm_f copy_name if File.exist?(copy_name)
|
33
|
+
end
|
34
|
+
|
35
|
+
def write_contents(target_file_stream,file_to_read)
|
36
|
+
File.open_for_read(file_to_read) do|line|
|
37
|
+
target_file_stream << line
|
38
|
+
end
|
31
39
|
end
|
32
40
|
|
33
41
|
def merge_files(source_files,target)
|
34
42
|
source_files.each do|source|
|
35
|
-
target
|
43
|
+
write_contents(target,source)
|
36
44
|
end
|
37
45
|
end
|
38
46
|
|
data/lib/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expansions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|