autobuild 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d07251a9467505108e7d4ffa2a83480e77b4051
4
- data.tar.gz: f9d440c442f763d121bb589810fb2e97210911c7
3
+ metadata.gz: 6091962c49f811cded44e5f054555f732e33ffc9
4
+ data.tar.gz: 1bacc77f147d5e195035cb395adc4c11f49112a4
5
5
  SHA512:
6
- metadata.gz: 11958c9d1bfa46c8d3abfe37dfe4e414f316b7e0162cafdcf0abda4228e27ed902b02bc2ff942ef42ba41996878a6c18eb38d82d2708b7ee2c808d073fd85a5b
7
- data.tar.gz: 78b12476fd6c0a16573db0a46f6e4e500dd42da24fd8471440b5487ca00236f51e003afa5c56b8fd1a6d5b449ae4a04420e5e5f95b3c0ffeb816d654fa37423b
6
+ metadata.gz: acf99d4e1f49fd393f71c6482b67c35283d68f95b1ae12326abd5ed139aa77c3e48965400e3333401494ae0d45a98dd61032987d2ee306890b3d9523e8e1cfcb
7
+ data.tar.gz: 314c0ba8e3e9ffac67f027b8176785f8ce345551f78f114d27c50634668fb230c678908d3a48f14af7e1cdfe8898a713e7e6b6c39b5157f3dfb191e4a3f10431
@@ -286,7 +286,7 @@ module Autobuild
286
286
  # also used to infer the mode
287
287
  # [:mode] The unpack mode: one of Zip, Bzip, Gzip or Plain, this is
288
288
  # usually automatically inferred from the filename
289
- def initialize(url, options)
289
+ def initialize(url, options = Hash.new)
290
290
  sourceopts, options = Kernel.filter_options options,
291
291
  :source_id, :repository_id, :filename, :mode
292
292
  super(options)
@@ -302,13 +302,13 @@ module Autobuild
302
302
 
303
303
  # Changes the URL from which we should pick the archive
304
304
  def relocate(url, options = Hash.new)
305
- parsed_url = URI.parse(url)
305
+ parsed_url = URI.parse(url).normalize
306
306
  @url = parsed_url
307
307
  if !VALID_URI_SCHEMES.include?(@url.scheme)
308
308
  raise ConfigException, "invalid URL #{@url} (local files must be prefixed with file://)"
309
309
  end
310
- @repository_id = options[:repository_id] || parsed_url
311
- @source_id = options[:source_id] || parsed_url
310
+ @repository_id = options[:repository_id] || parsed_url.to_s
311
+ @source_id = options[:source_id] || parsed_url.to_s
312
312
 
313
313
  @filename = options[:filename] || @filename || File.basename(url).gsub(/\?.*/, '')
314
314
 
@@ -426,7 +426,9 @@ module Autobuild
426
426
  rescue OpenURI::HTTPError
427
427
  raise Autobuild::PackageException.new(package.name, :import)
428
428
  rescue SubcommandFailed
429
- FileUtils.rm_f cachefile
429
+ if cachefile != url.path
430
+ FileUtils.rm_f cachefile
431
+ end
430
432
  raise
431
433
  end
432
434
  end
@@ -82,6 +82,7 @@ class Importer
82
82
  # two git importers that point to the same repository but different branches
83
83
  # would have the same repository_id but different source_id
84
84
  #
85
+ # @return [String]
85
86
  # @see source_id
86
87
  attr_reader :repository_id
87
88
 
@@ -92,6 +93,7 @@ class Importer
92
93
  # point to the same repository but different branches would have the same
93
94
  # repository_id but different source_id
94
95
  #
96
+ # @return [String]
95
97
  # @see repository_id
96
98
  attr_reader :source_id
97
99
 
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.9.1" unless defined? Autobuild::VERSION
2
+ VERSION = "1.9.2" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
 
@@ -25,6 +25,25 @@ class TC_TarImporter < Minitest::Test
25
25
  assert_equal(TarImporter::Bzip, TarImporter.filename_to_mode('tarfile.tar.bz2'))
26
26
  end
27
27
 
28
+ def test_it_sets_the_repository_id_to_the_normalized_URL
29
+ importer = TarImporter.new "FILE://test/file"
30
+ assert_equal "file://test/file", importer.repository_id.to_str
31
+ end
32
+
33
+ def test_it_sets_the_source_id_to_the_normalized_URL
34
+ importer = TarImporter.new "FILE://test/file"
35
+ assert_equal "file://test/file", importer.source_id.to_str
36
+ end
37
+
38
+ def test_it_does_not_delete_a_locally_specified_archive_on_error
39
+ dummy_tar = File.join(@datadir, "dummy.tar")
40
+ FileUtils.touch dummy_tar
41
+ importer = TarImporter.new "file://#{dummy_tar}"
42
+ pkg = Package.new 'tarimport'
43
+ assert_raises(Autobuild::SubcommandFailed) { importer.checkout(pkg) }
44
+ assert File.file?(dummy_tar)
45
+ end
46
+
28
47
  def test_tar_valid_url
29
48
  assert_raises(ConfigException) {
30
49
  TarImporter.new 'ccc://localhost/files/tarimport.tar.gz', :cachedir => @cachedir
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2015-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake