fig 0.1.21 → 0.1.22
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/fig/grammar.treetop +1 -1
- data/lib/fig/os.rb +2 -2
- data/lib/fig/repository.rb +8 -0
- data/spec/fig_spec.rb +24 -0
- metadata +4 -4
data/lib/fig/grammar.treetop
CHANGED
data/lib/fig/os.rb
CHANGED
@@ -104,7 +104,7 @@ module Fig
|
|
104
104
|
# TODO need better way to do conditional download
|
105
105
|
# timestamp = `ssh #{uri.user + '@' if uri.user}#{uri.host} "ruby -e 'puts File.mtime(\\"#{uri.path}\\").to_i'"`.to_i
|
106
106
|
timestamp = File.exist?(path) ? File.mtime(path).to_i : 0
|
107
|
-
cmd =
|
107
|
+
cmd = `which fig-download`.strip + " #{timestamp} #{uri.path}"
|
108
108
|
ssh_download(uri.user, uri.host, path, cmd)
|
109
109
|
else
|
110
110
|
raise "Unknown protocol: #{url}"
|
@@ -181,7 +181,7 @@ module Fig
|
|
181
181
|
|
182
182
|
def copy(source, target)
|
183
183
|
FileUtils.mkdir_p(File.dirname(target))
|
184
|
-
FileUtils.
|
184
|
+
FileUtils.cp_r(source, target)
|
185
185
|
end
|
186
186
|
|
187
187
|
def move_file(dir, from, to)
|
data/lib/fig/repository.rb
CHANGED
@@ -91,6 +91,7 @@ module Fig
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
if resources.size > 0
|
94
|
+
resources = expand_globs_from(resources)
|
94
95
|
file = "resources.tar.gz"
|
95
96
|
@os.create_archive(file, resources)
|
96
97
|
new_package_statements.unshift(Archive.new(file))
|
@@ -195,6 +196,13 @@ module Fig
|
|
195
196
|
end
|
196
197
|
end
|
197
198
|
|
199
|
+
# 'resources' is an Array of filenames: ['tmp/foo/file1', 'tmp/foo/*.jar']
|
200
|
+
def expand_globs_from(resources)
|
201
|
+
expanded_files = []
|
202
|
+
resources.each {|f| expanded_files.concat(Dir.glob(f))}
|
203
|
+
expanded_files
|
204
|
+
end
|
205
|
+
|
198
206
|
def is_url?(url)
|
199
207
|
not (/ftp:\/\/|http:\/\/|file:\/\/|ssh:\/\// =~ url).nil?
|
200
208
|
end
|
data/spec/fig_spec.rb
CHANGED
@@ -255,6 +255,30 @@ describe "Fig" do
|
|
255
255
|
File.read("tmp/lib2/foo/hello2").should == "some other library"
|
256
256
|
end
|
257
257
|
|
258
|
+
it "packages multiple resources with wildcards" do
|
259
|
+
FileUtils.rm_rf(FIG_HOME)
|
260
|
+
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
261
|
+
FileUtils.rm_rf("tmp")
|
262
|
+
FileUtils.mkdir_p("tmp/lib")
|
263
|
+
File.open("tmp/lib/foo.jar", "w") { |f| f << "some library" }
|
264
|
+
File.open("tmp/lib/bar.jar", "w") { |f| f << "some other library" }
|
265
|
+
input = <<-END
|
266
|
+
resource tmp/**/*.jar
|
267
|
+
config default
|
268
|
+
append FOOPATH=@/tmp/lib/foo.jar
|
269
|
+
end
|
270
|
+
END
|
271
|
+
fig('--publish foo/1.2.3', input)
|
272
|
+
input = <<-END
|
273
|
+
retrieve FOOPATH->tmp/lib2/[package]
|
274
|
+
config default
|
275
|
+
include foo/1.2.3
|
276
|
+
end
|
277
|
+
END
|
278
|
+
fig('-m', input)
|
279
|
+
File.read("tmp/lib2/foo/foo.jar").should == "some library"
|
280
|
+
end
|
281
|
+
|
258
282
|
it "update local packages if they already exist" do
|
259
283
|
FileUtils.rm_rf(FIG_HOME)
|
260
284
|
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: 55
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 22
|
10
|
+
version: 0.1.22
|
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:
|
18
|
+
date: 2011-01-26 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|