synx 0.0.51 → 0.0.52
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 +8 -8
- data/bin/synx +3 -2
- data/lib/synx/pbx_group.rb +3 -10
- data/lib/synx/pbx_variant_group.rb +21 -4
- data/lib/synx/project.rb +14 -1
- data/lib/synx/tabber.rb +12 -2
- data/lib/synx/version.rb +1 -1
- data/spec/dummy/dummy.xcodeproj/project.pbxproj +19 -0
- data/spec/dummy/dummy/en.lproj/Localizable.strings +7 -0
- data/spec/synx/expected_file_structure.yml +3 -1
- data/spec/synx/expected_group_structure.yml +2 -0
- data/spec/synx/project_spec.rb +26 -3
- data/spec/synx/tabber_spec.rb +8 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzdhZjY3ZjRkNjJkOTgzOTIzYTE1YmI2ZTBhY2JmNjMxNjA3NTU2Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjFmMzIxZjM1MjYzZTYzYWRjYzg5YTY2M2I4ZjA2NDY1YTQ1NThiMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2RhN2E4MmUwYjViNGQ0ZDgzYjM1MzVhN2M3NDE1MTFlM2FhOGE2MmZmOTQ0
|
10
|
+
YmJjMzJlNDM1ZTNkMGIyZjY3MGI1NTVlYWY4NGFlMDljYmVlYzA0OGEzM2Mz
|
11
|
+
ZWZmN2I1MzNjNWViN2NiYmJlODgyZTRiN2RlYWQ1N2FkNDJlZjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjMxMWMwNWY2OGEyNzMyZWRiN2Y3N2Y1NTRjODY2NjEzNTMwMjZlMjhkM2Qw
|
14
|
+
N2UyZTJmN2Y3MDYxMDA2YWE2YjFlM2MwMGMyN2MzZDlhYjdkOTVjOTM0YTM3
|
15
|
+
ODc5ZDI3Mjg2ZGE0OTY4ZTMzYTI0OGY1YzkzZTc5YjgwZDUyMjg=
|
data/bin/synx
CHANGED
@@ -8,11 +8,12 @@ Clamp do
|
|
8
8
|
parameter "xcodeproj", "Path to the xcodeproj", :attribute_name => :xcodeproj_path
|
9
9
|
option ["--prune", "-p"], :flag, "remove source files and image resources that are not referenced by the the xcode project"
|
10
10
|
option "--no-default-exclusions", :flag, "doesn't use the default exclusions of /Libraries, /Frameworks, and /Products"
|
11
|
+
option ["--quiet", "-q"], :flag, "silence all output"
|
11
12
|
option ["--exclusion", "-e"], "EXCLUSION", "ignore an Xcode group while syncing", :multivalued => true
|
12
13
|
|
13
14
|
def execute
|
14
15
|
project = Synx::Project.open(xcodeproj_path)
|
15
|
-
project.sync(:prune => prune?, :no_default_exclusions => no_default_exclusions?, :group_exclusions => exclusion_list)
|
16
|
+
project.sync(:prune => prune?, :quiet => quiet?, :no_default_exclusions => no_default_exclusions?, :group_exclusions => exclusion_list)
|
16
17
|
end
|
17
18
|
|
18
|
-
end
|
19
|
+
end
|
data/lib/synx/pbx_group.rb
CHANGED
@@ -33,9 +33,9 @@ module Xcodeproj
|
|
33
33
|
else
|
34
34
|
Synx::Tabber.puts "#{basename}/".green
|
35
35
|
Synx::Tabber.increase
|
36
|
-
Dir[real_path.to_s + "/{*,.*}"].each do |entry|
|
36
|
+
Dir[real_path.to_s + "/{*,.*}"].reject { |e| %W(. ..).include?(Pathname(e).basename.to_s) }.each do |entry|
|
37
37
|
entry_pathname = real_path + entry
|
38
|
-
unless
|
38
|
+
unless project.has_object_for_pathname?(entry_pathname)
|
39
39
|
handle_unused_entry(entry_pathname)
|
40
40
|
end
|
41
41
|
end
|
@@ -50,13 +50,6 @@ module Xcodeproj
|
|
50
50
|
end
|
51
51
|
private :sync_path
|
52
52
|
|
53
|
-
def has_entry?(entry_pathname)
|
54
|
-
%W(. ..).include?(entry_pathname.basename.to_s) || children.any? do |child|
|
55
|
-
child.real_path.cleanpath == entry_pathname.realpath.cleanpath
|
56
|
-
end
|
57
|
-
end
|
58
|
-
private :has_entry?
|
59
|
-
|
60
53
|
def all_groups
|
61
54
|
groups | version_groups | variant_groups
|
62
55
|
end
|
@@ -73,7 +66,7 @@ module Xcodeproj
|
|
73
66
|
work_entry_pathname = project.pathname_to_work_pathname(entry_pathname)
|
74
67
|
# The directory may have already been created for one of two reasons
|
75
68
|
# 1. It was created as a piece of another path, ie, /this/middle/directory.mkdir got called.
|
76
|
-
# 2. OS X has case insensitive folder names, so
|
69
|
+
# 2. OS X has case insensitive folder names, so has_object_for_pathname? may have failed to notice it had the folder.
|
77
70
|
work_entry_pathname.mkdir unless work_entry_pathname.exist?
|
78
71
|
# recurse
|
79
72
|
Synx::Tabber.puts entry_pathname.basename.to_s.green
|
@@ -5,15 +5,32 @@ module Xcodeproj
|
|
5
5
|
module Object
|
6
6
|
class PBXVariantGroup
|
7
7
|
|
8
|
+
# Need to retain *.lproj files on the system
|
8
9
|
def sync(group)
|
9
10
|
ensure_internal_consistency(group)
|
10
|
-
|
11
|
-
|
12
|
-
if
|
13
|
-
FileUtils.mv(
|
11
|
+
|
12
|
+
file = files.first
|
13
|
+
if lproj_as_group?
|
14
|
+
FileUtils.mv(file.real_path, work_pathname)
|
15
|
+
Synx::Tabber.puts file.real_path.basename.to_s.green
|
16
|
+
else
|
17
|
+
parent_folder_path = children.first.real_path.parent
|
18
|
+
work_destination_pathname = parent.work_pathname
|
19
|
+
|
20
|
+
if parent_folder_path.exist?
|
21
|
+
FileUtils.mv(parent_folder_path, work_destination_pathname.realpath)
|
22
|
+
end
|
23
|
+
Synx::Tabber.puts (parent_folder_path.basename.to_s + "/").green
|
24
|
+
Synx::Tabber.increase
|
25
|
+
Synx::Tabber.puts file.real_path.basename.to_s.green
|
26
|
+
Synx::Tabber.decrease
|
14
27
|
end
|
15
28
|
end
|
16
29
|
|
30
|
+
def lproj_as_group?
|
31
|
+
parent.basename =~ /.+\.lproj$/
|
32
|
+
end
|
33
|
+
|
17
34
|
end
|
18
35
|
end
|
19
36
|
end
|
data/lib/synx/project.rb
CHANGED
@@ -18,7 +18,7 @@ module Synx
|
|
18
18
|
Synx::Tabber.increase
|
19
19
|
Synx::Tabber.puts "Syncing files that are included in Xcode project...".bold.white
|
20
20
|
main_group.all_groups.each { |gr| gr.sync(main_group) }
|
21
|
-
puts "\n\n"
|
21
|
+
puts "\n\n" unless options[:quiet]
|
22
22
|
Synx::Tabber.puts "Syncing files that are not included in Xcode project..".bold.white
|
23
23
|
main_group.all_groups.each(&:move_entries_not_in_xcodeproj)
|
24
24
|
transplant_work_project
|
@@ -48,6 +48,8 @@ module Synx
|
|
48
48
|
end
|
49
49
|
|
50
50
|
self.group_exclusions |= options[:group_exclusions] if options[:group_exclusions]
|
51
|
+
|
52
|
+
Synx::Tabber.quiet = options[:quiet]
|
51
53
|
end
|
52
54
|
private :set_options
|
53
55
|
|
@@ -108,6 +110,17 @@ module Synx
|
|
108
110
|
@group_exclusions = new_exclusions
|
109
111
|
end
|
110
112
|
|
113
|
+
def has_object_for_pathname?(pathname)
|
114
|
+
@unmodified_project ||= Synx::Project.open(path)
|
115
|
+
@unmodified_project.objects.any? do |o|
|
116
|
+
begin
|
117
|
+
o.real_path.cleanpath == pathname.cleanpath
|
118
|
+
rescue
|
119
|
+
false
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
111
124
|
end
|
112
125
|
end
|
113
126
|
|
data/lib/synx/tabber.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Synx
|
2
2
|
class Tabber
|
3
3
|
|
4
|
+
@@quiet = false
|
4
5
|
@@tabbing = 0
|
5
6
|
|
6
7
|
class << self
|
@@ -19,10 +20,19 @@ module Synx
|
|
19
20
|
|
20
21
|
def reset
|
21
22
|
@@tabbing = 0
|
23
|
+
self.quiet = false
|
24
|
+
end
|
25
|
+
|
26
|
+
def quiet=(quiet)
|
27
|
+
@@quiet = quiet
|
28
|
+
end
|
29
|
+
|
30
|
+
def quiet?
|
31
|
+
@@quiet
|
22
32
|
end
|
23
33
|
|
24
34
|
def puts(str="")
|
25
|
-
Kernel.puts (a_single_tab * @@tabbing) + str.to_s
|
35
|
+
Kernel.puts (a_single_tab * @@tabbing) + str.to_s unless quiet?
|
26
36
|
end
|
27
37
|
|
28
38
|
def a_single_tab
|
@@ -32,4 +42,4 @@ module Synx
|
|
32
42
|
|
33
43
|
end
|
34
44
|
end
|
35
|
-
end
|
45
|
+
end
|
data/lib/synx/version.rb
CHANGED
@@ -89,6 +89,7 @@
|
|
89
89
|
8C848C65190DB9B300E9727B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
90
90
|
8C848C67190DB9B300E9727B /* dummyTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = dummyTests.m; sourceTree = "<group>"; };
|
91
91
|
8CADDD3A19354F120076033B /* image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image.png; sourceTree = "<group>"; };
|
92
|
+
8CD2ABF219558D7800341C58 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Localizable.strings; sourceTree = "<group>"; };
|
92
93
|
8CDA046319374F35004435A1 /* data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = data.json; path = FolderWithGroupNotLinked/data.json; sourceTree = "<group>"; };
|
93
94
|
8CE2DA1D19220F7B00D06F5E /* dummyTests-prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "dummyTests-prefix.pch"; sourceTree = "<group>"; };
|
94
95
|
/* End PBXFileReference section */
|
@@ -206,6 +207,7 @@
|
|
206
207
|
8C848C4E190DB9B300E9727B /* Supporting Files */ = {
|
207
208
|
isa = PBXGroup;
|
208
209
|
children = (
|
210
|
+
8CD2ABF019558D4100341C58 /* en.lproj */,
|
209
211
|
8C848C4F190DB9B300E9727B /* dummy-Prefix.pch */,
|
210
212
|
);
|
211
213
|
name = "Supporting Files";
|
@@ -247,6 +249,14 @@
|
|
247
249
|
name = Resources;
|
248
250
|
sourceTree = "<group>";
|
249
251
|
};
|
252
|
+
8CD2ABF019558D4100341C58 /* en.lproj */ = {
|
253
|
+
isa = PBXGroup;
|
254
|
+
children = (
|
255
|
+
8CD2ABF119558D7800341C58 /* Localizable.strings */,
|
256
|
+
);
|
257
|
+
path = en.lproj;
|
258
|
+
sourceTree = "<group>";
|
259
|
+
};
|
250
260
|
8CDA046219374F15004435A1 /* FolderWithGroupNotLinked */ = {
|
251
261
|
isa = PBXGroup;
|
252
262
|
children = (
|
@@ -375,6 +385,14 @@
|
|
375
385
|
name = InfoPlist.strings;
|
376
386
|
sourceTree = "<group>";
|
377
387
|
};
|
388
|
+
8CD2ABF119558D7800341C58 /* Localizable.strings */ = {
|
389
|
+
isa = PBXVariantGroup;
|
390
|
+
children = (
|
391
|
+
8CD2ABF219558D7800341C58 /* en */,
|
392
|
+
);
|
393
|
+
name = Localizable.strings;
|
394
|
+
sourceTree = "<group>";
|
395
|
+
};
|
378
396
|
/* End PBXVariantGroup section */
|
379
397
|
|
380
398
|
/* Begin XCBuildConfiguration section */
|
@@ -557,6 +575,7 @@
|
|
557
575
|
8CDA046C1937DDAA004435A1 /* Release */,
|
558
576
|
);
|
559
577
|
defaultConfigurationIsVisible = 0;
|
578
|
+
defaultConfigurationName = Release;
|
560
579
|
};
|
561
580
|
/* End XCConfigurationList section */
|
562
581
|
|
@@ -28,6 +28,8 @@ dummy:
|
|
28
28
|
ManyFiles.m:
|
29
29
|
Supporting Files:
|
30
30
|
dummy-Prefix.pch:
|
31
|
+
en.lproj:
|
32
|
+
Localizable.strings:
|
31
33
|
dummy.h:
|
32
34
|
dummy.m:
|
33
35
|
FileNotInXcodeProj.h:
|
@@ -42,6 +44,6 @@ dummyTests:
|
|
42
44
|
en.lproj:
|
43
45
|
InfoPlist.strings:
|
44
46
|
Supporting Files:
|
45
|
-
dummyTests-
|
47
|
+
dummyTests-prefix.pch:
|
46
48
|
dummyTests-Info.plist:
|
47
49
|
dummyTests.m:
|
data/spec/synx/project_spec.rb
CHANGED
@@ -40,6 +40,18 @@ describe Synx::Project do
|
|
40
40
|
|
41
41
|
if object.instance_of?(Xcodeproj::Project::Object::PBXGroup)
|
42
42
|
object_children ||= {}
|
43
|
+
found_children = object.children.map(&:basename)
|
44
|
+
missing_children_in_group = object_children.keys - found_children
|
45
|
+
extra_children_in_group = found_children - object_children.keys
|
46
|
+
failure_message = "In group #{object.hierarchy_path}:"
|
47
|
+
|
48
|
+
unless missing_children_in_group.empty?
|
49
|
+
failure_message += "\n Expected to find children: #{missing_children_in_group.join(", ")}"
|
50
|
+
end
|
51
|
+
|
52
|
+
unless extra_children_in_group.empty?
|
53
|
+
failure_message += "\n Did not expect to find children: #{extra_children_in_group.join(", ")}"
|
54
|
+
end
|
43
55
|
failure_message = "Expected #{object_name} to have #{object_children.count} children, found #{object.children.count}"
|
44
56
|
expect(object_children.count).to eq(object.children.count), failure_message
|
45
57
|
verify_group_structure(object, object_children) if object_children.count > 0
|
@@ -54,9 +66,20 @@ describe Synx::Project do
|
|
54
66
|
|
55
67
|
if File.directory?(entry_pathname)
|
56
68
|
entry_entries ||= {}
|
57
|
-
|
58
|
-
|
59
|
-
|
69
|
+
found_entries = entry_pathname.entries.reject { |e| [".", ".."].include?(e.to_s) }.map(&:to_s)
|
70
|
+
missing_entries_on_file_system = entry_entries.keys - found_entries
|
71
|
+
extra_entries_on_file_system = found_entries - entry_entries.keys
|
72
|
+
failure_message = "In #{entry_pathname}:"
|
73
|
+
|
74
|
+
unless missing_entries_on_file_system.empty?
|
75
|
+
failure_message += "\n Expected to find entries: #{missing_entries_on_file_system.join(", ")}"
|
76
|
+
end
|
77
|
+
|
78
|
+
unless extra_entries_on_file_system.empty?
|
79
|
+
failure_message += "\n Did not expect to find entries: #{extra_entries_on_file_system.join(", ")}"
|
80
|
+
end
|
81
|
+
|
82
|
+
expect(missing_entries_on_file_system.count + extra_entries_on_file_system.count).to be(0), failure_message
|
60
83
|
verify_file_structure(entry_pathname, entry_entries) if entry_entries.count > 0
|
61
84
|
end
|
62
85
|
end
|
data/spec/synx/tabber_spec.rb
CHANGED
@@ -53,6 +53,13 @@ describe Synx::Tabber do
|
|
53
53
|
expect(Kernel).to receive(:puts).with(" Hello, world.")
|
54
54
|
Synx::Tabber.puts("Hello, world.")
|
55
55
|
end
|
56
|
+
|
57
|
+
it "should not print anything if quiet is true" do
|
58
|
+
Synx::Tabber.quiet = true
|
59
|
+
Synx::Tabber.increase(3)
|
60
|
+
expect(Kernel).to_not receive(:puts)
|
61
|
+
Synx::Tabber.puts("Hello, world.")
|
62
|
+
end
|
56
63
|
end
|
57
64
|
|
58
65
|
describe "::a_single_tab" do
|
@@ -61,4 +68,4 @@ describe Synx::Tabber do
|
|
61
68
|
end
|
62
69
|
end
|
63
70
|
|
64
|
-
end
|
71
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Larsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- spec/dummy/dummy/dummy-Prefix.pch
|
161
161
|
- spec/dummy/dummy/dummy.h
|
162
162
|
- spec/dummy/dummy/dummy.m
|
163
|
+
- spec/dummy/dummy/en.lproj/Localizable.strings
|
163
164
|
- spec/dummy/dummy/folderWithGroupNotLinked/data.json
|
164
165
|
- spec/dummy/dummy/image-not-in-xcodeproj.png
|
165
166
|
- spec/dummy/dummy/image.png
|
@@ -226,6 +227,7 @@ test_files:
|
|
226
227
|
- spec/dummy/dummy/dummy-Prefix.pch
|
227
228
|
- spec/dummy/dummy/dummy.h
|
228
229
|
- spec/dummy/dummy/dummy.m
|
230
|
+
- spec/dummy/dummy/en.lproj/Localizable.strings
|
229
231
|
- spec/dummy/dummy/folderWithGroupNotLinked/data.json
|
230
232
|
- spec/dummy/dummy/image-not-in-xcodeproj.png
|
231
233
|
- spec/dummy/dummy/image.png
|