synx 0.0.4 → 0.0.5
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/README.md +2 -2
 - data/lib/synx/pbx_group.rb +11 -0
 - data/lib/synx/project.rb +16 -1
 - data/lib/synx/version.rb +1 -1
 - data/spec/spec_helper.rb +6 -2
 - data/spec/synx/pbx_group_spec.rb +30 -0
 - data/spec/synx/project_spec.rb +8 -10
 - data/spec/synx/tabber_spec.rb +1 -1
 - data/synx.gemspec +0 -1
 - metadata +4 -16
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                YjVjZDBiOTVjYmRmNmFhODI0ZmJlNDliMDM5ZTQwM2JjMDI3ODY0YQ==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                ODcxNGFiZDQ1YjM1NjNkYTBhZGVmMGU2ZWFmYTUxOWVmMmYzMTA3Mg==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                ZDZjM2E0NjNhZTIzNjEyODgyY2UwZWVlYTc3Y2MxOWFlOGU2YWJkNWYxMDJl
         
     | 
| 
      
 10 
     | 
    
         
            +
                MmNhMDUwNzEzOGU1MGY3NmEzMTVmZDc0OGNkZmNkNDcyNGFlNzI5Zjc1NDg5
         
     | 
| 
      
 11 
     | 
    
         
            +
                Y2NmMDJiNzM2YjgyNzM5N2NhY2Y0Y2Y0ODcxOTU0NzMxNDEwMDQ=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 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 
     | 
| 
      
 50 
     | 
    
         
            +
                $ synx -p -e "/OCMock/Core Mocks" -e /OCMockTests Source/OCMock.xcodeproj/
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
            if they wanted to not sync the  
     | 
| 
      
 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 
     | 
    
         | 
    
        data/lib/synx/pbx_group.rb
    CHANGED
    
    | 
         @@ -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] = '' 
     | 
| 
      
 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
    
    
    
        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 
     | 
    
         
            -
             
     | 
| 
      
 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
         
     | 
    
        data/spec/synx/project_spec.rb
    CHANGED
    
    | 
         @@ -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
         
     | 
    
        data/spec/synx/tabber_spec.rb
    CHANGED
    
    
    
        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 
     | 
    
         
            +
              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- 
     | 
| 
      
 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
         
     |