toggle-local-spm 3.0.1 → 3.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: 32196698f6117197a108c6250d2adb35b2c3002166facfe7fb9298882fb0cc6d
4
- data.tar.gz: 9eeaf34c8e8414ef256bb8a6874397f9ca072abf2824e886ca2e3af67b242452
3
+ metadata.gz: f9691f6ecf52ba5b91dc52c36ad66f5f913a71631a146549364db2b1e4d90e96
4
+ data.tar.gz: a062ad1bd784e7cb2d9903fd57851791dfce5536ce500bc6b11e351e56f63eeb
5
5
  SHA512:
6
- metadata.gz: 9259e3b22e9f7970d5bc752311fa3551fdd4b1d4a654116d19eb19b09ca625109a9b5578bac842ace1f374d481c7e3e465dd2eea92fde46ac5f834ad97318ffb
7
- data.tar.gz: c6224ec033fee21369ec52e15a31f59e22a530f131d509c91be4ac281ac4a88496b60c66c87581cee7f7daeaba7834f2bdafb9d3974f1540a486a011860ef417
6
+ metadata.gz: afd83f5a122b1f0c51a4ea075b99e122daf8a13f2d31b209d9b5680defd71799bf5b61872d4431e629bfecd987962acce293e3e3342cd90f8f3d4984f0a1cebe
7
+ data.tar.gz: fc4c558a7d77f11569f9990b4e972eb131bb81a3c2dd47ac7f51bdea35ade8e762d00706dcfb010baac8ba7b9c73f156fc12b28255310488e0293b2a363a5d39
data/README.md CHANGED
@@ -80,13 +80,13 @@ the Managed column, e.g.:
80
80
  ```
81
81
  # Package Type State Managed
82
82
  1 my-shared-ios 🎯 direct 📁 local ✅
83
- 2 DeviceKit 🎯 direct 🌏 remote ⚠️
83
+ 2 DeviceKit 🎯 direct 🌏 remote
84
84
  3 my-model-lib 🧩 indirect 🌏 remote 📁
85
85
 
86
86
  Legend:
87
87
  ✅ Local mock set
88
- 📁 Mock not set. Mock found (localPath in spm-local-overrides.json exists)
89
- ⚠️ Mock not set. Mock not found (localPath in spm-local-overrides.json not existing)
88
+ 📁 Mock not set. Mock found (recorded in spm-local-overrides.json)
89
+ Blank no record for this dependency in spm-local-overrides.json
90
90
  ```
91
91
 
92
92
  Each package toggles independently based on what's currently wired up in the
@@ -41,7 +41,7 @@ module ToggleLocalSpm
41
41
  LocalRef = Xcodeproj::Project::Object::XCLocalSwiftPackageReference
42
42
  ProductDependency = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
43
43
 
44
- Candidate = Struct.new(:name, :ref, :type, :resolved_entry, :local_path_known) do
44
+ Candidate = Struct.new(:name, :ref, :type, :resolved_entry, :tracked) do
45
45
  def local?
46
46
  ref.is_a?(LocalRef)
47
47
  end
@@ -50,11 +50,11 @@ module ToggleLocalSpm
50
50
  TYPE_LABELS = { "direct" => "🎯 direct", "indirect" => "🧩 indirect" }.freeze
51
51
  STATE_LABELS = { local: "📁 local", remote: "🌏 remote" }.freeze
52
52
 
53
- MANAGED_LABELS = { set: "✅", found: "📁", not_found: "⚠️" }.freeze
53
+ MANAGED_LABELS = { set: "✅", found: "📁" }.freeze
54
54
  MANAGED_LEGEND = [
55
55
  "#{MANAGED_LABELS[:set]} Local mock set",
56
- "#{MANAGED_LABELS[:found]} Mock not set. Mock found (localPath in spm-local-overrides.json exists)",
57
- "#{MANAGED_LABELS[:not_found]} Mock not set. Mock not found (localPath in spm-local-overrides.json not existing)"
56
+ "#{MANAGED_LABELS[:found]} Mock not set. Mock found (recorded in spm-local-overrides.json)",
57
+ " Blank no record for this dependency in spm-local-overrides.json"
58
58
  ].freeze
59
59
 
60
60
  def self.run(argv)
@@ -173,20 +173,16 @@ module ToggleLocalSpm
173
173
  direct = refs.map do |ref|
174
174
  name = ref_name(ref)
175
175
  type = state.dig(name, "type") || "direct"
176
- Candidate.new(name, ref, type, nil, local_path_known?(state, name))
176
+ Candidate.new(name, ref, type, nil, state.key?(name))
177
177
  end
178
178
 
179
179
  resolved = load_resolved_packages(xcodeproj_path)
180
180
  indirect = resolved.reject { |name, _| direct.any? { |c| c.name.casecmp(name).zero? } }
181
- .map { |name, info| Candidate.new(name, nil, "indirect", info, local_path_known?(state, name)) }
181
+ .map { |name, info| Candidate.new(name, nil, "indirect", info, state.key?(name)) }
182
182
 
183
183
  direct + indirect
184
184
  end
185
185
 
186
- def local_path_known?(state, name)
187
- !!state.dig(name, "localPath")
188
- end
189
-
190
186
  def resolved_file_path(xcodeproj_path)
191
187
  workspace = find_workspace_path
192
188
  if workspace
@@ -275,10 +271,9 @@ module ToggleLocalSpm
275
271
  end
276
272
 
277
273
  def managed_label_for(candidate)
278
- return MANAGED_LABELS[:set] if candidate.local?
279
- return MANAGED_LABELS[:found] if candidate.local_path_known
274
+ return "" unless candidate.tracked
280
275
 
281
- MANAGED_LABELS[:not_found]
276
+ candidate.local? ? MANAGED_LABELS[:set] : MANAGED_LABELS[:found]
282
277
  end
283
278
 
284
279
  # --- Toggling -------------------------------------------------------
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ToggleLocalSpm
4
- VERSION = "3.0.1"
4
+ VERSION = "3.0.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toggle-local-spm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sushant Verma