fig 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/fig/repository.rb +4 -2
  2. data/spec/fig_spec.rb +18 -1
  3. metadata +4 -4
@@ -45,6 +45,8 @@ module Fig
45
45
  def publish_package(package_statements, package_name, version_name, local_only)
46
46
  temp_dir = temp_dir_for_package(package_name, version_name)
47
47
  @os.clear_directory(temp_dir)
48
+ local_dir = local_dir_for_package(package_name, version_name)
49
+ @os.clear_directory(local_dir)
48
50
  fig_file = File.join(temp_dir, ".fig")
49
51
  content = bundle_resources(package_statements).map do |statement|
50
52
  if statement.is_a?(Publish)
@@ -64,9 +66,9 @@ module Fig
64
66
  archive_local = statement.url
65
67
  end
66
68
  @os.upload(archive_local, archive_remote, @remote_repository_user) unless local_only
67
- @os.copy(archive_local, local_dir_for_package(package_name, version_name) + "/" + archive_name)
69
+ @os.copy(archive_local, local_dir + "/" + archive_name)
68
70
  if statement.is_a?(Archive)
69
- @os.unpack_archive(local_dir_for_package(package_name, version_name), archive_name)
71
+ @os.unpack_archive(local_dir, archive_name)
70
72
  end
71
73
  statement.class.new(archive_name).unparse('')
72
74
  else
data/spec/fig_spec.rb CHANGED
@@ -173,7 +173,7 @@ describe "Fig" do
173
173
  fail unless system "chmod +x tmp/bin/hello"
174
174
  fig('--publish-local foo/1.2.3 --resource tmp/bin/hello --append PATH=@/tmp/bin')
175
175
  fail if File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
176
- fail unless fig('-m -i foo/1.2.3 -- hello')[0].should == 'bar'
176
+ fig('-m -i foo/1.2.3 -- hello')[0].should == 'bar'
177
177
  end
178
178
 
179
179
  it "retrieve resource" do
@@ -225,4 +225,21 @@ describe "Fig" do
225
225
  File.read("tmp/lib2/foo/hello").should == "some library"
226
226
  File.read("tmp/lib2/foo/hello2").should == "some other library"
227
227
  end
228
+
229
+ it "update local packages if they already exist" do
230
+ FileUtils.rm_rf(FIG_HOME)
231
+ FileUtils.rm_rf(FIG_REMOTE_DIR)
232
+ FileUtils.mkdir_p("tmp/bin")
233
+ File.open("tmp/bin/hello", "w") { |f| f << "echo sheep" }
234
+ fail unless system "chmod +x tmp/bin/hello"
235
+ fig('--publish-local foo/1.2.3 --resource tmp/bin/hello --append PATH=@/tmp/bin')
236
+ fail if File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
237
+ fig('-m -i foo/1.2.3 -- hello')[0].should == 'sheep'
238
+
239
+ File.open("tmp/bin/hello", "w") { |f| f << "echo cheese" }
240
+ fail unless system "chmod +x tmp/bin/hello"
241
+ fig('--publish-local foo/1.2.3 --resource tmp/bin/hello --append PATH=@/tmp/bin')
242
+ fail if File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
243
+ fig('-m -i foo/1.2.3 -- hello')[0].should == 'cheese'
244
+ end
228
245
  end
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: 57
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 17
10
- version: 0.1.17
9
+ - 18
10
+ version: 0.1.18
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-07-30 00:00:00 +01:00
18
+ date: 2010-08-02 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency