expansions 0.1.4 → 0.1.5

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.
@@ -21,30 +21,18 @@ module Expansions
21
21
  end
22
22
 
23
23
  def run
24
- copy_name = "_copy_of#{File.basename(@output_file)}"
25
- FileUtils.cp @output_file,copy_name if File.exist?(@output_file)
24
+ original_contents = File.read_all_text(@output_file)
26
25
  FileUtils.rm_f @output_file
27
26
  File.open_for_write(@output_file) do |file|
28
- do_merge copy_name,file
27
+ merge_files(@before_files,file)
28
+ file.write original_contents if @read_original_contents
29
+ merge_files(@after_files,file)
29
30
  end
30
- FileUtils.rm copy_name
31
- end
32
-
33
- def do_merge(temp_file,target_file)
34
- merge_files(@before_files,target_file)
35
- if @read_original_contents && File.exist?(temp_file)
36
- File.open_for_read temp_file do|line|
37
- target_file << line
38
- end
39
- end
40
- merge_files(@after_files,target_file)
41
31
  end
42
32
 
43
33
  def merge_files(source_files,target)
44
34
  source_files.each do|source|
45
- File.open_for_read source do|line|
46
- target << line
47
- end
35
+ target.write File.read_all_text(source)
48
36
  end
49
37
  end
50
38
 
@@ -1,3 +1,3 @@
1
1
  module Expansions
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
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
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: