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 +4 -4
- data/README.md +3 -3
- data/lib/toggle_local_spm/cli.rb +8 -13
- data/lib/toggle_local_spm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f9691f6ecf52ba5b91dc52c36ad66f5f913a71631a146549364db2b1e4d90e96
|
|
4
|
+
data.tar.gz: a062ad1bd784e7cb2d9903fd57851791dfce5536ce500bc6b11e351e56f63eeb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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 (
|
|
89
|
-
|
|
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
|
data/lib/toggle_local_spm/cli.rb
CHANGED
|
@@ -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, :
|
|
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: "📁"
|
|
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 (
|
|
57
|
-
"
|
|
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,
|
|
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,
|
|
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
|
|
279
|
-
return MANAGED_LABELS[:found] if candidate.local_path_known
|
|
274
|
+
return "" unless candidate.tracked
|
|
280
275
|
|
|
281
|
-
MANAGED_LABELS[:
|
|
276
|
+
candidate.local? ? MANAGED_LABELS[:set] : MANAGED_LABELS[:found]
|
|
282
277
|
end
|
|
283
278
|
|
|
284
279
|
# --- Toggling -------------------------------------------------------
|