fs_template 0.1.1 → 0.1.2
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 +8 -8
- data/VERSION +1 -1
- data/fs_template.gemspec +2 -2
- data/lib/fs_template/template_file.rb +6 -0
- data/spec/fs_template_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmJjZDU4ODM0MjgxMzk5Y2U0M2Q3OGQwZmU4OGYxNzA2ZWIzNjE0OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YThjNDQ1OGFkOTY1NmQ2NTkxMzk3MDkyMzlmNWZiNGJiOTFkNTFhNQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmNmNTc3NzhlOTk0NTY5YWE5YzZhNTU0YjUxMzBmODQ4OGVkMjYxMDMwNjlm
|
10
|
+
MTAzNjA1NGVlYWMyZjZlYWFiZDcyYmY3YjAyYTQ5ODc0YzVkNjY0NmU4ZDFk
|
11
|
+
NTM0ODIxNzkzNDMzMTQyZGZiNTA3MDMyZTRlNDhhNjNjYjA3NWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDczNmVkODZlY2NlN2IxN2YzNjg0YTRlNDI3YjlmYTlkODVmZDYxZmE5YTZh
|
14
|
+
YmFjODlmMDNlYTkzMWI3NTllY2M1MTFmZGYwNTI2OWE4NTdmNmFlOTUyZmVm
|
15
|
+
ZTJkNWQ2YmQ5YmEwYzcwNzRhOTRlMGYxYjc3NTcyYjliNDVlZDQ=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/fs_template.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fs_template"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mike Harris"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-11-01"
|
13
13
|
s.description = "fs_template"
|
14
14
|
s.email = "mharris717@gmail.com"
|
15
15
|
s.executables = ["fs_template"]
|
@@ -40,6 +40,12 @@ module FsTemplate
|
|
40
40
|
raise "no change, couldn't find #{params[:after]} in \n#{base_body}"
|
41
41
|
end
|
42
42
|
end
|
43
|
+
elsif params[:action] == 'replace' && params[:base]
|
44
|
+
base_body.gsub(params[:base],body).tap do |subbed|
|
45
|
+
if subbed == base_body
|
46
|
+
raise "no change, couldn't find #{params[:base]} in \n#{base_body}"
|
47
|
+
end
|
48
|
+
end
|
43
49
|
else
|
44
50
|
raise "bad"
|
45
51
|
end
|
data/spec/fs_template_spec.rb
CHANGED
@@ -125,6 +125,24 @@ describe "combine - insert after" do
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
+
describe "combine - replace" do
|
129
|
+
include_context "setup"
|
130
|
+
|
131
|
+
base_file "a.txt","stuff"
|
132
|
+
base_file "b.txt","123\n456\n789"
|
133
|
+
on_top_file "b.txt","<overlay>action: replace\nbase: 456</overlay>abc"
|
134
|
+
|
135
|
+
it 'combined size' do
|
136
|
+
combined.size.should == 2
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'combined file should overwrite' do
|
140
|
+
f = combined.files.find { |x| x.path == "b.txt" }
|
141
|
+
f.body.should == "123\nabc\n789"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
|
128
146
|
describe "combine - top file in new dir" do
|
129
147
|
include_context "setup"
|
130
148
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fs_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Harris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mharris_ext
|