xccache 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31a523d3926f239135aaaebcc8c6cabe18da2a43e251e83edb486b13c22630e9
4
- data.tar.gz: 2997cc54f7b5a4c2395181d29f1042433b4d24d38aef98d8053555d52e4c518c
3
+ metadata.gz: 2357c61b242803e69f54fe2b9a4db8eef00deabb636dbd98e84a808bd6c3d56a
4
+ data.tar.gz: b4d9615136cb599bff14e73ef51472c6b6d3838acd5518d6e17ce9446275de4a
5
5
  SHA512:
6
- metadata.gz: 3d4d9014951e0e99cbfa57594831872404289522cf4943af250cba55e4b70f00567caa6d882b65d84b8825840aa279e0e6248dabfdc2a3e72ea8febd772ef532
7
- data.tar.gz: d0e4eda645edc09208c1a097eae6959145171975b48bcb778b02f3d0df22d99332fd1a1b326fafbfe425cdec0d9e45d3b07cfe8954482fddfaaf09f9be2d6f7a
6
+ metadata.gz: b353117fdc74f92fe4c091d94936b55548b7f4b8450441dd51ebe6728b4513960af76f0278095b7f777aec0189c5c371c8a268a10092d1d522494b7da26e4f74
7
+ data.tar.gz: ab9c2d5bb982bb0d7c86703ca4d1ca84ab1a3b8598eb671400a0eee47ac1caf26ff54cf9d2567c47d35702eca071d909b648243d2fa194f0b982b3d879ec7cbb
@@ -28,16 +28,32 @@ module XCCache
28
28
  end
29
29
 
30
30
  def print_stats
31
- hit, missed, ignored = %i[hit missed ignored].map { |type| get_cache_data(type) }
32
- total_count = cache_data.count
33
- UI.message <<~DESC
34
- -------------------------------------------------------------------
35
- Cache stats
36
- Hit (#{hit.count}/#{total_count}): #{hit.to_s.green.dark}
37
- Missed (#{missed.count}/#{total_count}): #{missed.to_s.yellow.dark}
38
- Ignored (#{ignored.count}/#{total_count}): #{ignored.to_s.dark}
39
- -------------------------------------------------------------------
40
- DESC
31
+ verbose = Config.instance.verbose?
32
+ colors = { :hit => "green", :missed => "yellow" }
33
+ descs = %i[hit missed ignored].to_h do |type|
34
+ colorize = proc { |s| colors.key?(type) ? s.send(colors[type]).dark : s.dark }
35
+ items = get_cache_data(type)
36
+ percent = cache_data.count.positive? ? items.count.to_f / cache_data.count * 100 : 0
37
+ desc = "#{type} #{percent.round}% (#{items.count}/#{cache_data.count})"
38
+ desc = desc.capitalize if verbose
39
+ desc = "#{desc} #{colorize.call(items.to_s)}" if verbose && !items.empty?
40
+ [type, desc]
41
+ end
42
+ if verbose
43
+ UI.info <<~DESC
44
+ -------------------------------------------------------------------
45
+ Cache stats
46
+ #{descs.values.map { |s| "• #{s}" }.join("\n")}
47
+ -------------------------------------------------------------------
48
+ DESC
49
+ else
50
+ UI.info <<~DESC
51
+ -------------------------------------------------------------------
52
+ Cache stats: #{descs.values.join(', ')}
53
+ To see the full stats, use --verbose in the xccache command
54
+ -------------------------------------------------------------------
55
+ DESC
56
+ end
41
57
  end
42
58
 
43
59
  def get_cache_data(type)
@@ -10,7 +10,7 @@ module XCCache
10
10
  end
11
11
 
12
12
  def targets_to_build(options)
13
- items = options[:targets] || []
13
+ items = (options[:targets] || []).map { |x| File.basename(x) }
14
14
  items = config.cachemap.missed.map { |x| File.basename(x) } if items.empty?
15
15
  targets = items.map { |x| umbrella_pkg.get_target(x) }
16
16
 
@@ -87,7 +87,8 @@ module XCCache
87
87
 
88
88
  def platforms_for_project(project)
89
89
  project
90
- .targets.map { |t| [t.platform_name.to_s, t.deployment_target] }
90
+ .targets.select(&:platform_name)
91
+ .map { |t| [t.platform_name.to_s, t.deployment_target] }
91
92
  .sort.reverse.to_h # sort descendingly -> min value is picked for the hash
92
93
  end
93
94
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xccache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thuyen Trinh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-03 00:00:00.000000000 Z
11
+ date: 2025-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide