synx 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDk2OThkYzE0NWYwNThkOTM0MjFlZDQ1MTkxZDAzYWM5ODc1ZDdlMA==
4
+ YjVjZDBiOTVjYmRmNmFhODI0ZmJlNDliMDM5ZTQwM2JjMDI3ODY0YQ==
5
5
  data.tar.gz: !binary |-
6
- ZjAzY2U1YTJmM2VjMmRjNGM0MDFmYzU1N2Y4MWRkYTA1NmZmMzllZA==
6
+ ODcxNGFiZDQ1YjM1NjNkYTBhZGVmMGU2ZWFmYTUxOWVmMmYzMTA3Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGEwZTY3MmQ3Zjc2OWRkMmYzZDAyNTEwYTFhNDYxMzA0ZDdiMDA5OTIxMjg3
10
- ZmI3ZGQ4NzVhZDFkM2NmYmZjNGJhYTJhYzRjZWQ5NzJlYTY5NDcwMjg1MzM1
11
- NTZkZGY3ZjZmNmRlMmFkNWVjMDViMmI4YTMzMzQwNjA5NWEyMzk=
9
+ ZDZjM2E0NjNhZTIzNjEyODgyY2UwZWVlYTc3Y2MxOWFlOGU2YWJkNWYxMDJl
10
+ MmNhMDUwNzEzOGU1MGY3NmEzMTVmZDc0OGNkZmNkNDcyNGFlNzI5Zjc1NDg5
11
+ Y2NmMDJiNzM2YjgyNzM5N2NhY2Y0Y2Y0ODcxOTU0NzMxNDEwMDQ=
12
12
  data.tar.gz: !binary |-
13
- Nzk0NmUzNmM0NzA4ZTc2ZGQ4ZTY0ZjBmMmJlOTEwYWQzYTJkYjVlYjFmYWYx
14
- MjVlYmMxMjM2YTRkOGU4ZTU1YjZmMmY0ZGUwZGJiOTc0MzU5ZjY3MzY1Y2Rm
15
- ZDRiODFiOGY1MDNhMjk0ZTZhM2ExMmE1ZjNlY2E4ZTNkZDYxYWE=
13
+ MTdjN2NiMjMzODYzMGI2ZTVjNjRhMDk2NTJmYzIzZDg2OTQyMmUxNzJlNmQ3
14
+ M2MyMzMzYzY0YTcxNDZlMThkZjJhZGI3ZDE5MGZiMmUyOWRhNGJhZTg4OGRi
15
+ NWYwY2ViNTExNDVkZjBlODg3M2E3MzJhNzU3M2NkN2I3ZDg3NzA=
data/README.md CHANGED
@@ -47,9 +47,9 @@ Synx supports the following options:
47
47
 
48
48
  OCMock, for example, could have done:
49
49
 
50
- $ synx -p -e=OCMock/Core -e=OCKMockTests Source/OCMock.xcodeproj
50
+ $ synx -p -e "/OCMock/Core Mocks" -e /OCMockTests Source/OCMock.xcodeproj/
51
51
 
52
- if they wanted to not sync the `OCMock/Core` and `OCMockTests` groups, and also remove (`-p`) any image/source files found by synx that weren't ever referenced by any groups in Xcode.
52
+ if they wanted to not sync the `/OCMock/Core Mocks` and `/OCMockTests` groups, and also remove (`-p`) any image/source files found by synx that weren't ever referenced by any groups in Xcode.
53
53
 
54
54
  ## Contributing
55
55
 
@@ -124,6 +124,17 @@ module Xcodeproj
124
124
  end
125
125
  private :squash_duplicate_file_references
126
126
 
127
+ def groups_containing_forward_slash
128
+ found_groups = []
129
+ groups.each do |group|
130
+ unless group.excluded_from_sync?
131
+ found_groups << group if group.basename.include?("/")
132
+ found_groups |= group.groups_containing_forward_slash
133
+ end
134
+ end
135
+ found_groups
136
+ end
137
+
127
138
  end
128
139
  end
129
140
  end
data/lib/synx/project.rb CHANGED
@@ -14,6 +14,7 @@ module Synx
14
14
 
15
15
  def sync(options={})
16
16
  set_options(options)
17
+ presync_check
17
18
  Synx::Tabber.increase
18
19
  Synx::Tabber.puts "Syncing files that are included in Xcode project...".bold.white
19
20
  main_group.all_groups.each { |gr| gr.sync(main_group) }
@@ -25,6 +26,18 @@ module Synx
25
26
  save
26
27
  end
27
28
 
29
+ def presync_check
30
+ forward_slash_groups = main_group.groups_containing_forward_slash
31
+ unless forward_slash_groups.empty?
32
+ Synx::Tabber.puts "Synx cannot sync projects with groups that contain '/'. Please rename the following groups before running synx again:".yellow
33
+ Synx::Tabber.increase
34
+ forward_slash_groups.each do |group|
35
+ Synx::Tabber.puts group.hierarchy_path
36
+ end
37
+ abort
38
+ end
39
+ end
40
+
28
41
  def set_options(options)
29
42
  self.prune = options[:prune]
30
43
 
@@ -79,11 +92,13 @@ module Synx
79
92
 
80
93
  def group_exclusions=(new_exclusions)
81
94
  new_exclusions.each do |exclusion|
95
+ # Group paths always start with a '/', so put one there if it isn't already.
96
+ exclusion.prepend("/") unless exclusion[0] == "/"
82
97
  # Don't check our own default exclusions -- they may not have it in their project.
83
98
  unless DEFAULT_EXCLUSIONS.include?(exclusion)
84
99
  # remove leading '/' for this check
85
100
  exclusion = exclusion.dup
86
- exclusion[0] = '' if exclusion[0] == '/'
101
+ exclusion[0] = ''
87
102
  unless self[exclusion]
88
103
  raise IndexError, "No group #{exclusion} exists"
89
104
  end
data/lib/synx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Synx
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -3,9 +3,13 @@ Bundler.setup
3
3
 
4
4
  require 'synx'
5
5
  require 'pry'
6
- require 'coveralls'
7
6
 
8
- Coveralls.wear!
7
+ DUMMY_SYNX_PATH = File.join(File.dirname(__FILE__), 'dummy')
8
+ DUMMY_SYNX_TEST_PATH = File.join(File.dirname(__FILE__), 'test_dummy')
9
+ DUMMY_SYNX_TEST_PROJECT_PATH = File.join(DUMMY_SYNX_TEST_PATH, 'dummy.xcodeproj')
10
+ FileUtils.rm_rf(DUMMY_SYNX_TEST_PATH)
11
+ FileUtils.cp_r(DUMMY_SYNX_PATH, DUMMY_SYNX_TEST_PATH)
12
+ DUMMY_SYNX_TEST_PROJECT = Synx::Project.open(DUMMY_SYNX_TEST_PROJECT_PATH)
9
13
 
10
14
  RSpec.configure do |config|
11
15
  end
@@ -0,0 +1,30 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+
3
+ describe Xcodeproj::Project::Object::PBXGroup do
4
+
5
+ describe "groups_containing_forward_slash" do
6
+
7
+ before(:all) do
8
+ DUMMY_SYNX_TEST_PROJECT.send(:set_options, {})
9
+ end
10
+
11
+ after(:all) do
12
+ DUMMY_SYNX_TEST_PROJECT["top group"].remove_from_project
13
+ end
14
+
15
+ it "should return all child and grandchild groups containing forward slash" do
16
+
17
+ top_group = DUMMY_SYNX_TEST_PROJECT.main_group.new_group("top group")
18
+
19
+ child_1 = top_group.new_group("have / slash")
20
+ child_1_1 = child_1.new_group("1 no slash")
21
+ child_1_2 = child_1.new_group("1 / slash")
22
+
23
+ child_2 = top_group.new_group("no slash")
24
+ child_2_1 = child_2.new_group("2 no slash")
25
+ child_2_2 = child_2.new_group("2 / slash")
26
+
27
+ expect(top_group.groups_containing_forward_slash).to eq([child_1, child_1_2, child_2_2])
28
+ end
29
+ end
30
+ end
@@ -30,16 +30,6 @@ end
30
30
 
31
31
  describe Synx::Project do
32
32
 
33
- DUMMY_SYNX_PATH = File.join(File.dirname(__FILE__), '..', 'dummy')
34
- DUMMY_SYNX_TEST_PATH = File.join(File.dirname(__FILE__), '..', 'test_dummy')
35
- DUMMY_SYNX_TEST_PROJECT_PATH = File.join(DUMMY_SYNX_TEST_PATH, 'dummy.xcodeproj')
36
-
37
- before(:all) do
38
- FileUtils.rm_rf(DUMMY_SYNX_TEST_PATH)
39
- FileUtils.cp_r(DUMMY_SYNX_PATH, DUMMY_SYNX_TEST_PATH)
40
- DUMMY_SYNX_TEST_PROJECT = Synx::Project.open(DUMMY_SYNX_TEST_PROJECT_PATH)
41
- end
42
-
43
33
  describe "#sync" do
44
34
 
45
35
  def verify_group_structure(group, expected_structure)
@@ -164,6 +154,14 @@ describe Synx::Project do
164
154
 
165
155
  expect(DUMMY_SYNX_TEST_PROJECT.group_exclusions).to eq(group_exclusions)
166
156
  end
157
+
158
+ it "should be forgiving about missing '/' at beginning of group paths" do
159
+ group_exclusions = %W(dummy dummy/GroupThatDoubleReferencesFile dummy/SuchGroup/VeryChildGroup)
160
+ DUMMY_SYNX_TEST_PROJECT.group_exclusions = group_exclusions
161
+
162
+ expected = %W(/dummy /dummy/GroupThatDoubleReferencesFile /dummy/SuchGroup/VeryChildGroup)
163
+ expect(DUMMY_SYNX_TEST_PROJECT.group_exclusions).to eq(expected)
164
+ end
167
165
  end
168
166
 
169
167
  describe "#root_pathname" do
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
2
 
3
3
  describe Synx::Tabber do
4
4
 
5
- after(:each) do
5
+ before(:each) do
6
6
  Synx::Tabber.reset
7
7
  end
8
8
 
data/synx.gemspec CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.6"
25
- spec.add_development_dependency "coveralls"
26
25
  spec.add_development_dependency "rake", "~> 10.3"
27
26
  spec.add_development_dependency "rspec", "~> 2.14"
28
27
  spec.add_development_dependency "pry", "~> 0.9"
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
4
+ version: 0.0.5
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-05-29 00:00:00.000000000 Z
11
+ date: 2014-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
- - !ruby/object:Gem::Dependency
28
- name: coveralls
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ! '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -184,6 +170,7 @@ files:
184
170
  - spec/spec_helper.rb
185
171
  - spec/synx/expected_file_structure.yml
186
172
  - spec/synx/expected_group_structure.yml
173
+ - spec/synx/pbx_group_spec.rb
187
174
  - spec/synx/project_spec.rb
188
175
  - spec/synx/tabber_spec.rb
189
176
  - synx.gemspec
@@ -249,5 +236,6 @@ test_files:
249
236
  - spec/spec_helper.rb
250
237
  - spec/synx/expected_file_structure.yml
251
238
  - spec/synx/expected_group_structure.yml
239
+ - spec/synx/pbx_group_spec.rb
252
240
  - spec/synx/project_spec.rb
253
241
  - spec/synx/tabber_spec.rb