Synx - A command-line tool that reorganizes your Xcode project folder to match your Xcode groups

Related tags

Xcode Other synx
Overview

synx logo

Gem Version Build Status

A command-line tool that reorganizes your Xcode project folder to match your Xcode groups.

synx gif

Xcode

synx Xcode

Finder

synx finder before/after

Installation

$ gem install synx

Usage

Basic

⚠️ WARNING: Make sure that your project is backed up through source control before doing anything ⚠️

Execute the command on your project to have it reorganize the files on the file system:

 $ synx path/to/my/project.xcodeproj

It may have confused CocoaPods. If you use them, execute this command:

$ pod install

You're good to go!

Advanced

Synx supports the following options:

  --prune, -p                   remove source files and image resources that are not referenced by the the Xcode project
  --no-color                    removes all color from the output
  --no-default-exclusions       doesn't use the default exclusions of /Libraries, /Frameworks, and /Products
  --no-sort-by-name             disable sorting groups by name
  --quiet, -q                   silence all output
  --exclusion, -e EXCLUSION     ignore an Xcode group while syncing

For example, OCMock could have been organized using this command:

$ synx -p -e "/OCMock/Core Mocks" -e /OCMockTests Source/OCMock.xcodeproj/

if they had wanted not to sync the /OCMock/Core Mocks and /OCMockTests groups, and also remove (-p) any image/source files found by synx that weren't referenced by any groups in Xcode.

Contributing

We'd love to see your ideas for improving this library! The best way to contribute is by submitting a pull request. We'll do our best to respond to your patch as soon as possible. You can also submit a new Github issue if you find bugs or have questions. :octocat:

Please make sure to follow our general coding style and add test coverage for new features!

Contributors

Comments
  • A strange error

    A strange error

    Hello,

    I used SYNX to great success before but in my current project It just doesn't work.

    Here's the error log:

    /Library/Ruby/Gems/2.0.0/gems/synx-0.0.52/lib/synx/abstract_object.rb:18:in work_pathname': undefined method[]' for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.52/lib/synx/pbx_variant_group.rb:18:in sync' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.52/lib/synx/project.rb:20:inblock in sync' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.52/lib/synx/project.rb:20:in each' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.52/lib/synx/project.rb:20:insync' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.52/bin/synx:16:in execute' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:inrun' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/command.rb:125:in run' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp.rb:6:inClamp' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.52/bin/synx:6:in <top (required)>' from /usr/bin/synx:23:inload' from /usr/bin/synx:23:in `

    '

    Could you help?

    opened by pawelkata 29
  • Crashes on mkdir (File exists @ dir_s_mkdir)

    Crashes on mkdir (File exists @ dir_s_mkdir)

    Hi! Gem looks really awesome!

    Unfortunately, it crashes now for one of my projects, here's stack trace

    /Users/.../.rvm/gems/ruby-2.1.1/gems/synx-0.0.2/lib/synx/pbx_group.rb:71:in `mkdir': File exists @ dir_s_mkdir - /Users/.../.synx/<path> (Errno::EEXIST)
        from /Users/.../.rvm/gems/ruby-2.1.1/gems/synx-0.0.2/lib/synx/pbx_group.rb:71:in `mkdir'
        from /Users/.../.rvm/gems/ruby-2.1.1/gems/synx-0.0.2/lib/synx/pbx_group.rb:71:in `handle_unused_entry'
        from /Users/.../.rvm/gems/ruby-2.1.1/gems/synx-0.0.2/lib/synx/pbx_group.rb:39:in `block in move_entries_not_in_xcodeproj'
    

    My setup: RVM, Ruby 2.1.1, Mac OS X 10.9.3

    bug 
    opened by DenTelezhkin 10
  • Support for Git Move/SVN Move, etc.

    Support for Git Move/SVN Move, etc.

    First of all, grats on a great first release!

    I'm sure you saw this coming, but support for various version control mv operations would be hugely helpful. That would allow this to be a common operation in a mature source control environment. As it is, I would consider this more of a "lets just fix this darn project" operation that I would run once initially rather than an ongoing maintenance tool.

    enhancement 
    opened by cnstoll 10
  • Option for excluding specified groups (--exclusion, -e) doesn't function.

    Option for excluding specified groups (--exclusion, -e) doesn't function.

    Following the usage as specified in the example: $ synx -p -e=OCMock/Core -e=OCKMockTests Source/OCMock.xcodeproj produces the following error output:

    $ synx -p -e=Shared CBTest.xcodeproj /Library/Ruby/Gems/2.0.0/gems/synx-0.0.4/lib/synx/project.rb:88:in block in group_exclusions=': No group =Shared exists (IndexError) from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.4/lib/synx/project.rb:81:ineach' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.4/lib/synx/project.rb:81:in group_exclusions=' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.4/lib/synx/project.rb:37:inset_options' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.4/lib/synx/project.rb:16:in sync' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.4/bin/synx:15:inexecute' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:in run' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp/command.rb:125:inrun' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.3/lib/clamp.rb:6:in Clamp' from /Library/Ruby/Gems/2.0.0/gems/synx-0.0.4/bin/synx:6:in<top (required)>' from /usr/bin/synx:23:in load' from /usr/bin/synx:23:in

    '

    If '=' is removed (like the --help usage suggests): $ synx -p -e Shared CBTest.xcodeproj the option is completely ignored and specified group is synced anyway.

    opened by felis-silvestris 9
  • Getting 'NoMethodError' when try to run on our project

    Getting 'NoMethodError' when try to run on our project

    I'm getting this error:

    /Users/mark/.rvm/gems/ruby-2.1.2/gems/synx-0.0.52/lib/synx/abstract_object.rb:18:in `work_pathname': undefined method `[]' for nil:NilClass (NoMethodError)
        from /Users/mark/.rvm/gems/ruby-2.1.2/gems/synx-0.0.52/lib/synx/pbx_variant_group.rb:18:in `sync'
        from /Users/mark/.rvm/gems/ruby-2.1.2/gems/synx-0.0.52/lib/synx/project.rb:20:in `block in sync'
        from /Users/mark/.rvm/gems/ruby-2.1.2/gems/synx-0.0.52/lib/synx/project.rb:20:in `each'
        from /Users/mark/.rvm/gems/ruby-2.1.2/gems/synx-0.0.52/lib/synx/project.rb:20:in `sync'
        from /Users/mark/.rvm/gems/ruby-2.1.2/gems/synx-0.0.52/bin/synx:16:in `execute'
        from /Users/mark/.rvm/gems/ruby-2.1.2@global/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
        from /Users/mark/.rvm/gems/ruby-2.1.2@global/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'
        from /Users/mark/.rvm/gems/ruby-2.1.2@global/gems/clamp-0.6.3/lib/clamp.rb:6:in `Clamp'
        from /Users/mark/.rvm/gems/ruby-2.1.2/gems/synx-0.0.52/bin/synx:6:in `<top (required)>'
        from /Users/mark/.rvm/gems/ruby-2.1.2/bin/synx:23:in `load'
        from /Users/mark/.rvm/gems/ruby-2.1.2/bin/synx:23:in `<main>'
        from /Users/mark/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
        from /Users/mark/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
    

    I get this whenever I try to run synx on our project.

    The end result is not good either - it seems that it simply removes all the files it would try to move and leaves it at that.

    I am completely unfamiliar with ruby or what not, so if I'm doing something wrong with my setup please tell me. :)

    bug 
    opened by Mark2xv 8
  • Remove output from tests

    Remove output from tests

    Tabber accepts an :output option, which points to $stdout by default. Tests set this option to a StringIO object instead.

    If you like the output for acceptance testing, feel free to close this. But a high-level test that makes explicit assertions about the format of the output would be better imo. In fact, I might just write that test :)

    I'll rebase if https://github.com/venmo/synx/pull/36 gets merged first and you like this change.

    opened by alexgenco 7
  • If group name contains

    If group name contains "/" running synx with -p option breaks the project file integrity.

    If group name has "/" character in it, the first time synx command is executed everything seems fine. However the following happens:

    1. Folder name for the corresponding group contains only the part before "/".
    2. All files are moved inside a subfolder of the above folder, which name contains only second half of the original group name (past "/").
    3. Original group's name stayed unchanged. Xcode project file references for the contents of the original group pointed to the subfolder created in (2).

    If project groups structure is modified and synx command is executed again with -p option the following happens:

    1. Another folder is created at the project root which is 100% copy of subfolder described above in (2).
    2. All files from subfolder (2) are removed as not being referenced by Xcode which ultimately breaks the project file and project will no longer compile

    So in my case group's name was "Dashboard Header / Footer". After first run: "Dashboard Header " with subfolder " Footer" got created and all files were moved to " Footer" subfolder, group "Dashboard Header / Footer" was now pointing to " Footer" subfolder, Xcode references were fine, project compiled. After creating a new group somewhere else in the project and executing synx again, files from " Footer" subfolder got removed from disk, and " Footer" with identical contents was created in the root directory, however project file references were not updated, so the contents of "Dashboard Header / Footer" group got highlighted in red.

    bug 
    opened by felis-silvestris 7
  • Add support for the --no-color option.

    Add support for the --no-color option.

    The colored gem was replaced with colorize. It has a very similar API but comes with a few extra methods to remove or check colors.

    The Tabber class has had an options hash added to it, to make further additions easier.

    This partially addresses issue #28.

    opened by samsymons 6
  • Relax the gem requirement

    Relax the gem requirement

    This gem don't really need exactly those versions of dependencies. Relax the requirement will allow us use it when some other gems depended on a higher version.

    opened by siuying 5
  • Prune option delete files in localizable files

    Prune option delete files in localizable files

    Hi,

    I have two localized files : Localizable.strings and InfoPlist.strings.

    When I runned synx with the prune option, it removed my Localizable.strings in english. But strangely in InfoPlist.strings it removed all the languages except in english. Of course, the correct behavior would be to not remove anything in this directories ;)

    Any ideas ?

    Thanks (and thanks for the tool ;) )

    opened by ghost 5
  • Allow for use as a CI tool to check for accidental files / directory issues

    Allow for use as a CI tool to check for accidental files / directory issues

    It would be awesome if synx could be run on every continuous integration of your build in a way that exited with an error code if there has been a file that was added to the repo that doesn't match the directory structure or wasn't properly included into the project. This way, synx would only have to be run once to actually clean up your project, but then could be run continuously afterwards to ensure that your project stays clean. Let me know what you think, or if there's already an easy way to accomplish this.

    Thanks for the amazing tool! Love the stuff that's been coming out of Venmo recently.

    enhancement 
    opened by erichoracek 5
  • [SPM] The problem with incorrect interaction with Swift Package Manager

    [SPM] The problem with incorrect interaction with Swift Package Manager

    When we have Synx and Swift PM in our Project, every time the utility runs, it affects the SPM dependencies. Synx renaming and moving the SPM dependencies.

    1. This is the first problem, because every time the SPM returns all modifications back, as they were not applied correctly. And Synx next renames it, and so on in a circle, every time.
    2. The second problem is that there is no way to exclude the interaction of synx with SPM, thereby making this utility inapplicable on projects that use SPM.

    Open Project, SPM updated dependencies, and rename it as correct. BeforeUsingSynx

    Run Synx, Synx renamed SPM dependencies. AfterUsingSynx

    Xcode 12.1 MacOS Catalina 10.15.7

    opened by stolyarenkokswing 3
  • support Mojave in different configurations

    support Mojave in different configurations

    please merge https://github.com/venmo/synx/pull/143 since it works properly with OSX 10.14 (Mojave) while current version has obsolete dependencies.

    As workaround currently possible to use: gem "synx", :git => 'https://github.com/dnedrow/synx.git' in your Gemfile

    opened by Speakus 0
  • Update dependency versions and bump synx version to 1.0.

    Update dependency versions and bump synx version to 1.0.

    I've updated the gemspec file to point to the most recent major.minor releases for dependencies.

    Also, given that synx works as described, it's time to bump the version to 1.0.0.

    opened by dnedrow 2
  • Since using Synx Xcode Assistant no longer works

    Since using Synx Xcode Assistant no longer works

    I used synx on my project and since then my Xcode 9 assistant has given me "No assistant results". I checked out the commit before the synx and it worked again, and then checked out the synx commit and it stopped working.

    I've tried removing references to all the files and readding them, but no joy. I've cleared the build folder, cleared derived data and nothing has seemed to help.

    Has anyone else faced/solved this issue?

    opened by Fawxy 0
  • Removing bridging header file from project

    Removing bridging header file from project

    Thanks for the efforts!

    I have tried using it, the command runs fine but its also removing bridging header file. I followed the first command on git page 'synx path/to/xcodeproj'

    opened by gitshastri 2
Releases(v0.0.52)
Owner
Venmo
Venmo
Swift-project-template - 🍪 Easily generate Swift projects with Cookiecutter

swift-project-template ?? Cookiecutter template for Swift iOS projects. Features: Xcode 11 and Swift 5.0 support AppCode support Custom project struct

Artem Novichkov 86 Jul 8, 2022
Swift-VIPER-Module - Xcode template for VIPER Architecture written in Swift 4

⚠️ Deprecated ⚠️ This library is deprecated. When you decide to use VIPER architecture in your project, it is very tired create new modules, because y

Juanpe Catalán 533 Nov 17, 2022
ViperC - Xcode template for VIPER Architecture for both Objective-C and Swift.

ViperC Xcode template for VIPER Architecture for both Objective-C and Swift. ViperC creates modules for you when you want to use VIPER architecture in

Abdullah Selek 79 Nov 2, 2022
XcodeCodeSnippets - Code snippets for Xcode.

XcodeCodeSnippets A set of snippets for Xcode. Requirements Xcode 7.3.1 or later. Installation To install or update the snippets you need: Quit Xcode

Ivan Smetanin 33 Oct 14, 2022
VIPERModuleTemplate - Template of VIPER Module for Xcode

Once you've decided to use a VIPER architecture in your app, you should know about the routine. For each screen/module you should create at least 6 fi

Bogdan Evsenev 17 Dec 10, 2021
Xcode-developer-disk-image-all-platforms - A repo which shares all developer disk images for iOS, tvOS, watchOS

Disclaimer: The available resources and files from this repo are uploaded from many contributors. The files are unverified, untested, and could have n

Hai K 253 Dec 21, 2022
Swift package to interact with Xcode Code Snippets in a type-safe manner

XCSnippets Swift package to provide type-safe interaction with (user-defined) Xcode Code Snippets Overview import XCSnippets let directory = Persiste

Marco Eidinger 4 Oct 11, 2022
CodeEditTextView - An Xcode-inspired code editor view written in Swift powered by tree-sitter for CodeEdit

An Xcode-inspired code editor view written in Swift powered by tree-sitter for CodeEdit. Features include syntax highlighting (based

CodeEdit 243 Jan 8, 2023
Swift package to interact with Xcode Code Snippets in a type-safe manner

XCSnippets Swift package to provide type-safe interaction with (user-defined) Xcode Code Snippets Overview import XCSnippets let directory = Persiste

Marco Eidinger 3 Jun 24, 2022
Awesome-gitignore-templates - A curated collection of useful gitignore templates for different programming languages while pushing your code to git. 😊 📝

Awesome Gitignore Templates A curated collection of useful gitignore templates for different programming languages while pushing your code to git. ??

Aashish Tamsya 19 Jun 11, 2022
A Swift command line tool for generating your Xcode project

XcodeGen XcodeGen is a command line tool written in Swift that generates your Xcode project using your folder structure and a project spec. The projec

Yonas Kolb 5.9k Jan 9, 2023
A command-line tool to generate a JSON-list of all used SPM-dependencies of an Xcode-project.

SwiftPackageList A command-line tool to generate a JSON-list of all used SPM-dependencies of an Xcode-project. This includes all the Package.resolved

Felix Herrmann 14 Jan 8, 2023
Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened his eyes

GodEye Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened hi

陈奕龙(子循) 3.7k Dec 23, 2022
A command line tool that calls your Xcode Test Plan and creates screenshots of your app automatically.

ShotPlan (WIP) A command line tool that calls your Xcode Test Plan and creates screenshots of your app automatically. ShotPlan will also take care of

Devran Cosmo Uenal 6 Jul 21, 2022
Command line tool written in Swift dedicated to perform Mutation Testing of your Swift project

Mutanus Command line tool written in Swift dedicated to perform Mutation Testing of your Swift project. Inspired by Muter Usage mutanus -c <path-to-co

Iurii Sorokin 36 Sep 21, 2022
Queues, timers, and task groups in Swift

Dispatcher eases the pain of using Grand Central Dispatch by introducing 4 new Swift classes. Dispatcher Queue Group Timer Requirements Swift 2.0+ Ins

Alec Larson 109 Jan 29, 2022
Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.

Easy to implement controller with expanding menu items. Design is very similar to iOS native ActionSheet presentation style of a UIAlertController. As

Anatoliy Voropay 22 Dec 27, 2022
Folder References With Xcode Gen

FolderReferencesWithXcodeGen How to Build and Run Install dependencies # Install

a_jike 0 Dec 20, 2021
A command-line tool and Xcode Extension for formatting Swift code

Table of Contents What? Why? How? Command-line tool Xcode source editor extension Xcode build phase Via Applescript VSCode plugin Sublime Text plugin

Nick Lockwood 6.3k Jan 8, 2023
The best command-line tool to install and switch between multiple versions of Xcode.

The best command-line tool to install and switch between multiple versions of Xcode.

Robots and Pencils 2.3k Jan 9, 2023