expansions 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,18 +21,30 @@ module Expansions
21
21
  end
22
22
 
23
23
  def run
24
- original_contents = File.read_all_text(@output_file)
24
+ copy_name = "_copy_of#{File.basename(@output_file)}"
25
+ FileUtils.cp @output_file,copy_name
25
26
  FileUtils.rm_f @output_file
26
27
  File.open_for_write(@output_file) do |file|
27
- merge_files(@before_files,file)
28
- file.write original_contents if @read_original_contents
29
- merge_files(@after_files,file)
28
+ do_merge copy_name,file
30
29
  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
36
+ File.open_for_read temp_file do|line|
37
+ target_file << line
38
+ end
39
+ end
40
+ merge_files(@after_files,target_file)
31
41
  end
32
42
 
33
43
  def merge_files(source_files,target)
34
44
  source_files.each do|source|
35
- target.write File.read_all_text(source)
45
+ File.open_for_read source do|line|
46
+ target << line
47
+ end
36
48
  end
37
49
  end
38
50
 
data/lib/core/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Expansions
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
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.2
4
+ version: 0.1.3
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-03-30 00:00:00.000000000 Z
12
+ date: 2012-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard