carthage_cache 0.5.0 → 0.6.0

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: 66392e9c9f8b79620a85307d4c543f3f6ff4204c
4
- data.tar.gz: 04ca97e2e59edeb04445c9ae7a36abcb972e667d
3
+ metadata.gz: da15d9b92179c1ef699d0a5ed85869629ccee8db
4
+ data.tar.gz: ef4d5a77a49672356342377fc5689f7f1d06c50f
5
5
  SHA512:
6
- metadata.gz: 4a39c50a039f20336f3e4b6aa8c07a5e46a93da7dffd40ee5198fc79b41feb3edec343ff34dbb33d481625a05c8106e8e98f0464c5d39de7f05d963f63dace33
7
- data.tar.gz: 715a6a13f71f284a854051a24fb64624b265b6c09c0b7e5acbe758129205fb3211bee9f945df60443c8e84c19f386fe2ea03796880c1ec13ced910f7354ffa09
6
+ metadata.gz: d9d5d9f3b83ff9d91de56782e18d175a245563a3e9ae7a2ee4469b0cf2207c8f44c2a5be68c7069182285903958e057dc8c93e6ec176ce2b40b0c9bfaaf651b3
7
+ data.tar.gz: 00aeac5ac3d4a6539a6f5b5c2ab9f22462cfcd05636ccccb17a010e33ad12610403332ede8120f2ee7f74a4fa8586b2abd20ed116e7c1a795544a4dc4d68ef09
data/exe/carthage_cache CHANGED
@@ -55,10 +55,16 @@ command :publish do |c|
55
55
  c.option '-f', '--force', 'Forces to create a new archive even if an archive already exist.'
56
56
  c.option '-p', '--prune-build-directory', 'Removes unused frameworks from build directory.'
57
57
  c.option '-w', '--prune-white-list PRUNE_WHITE_LIST', String, 'Path to a YAML file containing the prune white list.'
58
+ c.option '-x', '--platforms PLATFORMS', String, 'A comma separated list of platforms that should be archived. Platforms not present in this list won\'t be archived'
58
59
  c.action do |args, options|
59
60
  options.default force: false, prune: false
60
61
  app = CarthageCache::Application.new(args.first || ".", verbose, config)
61
- app.create_archive(options.force, options.prune, options.prune_white_list)
62
+ platforms = options.platforms.split(",") if options.platforms
63
+ if platforms.empty?
64
+ puts "If you pass -x or --platforms option the you must specify at least one platform."
65
+ exit 1
66
+ end
67
+ app.create_archive(options.force, options.prune_build_directory, options.prune_white_list, platforms)
62
68
  end
63
69
  end
64
70
 
@@ -35,10 +35,10 @@ module CarthageCache
35
35
  end
36
36
  end
37
37
 
38
- def create_archive(force = false, prune = false, prune_white_list = nil)
38
+ def create_archive(force = false, prune = false, prune_white_list = nil, platforms = nil)
39
39
  if force || !archive_exist?
40
40
  prune_build_directory(prune_white_list) if prune
41
- archive_builder.build
41
+ archive_builder.build(platforms)
42
42
  end
43
43
  end
44
44
 
@@ -14,8 +14,8 @@ module CarthageCache
14
14
  @project = project
15
15
  end
16
16
 
17
- def build
18
- archive_path = archive
17
+ def build(platforms = nil)
18
+ archive_path = archive(platforms)
19
19
  upload_archive(archive_path)
20
20
  # TODO check if some old archives can be deleted
21
21
  # I would store the last N archives and then delete
@@ -24,14 +24,11 @@ module CarthageCache
24
24
 
25
25
  private
26
26
 
27
- def archive
28
- # TODO Check() that only dependencies that appear
29
- # in Cartfile.resolved file are going to be archived.
30
- # This will avoid saving unused dependencies into
31
- # the archive.
27
+ def archive(platforms = nil)
32
28
  archive_path = File.join(project.tmpdir, project.archive_filename)
33
29
  terminal.puts "Archiving Carthage build directory."
34
- archiver.archive(project.carthage_build_directory, archive_path)
30
+ filter_block = ->(platform) { platforms.map(&:downcase).include?(platform.downcase) } if platforms
31
+ archiver.archive(project.carthage_build_directory, archive_path, &filter_block)
35
32
  archive_path
36
33
  end
37
34
 
@@ -8,8 +8,9 @@ module CarthageCache
8
8
  @executor = executor
9
9
  end
10
10
 
11
- def archive(archive_path, destination_path)
11
+ def archive(archive_path, destination_path, &filter_block)
12
12
  files = Dir.entries(archive_path).select { |x| !x.start_with?(".") }
13
+ files = files.select(&filter_block) if filter_block
13
14
  executor.execute("cd #{archive_path} && zip -r -X #{File.expand_path(destination_path)} #{files.join(' ')} > /dev/null")
14
15
  end
15
16
 
@@ -20,10 +20,11 @@ module CarthageCache
20
20
  if delete_framework?(framework_path, white_list)
21
21
  terminal.vputs "Deleting '#{framework_path}' because is not longer needed."
22
22
  FileUtils.rm_r(framework_path)
23
- FileUtils.rm_r("#{framework_path}.dSYM")
24
- # TODO delete corresponding .bcsymbolmap file
25
23
  end
26
24
  end
25
+
26
+ symbol_table_files.each { |x| FileUtils.rm_r(x) }
27
+ dsym_files.each { |x| FileUtils.rm_r(x) }
27
28
  end
28
29
 
29
30
  private
@@ -41,6 +42,14 @@ module CarthageCache
41
42
  Dir[File.join(build_directory, "/**/*.framework")]
42
43
  end
43
44
 
45
+ def symbol_table_files
46
+ Dir[File.join(build_directory, "/**/*.bcsymbolmap")]
47
+ end
48
+
49
+ def dsym_files
50
+ Dir[File.join(build_directory, "/**/*.dSYM")]
51
+ end
52
+
44
53
  def framework_name(framework_path)
45
54
  Pathname.new(framework_path).basename(".framework").to_s
46
55
  end
@@ -1,3 +1,3 @@
1
1
  module CarthageCache
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carthage_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guido Marucci Blas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-26 00:00:00.000000000 Z
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler