fig 0.1.18 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fig/environment.rb +8 -1
- data/spec/fig_spec.rb +29 -0
- metadata +4 -4
data/lib/fig/environment.rb
CHANGED
@@ -131,7 +131,14 @@ module Fig
|
|
131
131
|
return value unless base_package && base_package.package_name
|
132
132
|
file = value.gsub(/\@/, base_package.directory)
|
133
133
|
if @retrieve_vars.member?(name)
|
134
|
-
|
134
|
+
# A '//' in the source file's path tells us to preserve path information
|
135
|
+
# after the '//' when doing a retrieve.
|
136
|
+
if file.split('//').size > 1
|
137
|
+
preserved_path = file.split('//').last
|
138
|
+
target = File.join(@retrieve_vars[name].gsub(/\[package\]/, base_package.package_name), preserved_path)
|
139
|
+
else
|
140
|
+
target = File.join(@retrieve_vars[name].gsub(/\[package\]/, base_package.package_name), File.basename(file))
|
141
|
+
end
|
135
142
|
unless @os.exist?(target) && @os.mtime(target) >= @os.mtime(file)
|
136
143
|
@os.log_info("retrieving #{target}")
|
137
144
|
@os.copy(file, target)
|
data/spec/fig_spec.rb
CHANGED
@@ -199,6 +199,35 @@ describe "Fig" do
|
|
199
199
|
File.read("tmp/lib2/foo/hello").should == "some library"
|
200
200
|
end
|
201
201
|
|
202
|
+
it "retrieve preserves the path after '//' when copying files into your project directory" do
|
203
|
+
FileUtils.rm_rf(FIG_HOME)
|
204
|
+
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
205
|
+
FileUtils.rm_rf("tmp")
|
206
|
+
FileUtils.mkdir_p("tmp/include")
|
207
|
+
File.open("tmp/include/hello.h", "w") { |f| f << "a header file" }
|
208
|
+
File.open("tmp/include/hello2.h", "w") { |f| f << "another header file" }
|
209
|
+
input = <<-END
|
210
|
+
resource tmp/include/hello.h
|
211
|
+
resource tmp/include/hello2.h
|
212
|
+
config default
|
213
|
+
append INCLUDE=@/tmp//include/hello.h
|
214
|
+
append INCLUDE=@/tmp//include/hello2.h
|
215
|
+
end
|
216
|
+
END
|
217
|
+
fig('--publish foo/1.2.3', input)
|
218
|
+
|
219
|
+
input = <<-END
|
220
|
+
retrieve INCLUDE->tmp/include2/[package]
|
221
|
+
config default
|
222
|
+
include foo/1.2.3
|
223
|
+
end
|
224
|
+
END
|
225
|
+
fig('-u', input)
|
226
|
+
|
227
|
+
File.read("tmp/include2/foo/include/hello.h").should == "a header file"
|
228
|
+
File.read("tmp/include2/foo/include/hello2.h").should == "another header file"
|
229
|
+
end
|
230
|
+
|
202
231
|
it "package multiple resources" do
|
203
232
|
FileUtils.rm_rf(FIG_HOME)
|
204
233
|
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 19
|
10
|
+
version: 0.1.19
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthew Foemmel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-01 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|