Skip to content

utkarsh9891/PackageSync

Repository files navigation

PackageSync

Synchronize your Sublime Text packages and your user-settings across different devices effortlessly. For this, PackageSync requires an online syncing application like Google Drive, Dropbox or SkyDrive installed on your devices.
Alternatively, PackageSync also allows you to take portable backups of your packages & restore them on the same or any other machine without any need for third party applications mentioned above.

Table of Contents

Features

Backup/Restore

This allows you to backup the installed packages list & the user settings for each package. This backup can then be restored to any other device using PackageSync.

  • Backup/Restore via a Zip file (Recommended) - Backs up the installed packages list & their settings into a zip file. The zip file is the best portable format for offline syncing.
  • Backup/Restore via folder - Works the same way as the zip file, with the only difference that the contents are placed in a folder instead of an archived zip file.
  • Backup/Restore only Package List - Backs up only the installed packages list to a file. User settings for packages are ignored in this option.

The user-setting file for PackageSync (PackageSync.sublime-settings) is never synced.

Do note that this Backup/Restore operation only syncs your packages list and your user settings offline. But the actual installation of missing/new packages requires a working Internet connection.

Also, while restoring from PackageSync backup, please ensure that all *.sublime-settings files are closed. Files in open state would interrupt the restore operation, resulting in unforeseen errors.

Sync Online

This allows you to sync the packages & user settings in real time across different devices. For this, the installed packages list & user settings are be saved to & synced via a folder monitored by Dropbox, Google Drive or SkyDrive etc.

  • First Machine
    Turn on PackageSync's online syncing module by setting the sync folder via "PackageSync: Sync Online - Define Online Sync Folder" from the command palette or Tools menu. In the ensuing input panel, give the complete path to any directory on your computer inside your Dropbox or Google Drive sync folder.

  • Second Machine (or after a fresh installation of Sublime Text)
    On your second machine please wait until all the backup files are available and then simply set the sync folder and PackageSync will automatically pull all available files from that folder. The following message dialog should appear which you just have to confirm.

OnlineSyncFolder

Restart Sublime Text & Package Control will check for missing packages and install them automatically. From now on everything should work very smoothly.

Note: For PackageSync to automatically manage installation & removal of packages (without requiring any restart) as per sync or restore operation Package Control needs to be installed as well. Otherwise, installation or removal would require restart of Sublime Text.

Usage

The commands are available under the menu Tools -> PackageSync.

Alternatively, from inside Sublime Text, open Package Control's Command Pallet: CTRL+SHIFT+P (Windows, Linux) or CMD+SHIFT+P (Mac) & search for PackageSync: to get the list of available commands.

Settings

PackageSync provides the following user configurable settings:

  • prompt_for_location [boolean, true by default]
    Decides if the user is asked for providing location to back up to or restore from.
    If set as true, user is prompted every time for a path upon back up or restore operation.
    If set as false, the location specified in settings is used. If no location has been specified in settings, by default user's desktop is used for backup.

  • zip_backup_path [string]
    The zip file path to use for backing up or restoring package list & user settings.

"prompt_for_location" = false & "zip_backup_path" = ""
This combination backs up & restores using the zip file SublimePackagesBackup.zip on the current user's Desktop. During backup operation, it also overrides any existing backup at this location without confirmation.

  • folder_backup_path [string]
    The folder path to use for backing up or restoring package list & user settings.

"prompt_for_location" = false & "folder_backup_path" = ""
This combination backs up & restores using the folder SublimePackagesBackup on the current user's Desktop. During backup operation, it also overrides any existing backup at this location without confirmation.

  • list_backup_path [string]
    The file path to use for backing up or restoring only the package list.

"prompt_for_location" = false & "list_backup_path" = ""
This combination backs up & restores using the file SublimePackagesList.txt on the current user's Desktop. During backup operation, it also overrides any existing backup at this location without confirmation.

  • ignore_files [array]
    The list of files to ignore when backing up.
    It supports wildcarded file names as well. Supported wildcard entries are '*', '?', '[seq]' & '[!seq]'. For further details, please see the fnmatch documentation.

Files ignored by default are *.DS_Store, *.last-run, Package Control.ca-list, Package Control.ca-bundle, Package Control.system-ca-bundle & *.sublime-package.

  • sync_package_sync_settings [boolean, false by default]
    Toggle to determine whether to synchronize user setting for this package (PackageSync.sublime-settings).

Caution: Use this feature very cautiously. This overrides your PackageSync settings across the synced devices. If you wish to keep different sync folder paths across the devices, DO NOT set this as True

  • include_files [array]
    The list of files to include when backing up.
    Note: ignore_files holds higher priority as compared to include_files. So a file matching both the settings would essentially be ignored, as governed by ignore_files.
    It supports wildcarded file names as well. Supported wildcard entries are '*', '?', '[seq]' & '[!seq]'. For further details, please see the fnmatch documentation.

The user settings for PackageSync (PackageSync.sublime-settings) would never be synced, even if added to this list.
Files included by default are *.sublime-*, *.tmLanguage, *.tmTheme, *.tmPreferences, *.json, *.png, *.txt, *.py, *.md.

  • ignore_dirs [array]
    Directories to ignore when backing up.
    By default, all directories created by other packages are included. Only the directories specified in this list are ignored while syncing.

Do note that an "include_dirs" option has not been provided on purpose.
This has been done in order to avoid confusion for the user when syncing across OSX, WIN & LINUX mahcines as path would be different across all machines of the same user.

  • preserve_packages [boolean, true by default]
    Decides if the existing packages are to be preserved while restoring from a backup.
    If set as false, existing packages & their settings are removed during restore operation. Only the packages included in the backup are restored.
    If set as true, PackageSync keeps the existing packages intact. Packages not included in the backup therefore remain unharmed even after restore operation. However, user-settings are overwritten if the backup contains user-settings for the same package.

  • online_sync_enabled [boolean, false by default]
    Toggle to determine if online syncing is enabled or not.
    Turning this toggle ON/OFF requires Online Sync Folder to be setup first.

  • online_sync_folder [string]
    Folder to use for syncing the backup with online syncing services.
    This should be the path to a folder inside the Google Drive, Dropbox or SkyDrive sync folder. Any other online syncing application can be used as well.

  • online_sync_interval [integer, default 1]
    The frequency (in seconds) at which PackageSync should poll to see if there are any changes in the local folder or in the online sync folder.
    PackageSync will keep your settings up to date across machines by checking regularly at this interval. If you face any performance issues you can increase this time via the settings and a restart of Sublime Text.

  • debug [boolean, false by default] Whether or not PackageSync should log to the console. Enable this if you're having issues and want to see PackageSync's activity.

Installation

Package Control

The preferred method of installation is via Sublime Package Control.

  1. Install Sublime Package Control
  2. From inside Sublime Text, open Package Control's Command Pallet: CTRL SHIFT P (Windows, Linux) or CMD SHIFT P (Mac).
  3. Type install package, select command Package Control: Install Package and hit Return. A list of available packages will be displayed.
  4. Type PackageSync, select the PackageSync package and hit Return. The package will be downloaded to the appropriate directory.

Manual Installation

  1. Download or clone this repository to a directory PackageSync in the Sublime Text Packages directory for your platform:
    • Mac: git clone https://github.com/utkarsh9891/PackageSync.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/PackageSync
    • Windows: git clone https://github.com/utkarsh9891/PackageSync.git %APPDATA%\Sublime/ Text/ 3/\PackageSync
    • Linux: git clone https://github.com/utkarsh9891/PackageSync.git ~/.Sublime\ Text\ 3/Packages/PackageSync
  2. Restart Sublime Text to complete installation.

The features listed above should now be available.

Feedback

Please use the form PackageSync Feedback for providing any Feedback or Suggestions or for reporting Issues that you face while using or installing PackageSync.

License

All files in this package are licensed under the MIT license. See the LICENSE file for license rights and limitations.