fig 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -130,7 +130,7 @@ grammar Fig
130
130
  end
131
131
 
132
132
  rule url
133
- (value:[a-zA-Z0-9:/\-\\._]+ ws) / ('"' value:[a-zA-Z0-9:/\-\\._]+ '"' ws)
133
+ (value:[a-zA-Z0-9:/\-\\._\*]+ ws) / ('"' value:[a-zA-Z0-9:/\-\\._]+ '"' ws)
134
134
  end
135
135
 
136
136
  rule ws
@@ -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 = "fig-download #{timestamp} #{uri.path}"
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.copy_file(source, target)
184
+ FileUtils.cp_r(source, target)
185
185
  end
186
186
 
187
187
  def move_file(dir, from, to)
@@ -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
@@ -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: 49
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 21
10
- version: 0.1.21
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: 2010-11-22 00:00:00 -06:00
18
+ date: 2011-01-26 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency