From c723925e3d77e081f6a6c0de91baf5cc7c7c2684 Mon Sep 17 00:00:00 2001 From: Pilaton <83372686+Pilaton@users.noreply.github.com> Date: Tue, 7 Dec 2021 04:21:27 +0300 Subject: [PATCH] feat: Release! --- .editorconfig | 18 ++ .github/workflows/release-please.yml | 30 +++ .gitignore | 2 + Makefile | 5 + README.md | 160 +++++++++++- bin/dotfile.zsh | 309 ++++++++++++++++++++++++ bin/install.zsh | 137 +++++++++++ config/config.cfg | 39 +++ doc/images/MacSync-folder-structure.svg | 1 + doc/images/MacSync-usage.svg | 1 + doc/images/MacSync_logo.svg | 44 ++++ package.json | 34 +++ test/create-demo-folder.zsh | 5 + 13 files changed, 784 insertions(+), 1 deletion(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/release-please.yml create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 bin/dotfile.zsh create mode 100644 bin/install.zsh create mode 100644 config/config.cfg create mode 100644 doc/images/MacSync-folder-structure.svg create mode 100644 doc/images/MacSync-usage.svg create mode 100644 doc/images/MacSync_logo.svg create mode 100644 package.json create mode 100644 test/create-demo-folder.zsh diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..171f728 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = true + +[Makefile] +indent_style = tab + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..4e7a323 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,30 @@ +on: + push: + branches: + - main +name: πŸš€ release-please +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - name: πŸ•Ί release + uses: GoogleCloudPlatform/release-please-action@v2 + id: release + with: + release-type: node + changelog-types: '[{"type":"feat","section":"πŸŽ‰ Features","hidden":false},{"type":"fix","section":"πŸ› οΈ Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' + token: ${{ secrets.GITHUB_TOKEN }} + - name: 🚦 checkout + uses: actions/checkout@v2 + if: ${{ steps.release.outputs.release_created }} + - name: 🟒 node + uses: actions/setup-node@v2 + with: + node-version: "16" + registry-url: "https://registry.npmjs.org" + if: ${{ steps.release.outputs.release_created }} + - name: πŸš€ publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{ steps.release.outputs.release_created }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f32e4b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +node_modules \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..603ed7a --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +install: + zsh ./bin/install.zsh + +demo-folder: + zsh ./test/create-demo-folder.zsh diff --git a/README.md b/README.md index 94ab67f..16e2b48 100644 --- a/README.md +++ b/README.md @@ -1 +1,159 @@ -# MacSync \ No newline at end of file +
+ + MacSync + +

πŸπŸ”† MacSync

+
Easy sync for macOS. Dotfiles, folders, configurations, etc.
+
+ +## Contents + +- [What is it](#what-is-it) +- [Installing and configuration](#installing-and-configuration) +- [Usage](#usage) +- [Folder structure](#folder-structure) +- [How it works](#how-it-works) + +## What is it + +MacSync is a simple application that helps you sync the files and folders you need between your Mac devices. + +Synchronize your files through any cloud storage ([Dropbox](https://dropbox.com), [Google Drive](https://google.com/drive/), [Microsoft OneDrive](https://www.microsoft.com/microsoft-365/onedrive/online-cloud-storage), [Apple iCloud](https://icloud.com), [Yandex.Disk](https://disk.yandex.ru) and others), your own server, NAS, [GitHub](https://github.com) or whatever. + +## Installing and configuration + +1. Download the project and go to the project folder + +```bash +# Download the project to the directory you need +git clone https://github.com/Pilaton/MacSync.git --depth=1 + +# Go to the project folder +cd MacSync/ +``` + +2. Configuring `config/config.cfg` + +```bash +########### YOUR CONFIG ############ + +# Synchronization folder path +# +# Example: ~/Dropbox/MySyncFolder +# +SYNC_FOLDER=~/Dropbox/MySyncFolder + + +# List of files and folders to sync +# File and folder paths start from the user's home directory ($ ~/) +# +# Example: BACKUP_FILES=(Sites/mySite .oh-my-zsh/custom .gitconfig .zshrc .npmrc) +# +BACKUP_FILES=(Sites/mySite .oh-my-zsh/custom .gitconfig .zshrc .npmrc) +``` + +## Usage + +Once you have configured `config/config.cfg`, run MacSync. + +```bash +# Launch MacSync with the command +make install +# OR +zsh ./bin/install.zsh +``` + +After launch, you will be offered options to choose from (below is a diagram). + +![MacSync usage](doc/images/MacSync-usage.svg) + +Let's go over some points. + +`Disable sync` + +This command launches the return of synchronized files to your device and removes their symlinks. +To avoid problems, files are not deleted from the sync folder. + +`Connect and replace all files in it` + +This command connects your device to the sync folder by first deleting it completely, then re-creating it and adding your new files to it. + +`Connect and update obsolete files` + +This command connects your device to the sync folder, adding your new files to it. +If some files already exist and the date they were edited is older than yours, they will be updated. + +`Connect only` + +This command simply connects your device to the sync folder. +πŸ’‘ Note: Only those files that are specified in your config file and if they exist in the sync folder will be synchronized. + +## Folder structure + +After you specify the path to the sync folder and the list of synced files in `config/config.cfg`, and run the application, you get the following directory structure: + +![MacSync usage](doc/images/MacSync-folder-structure.svg) + +I will also leave the directory scheme in its usual form. πŸ˜‰ + +```bash +πŸ“‚ MySyncFolder +β”œβ”€β”€ πŸ“‚ _Backup_default_config +β”‚ └── πŸ“‚ iMac_01-12-2021_1124983521 +β”‚ β”‚ β”œβ”€β”€ _config.cfg +β”‚ β”‚ β”œβ”€β”€ .gitconfig +β”‚ β”‚ β”œβ”€β”€ .otherconfig +β”‚ β”‚ └── .zshrc +β”‚ β”‚ +β”‚ └── πŸ“‚ MacBook_04-12-2021_1638581744 +β”‚ β”œβ”€β”€ πŸ“‚ .oh-my-zsh +β”‚ β”‚ └── πŸ“‚ custom +β”‚ β”œβ”€β”€ πŸ“‚ Sites +β”‚ β”‚ └── πŸ“‚ My-site +β”‚ β”œβ”€β”€ _config.cfg +β”‚ β”œβ”€β”€ .gitconfig +β”‚ β”œβ”€β”€ .npmrc +β”‚ └── .zshrc +β”‚ +└── πŸ“‚ dotfiles + β”œβ”€β”€ πŸ“‚ .oh-my-zsh + β”‚ └── πŸ“‚ custom + β”œβ”€β”€ πŸ“‚ Sites + β”‚ └── πŸ“‚ My-site + β”œβ”€β”€ .gitconfig + β”œβ”€β”€ .otherconfig + β”œβ”€β”€ .npmrc + └── .zshrc +``` + +`πŸ“‚ _Backup_default_config` + +This folder contains folders with backups of the original files of your devices. +πŸ’‘ Note: A backup happens every time you start MacSync. + +`πŸ“‚ _Backup_default_config/'your-device_date_timestamp'` + +These folders contain the actual backups of the original files themselves. +They will also store your `config.cfg` + +πŸ’‘ Note: The "original files" are those that are specified in the config file: +`BACKUP_FILES=(Sites/mySite .oh-my-zsh/custom .gitconfig .zshrc .npmrc)` + +`πŸ“‚ dotfiles` + +This folder contains files that are synced between your devices. + +## How it works + +What happens when you start syncing on your device for the first time: + +1. The application creates the required folders. +1. Takes a list of your files and makes a backup. +1. Then it moves your files to the sync folder `πŸ“‚ dotfiles` +1. Instead of your files, symlinks are created on your device to the original files in the sync folder. + +This way, all your devices can be connected to the same files. 😎 + +## License + +MIT Β© [Pilaton](https://github.com/Pilaton) diff --git a/bin/dotfile.zsh b/bin/dotfile.zsh new file mode 100644 index 0000000..2453e8f --- /dev/null +++ b/bin/dotfile.zsh @@ -0,0 +1,309 @@ +#!/usr/bin/env zsh +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# File: dotfile.zsh +# +# Name: MacSync +# Description: A simple solution to sync your settings and dotfiles. +# +# Author: Pilaton +# GitHub: https://github.com/Pilaton/MacSync +# Bugs: https://github.com/Pilaton/MacSync/issues +# License: MIT +# +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +# Save the path to the MacSync folder in a variable +ROOT_FOLDER_PROJECT=$PWD + + +####################################### +# Simple progress bar with a length of 27 dashes :) +####################################### +progressbar() { + local BAR='---------------------------' + for i in {1..27}; do + echo -ne "\r${BAR:0:$i}" + sleep .03 + done + echo "" +} + +####################################### +# Check if the "dotfiles" folder exists +# Globals: +# SYNC_FOLDER +# Returns: +# 0 (true) if the folder exists +# 1 (false) if does not exist +####################################### +checkDtofilesFolder() { + if [[ -d ${SYNC_FOLDER}/dotfiles ]]; then + return 0 + fi + return 1 +} + +####################################### +# We check if the files for synchronization actually exist, written in the variable "BACKUP_FILES = (...)" +# Globals: +# BACKUP_FILES +# _BACKUP_VALID_FILES +# Returns: +# 0 (true) if there are files to sync +# 1 (false) if there are no files +####################################### +checkSynchronizedFiles() { + echo "${colorYellow}${bold}Checking synchronized files${reset}" + echo "---------------------------" + _BACKUP_VALID_FILES=() # Write valid files here + local NOT_VALID_FILES=() # And here are not valid + + for file in "${BACKUP_FILES[@]}"; do + # Check that the file or folder exists and is not a symlink + if [[ -e ${file} ]] && ! [[ -L ${file} ]]; then + _BACKUP_VALID_FILES+=(${file}) + echo "${file} - ${colorGreen}OK${reset}" + else + NOT_VALID_FILES+=("${file}") + echo "${file} - ${colorRed}Not OK${reset}" + fi + sleep 0.2 + done + + echo "---------------------------" + + if (( ${#NOT_VALID_FILES[@]} )); then + echo "πŸ”Έ ${colorCian}(${NOT_VALID_FILES[@]})${reset} β€” Will be skipped. The files do not exist or are symbolic links." + fi + + if (( ${#_BACKUP_VALID_FILES[@]} )); then + echo "πŸ”Έ List of files to sync: ${colorGreen}(${_BACKUP_VALID_FILES[@]})${reset}" + progressbar + return 0 + else + progressbar + echo "${colorRed}No files to sync${reset}" + return 1 + fi +} + +####################################### +# Create a folder for backup device files +# Globals: +# SYNC_FOLDER +# _BACKUP_DEFAULT_FOLDER +####################################### +createBackupFolder() { + mkdir -p "${SYNC_FOLDER}/${_BACKUP_DEFAULT_FOLDER}" +} + +####################################### +# Create a folder to sync files +# Globals: +# SYNC_FOLDER +####################################### +createDotfilesFolder() { + mkdir -p "${SYNC_FOLDER}/dotfiles" +} + +####################################### +# Backup the config.cfg file and rename it by adding an underscore +# Globals: +# ROOT_FOLDER_PROJECT +# SYNC_FOLDER +# _BACKUP_DEFAULT_FOLDER +####################################### +backupConfigFile() { + rsync -aq "${ROOT_FOLDER_PROJECT}/config/config.cfg" "${SYNC_FOLDER}/${_BACKUP_DEFAULT_FOLDER}" + mv "${SYNC_FOLDER}/${_BACKUP_DEFAULT_FOLDER}/config.cfg" "${SYNC_FOLDER}/${_BACKUP_DEFAULT_FOLDER}/_config.cfg" +} + +####################################### +# Backup of original user files specified in the "BACKUP_FILES = (...)" variable +# Globals: +# SYNC_FOLDER +# _BACKUP_DEFAULT_FOLDER +# Arguments: +# [text...] Backup file (path) +####################################### +backupFiles() { + rsync -aRq ${1} "${SYNC_FOLDER}/${_BACKUP_DEFAULT_FOLDER}" +} + +####################################### +# Moving valid files to the sync folder and deleting the originals in the user's home folder +# Valid files are saved by the "checkSynchronizedFiles" function into the "_BACKUP_VALID_FILES" variable +# Globals: +# SYNC_FOLDER +# Arguments: +# [text...] File to sync (path) +####################################### +moveFiles() { + rsync -auRq ${1} "${SYNC_FOLDER}/dotfiles" + rm -rf ${1} +} + +####################################### +# Deleting original files in the user's home folder, if such files are found in the sync folder +# Globals: +# SYNC_FOLDER +# Arguments: +# [text...] File to sync (path) +####################################### +deleteSyncedFilesFromMyPC() { + if [[ -d ${SYNC_FOLDER}/dotfiles/${1} ]] || [[ -f ${SYNC_FOLDER}/dotfiles/${1} ]]; then + rm -rf ${1} + fi +} + +####################################### +# Creating a symlink to files in the sync folder +# Globals: +# SYNC_FOLDER +# Arguments: +# [text...] File to sync (path) +####################################### +creatingSymbolicLinks() { + ln -s "${SYNC_FOLDER}/dotfiles/${1}" ${1} +} + + + +####################################### +# Algorithm if synchronization on this device starts for the first time +# Globals: +# _BACKUP_VALID_FILES +####################################### +syncFirst() { + createDotfilesFolder + for file in "${_BACKUP_VALID_FILES[@]}"; do + backupFiles ${file} + moveFiles ${file} + creatingSymbolicLinks ${file} + done +} + +####################################### +# Algorithm if you need to completely replace files in the sync folder with new ones +# Globals: +# SYNC_FOLDER +# _BACKUP_VALID_FILES +####################################### +syncWithReplace() { + rm -rf "${SYNC_FOLDER}/dotfiles" + createDotfilesFolder + for file in "${_BACKUP_VALID_FILES[@]}"; do + backupFiles ${file} + moveFiles ${file} + creatingSymbolicLinks ${file} + done +} + +####################################### +# Algorithm if you need to update obsolete files in the sync folder with newer ones +# Globals: +# _BACKUP_VALID_FILES +####################################### +syncWithUpdate() { + for file in "${_BACKUP_VALID_FILES[@]}"; do + backupFiles ${file} + moveFiles ${file} + creatingSymbolicLinks ${file} + done +} + +####################################### +# Algorithm if you need to connect this device to the sync folder without changing anything in it +# Globals: +# _BACKUP_VALID_FILES +####################################### +syncWithDownload() { + for file in "${_BACKUP_VALID_FILES[@]}"; do + backupFiles ${file} + deleteSyncedFilesFromMyPC ${file} + creatingSymbolicLinks ${file} + done +} + + + + +####################################### +# Start file synchronization +# Arguments: +# [text...] (first_sync, replace, update, download) +####################################### +startSyncDot() { + # Check if there are valid files for synchronization + if ! checkSynchronizedFiles; then + echo "...exit" + exit + fi + + createBackupFolder + backupConfigFile + + case "${1}" in + "first_sync") echo "Sync..." ; syncFirst ;; + "replace") echo "Replace..." ; syncWithReplace ;; + "update") echo "Update..." ; syncWithUpdate ;; + "download") echo "Download..."; syncWithDownload ;; + esac + echo "Done!" +} + +####################################### +# Selection of synchronization options, if it is not the first time (if the folder of dotfiles exists) +# Globals: +# SYNC_FOLDER +####################################### +chooseNextStep() { + echo "${colorYellow}${bold}The '${SYNC_FOLDER}/dotfiles' already exists.${reset}" + echo "${colorYellow}${bold}How will we connect to the sync folder?${reset}" + + echo "1 β€” Connect and replace all files in it" + echo "2 β€” Connect and update obsolete files" + echo "3 β€” Connect only" + echo "4 - Cancel" + echo "" + + while true; do + echo -n "Your reply: " + read -r res + echo "" + case $res in + [1]) startSyncDot "replace" ; return 0 ;; + [2]) startSyncDot "update" ; return 0 ;; + [3]) startSyncDot "download"; return 0 ;; + [4]) echo "...Cancel" && exit ;; + esac + done +} + +####################################### +# Disable file synchronization +# Deleting with a symlink on synchronization files and returning the original files to the user's home folder +# Globals: +# BACKUP_FILES +# SYNC_FOLDER +####################################### +disableSyncDot() { + echo "${colorYellow}${bold}Restoring original files and turning off sync...${reset}" + echo "---------------------------" + for file in "${BACKUP_FILES[@]}"; do + + # Check if the file is a symlink and if the original exists in the sync folder + if [[ -L ${file} ]] && [[ -e ${SYNC_FOLDER}/dotfiles/${file} ]]; then + rm -rf ${file} + rsync -aRq "${SYNC_FOLDER}/dotfiles/./${file}" ~ + echo "${file} β€” ${colorGreen}restored${reset}" + else + echo "${file} β€” ${colorRed}not found in sync folder${reset}" + fi + sleep 0.2 + done + progressbar + echo "Done!" +} diff --git a/bin/install.zsh b/bin/install.zsh new file mode 100644 index 0000000..5cf5f10 --- /dev/null +++ b/bin/install.zsh @@ -0,0 +1,137 @@ +#!/usr/bin/env zsh +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# File: install.zsh +# +# Usage: zsh ./bin/install.zsh +# +# Name: MacSync +# Description: A simple solution to sync your settings and dotfiles. +# +# Author: Pilaton +# GitHub: https://github.com/Pilaton/MacSync +# Bugs: https://github.com/Pilaton/MacSync/issues +# License: MIT +# +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +# Set colors if "tput" is present in the system +if [[ ! -z $(which tput 2> /dev/null) ]]; then + bold=$(tput bold) + colorRed=$(tput setaf 1) + colorGreen=$(tput setaf 2) + colorYellow=$(tput setaf 3) + colorBlue=$(tput setaf 4) + colorCian=$(tput setaf 6) + colorWhite=$(tput setaf 7) + reset=$(tput sgr0) + # Array of colors for coloring the main logo + arrayColor=( + "${colorBlue}" + "${colorWhite}" + "${colorRed}" + ) +fi + +# Connecting files and switching to the user's home directory. All work is done from it +source ./config/config.cfg +source ./bin/dotfile.zsh +cd ~ || exit + + + +####################################### +# Checking the completeness of important fields in the config.cfg file +# Globals: +# SYNC_FOLDER +# _NAME_PC +# _BACKUP_DEFAULT_FOLDER +# BACKUP_FILES +# Returns: +# exit if not all fields are filled +####################################### +checkConfigFile() { + importantConfigFields=(${#SYNC_FOLDER} ${#_NAME_PC} ${#_BACKUP_DEFAULT_FOLDER} ${#BACKUP_FILES}) + + for field in "${importantConfigFields[@]}"; do + if [[ ${field} == '0' ]]; then + echo "OOPS..." + echo "${colorRed}There are empty fields in config.cfg. Please fill them in.${reset}" + echo "...Exit" && exit + fi + done +} +checkConfigFile + +####################################### +# Let's initialize synchronization. If synchronization was performed earlier, we offer options +####################################### +initSync() { + if ! checkDtofilesFolder; then + startSyncDot "first_sync" + else + chooseNextStep + fi +} + +####################################### +# We stop synchronizing files on this device, delete symlinks and return the originals of the files +# Globals: +# SYNC_FOLDER +####################################### +disableSync() { + if ! checkDtofilesFolder; then + echo "${colorRed}Dotfile sync folder not found...${reset}" + echo "(${SYNC_FOLDER}/dotfiles)" + echo "...Exit" && exit + fi + + disableSyncDot +} + +####################################### +# The welcome screen and the choice of the next step - sync files or vice versa, disable sync +####################################### +welcomeScreen() { + printf ' \n' + printf ' \n' + printf '%s888b d888 %s .d8888b. %s %s \n' ${arrayColor} ${reset} + printf '%s8888b d8888 %s d88P Y88b %s %s \n' ${arrayColor} ${reset} + printf '%s88888b.d88888 %s Y88b. %s %s \n' ${arrayColor} ${reset} + printf '%s888Y88888P888 8888b. .d8888b%s "Y888b. 888 888 %s88888b. .d8888b %s \n' ${arrayColor} ${reset} + printf '%s888 Y888P 888 "88b d88P" %s "Y88b. 888 888 %s888 "88b d88P" %s \n' ${arrayColor} ${reset} + printf '%s888 Y8P 888 .d888888 888 %s "888 888 888 %s888 888 888 %s \n' ${arrayColor} ${reset} + printf '%s888 " 888 888 888 Y88b. %s Y88b d88P Y88b 888 %s888 888 Y88b. %s \n' ${arrayColor} ${reset} + printf '%s888 888 "Y888888 "Y8888P%s "Y8888P" "Y88888 %s888 888 "Y8888P %s \n' ${arrayColor} ${reset} + printf '%s %s 888 %s %s \n' ${arrayColor} ${reset} + printf '%s %s Y8b d88P %s %s \n' ${arrayColor} ${reset} + printf '%s %s "Y88P" %s %s \n' ${arrayColor} ${reset} + + echo "${bold}Welcome my friends!${reset}" + echo "Ready to sync your files? ;)" + echo "" + echo "β€” If you forgot how to work with me, you can see here: https://github.com/Pilaton/MacSync" + echo "---------------------------" + echo "" + echo "${colorYellow}${bold}What do we do? ${reset}" + echo "1 β€” Synchronize my files!" + echo "2 β€” Disable sync (if enabled)" + echo "3 β€” Cancel" + echo "" + + while true; do + echo -n "Your reply: " + + read -r reply + echo "" + case $reply in + [1]) initSync ; return 0 ;; + [2]) disableSync ; return 0 ;; + [3]) echo "...Exit" && exit ;; + esac + done + + +} +welcomeScreen diff --git a/config/config.cfg b/config/config.cfg new file mode 100644 index 0000000..6063e2f --- /dev/null +++ b/config/config.cfg @@ -0,0 +1,39 @@ +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# File: config.cfg +# +# Name: MacSync +# Description: A simple solution to sync your settings and dotfiles. +# +# Author: Pilaton +# GitHub: https://github.com/Pilaton/MacSync +# Bugs: https://github.com/Pilaton/MacSync/issues +# License: MIT +# +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +########### DEFAULT CONFIG ############ + +# The name of your device for naming the backup folder +_NAME_PC=$(scutil --get LocalHostName) + +# The path and name of the backup folder +_BACKUP_DEFAULT_FOLDER=_Backup_default_config/"${_NAME_PC}"_"$(date +'%d-%m-%Y')"_"$(date +%s)" + + + +########### YOUR CONFIG ############ + +# Synchronization folder path +# +# Example: ~/Dropbox/MySyncFolder +# +SYNC_FOLDER=~/Dropbox/MySyncFolder + + +# List of files and folders to sync +# File and folder paths start from the user's home directory ($ ~/) +# +# Example: BACKUP_FILES=(Sites/mySite .oh-my-zsh/custom .gitconfig .zshrc .npmrc) +# +BACKUP_FILES=(Sites/mySite .oh-my-zsh/custom .gitconfig .zshrc .npmrc) diff --git a/doc/images/MacSync-folder-structure.svg b/doc/images/MacSync-folder-structure.svg new file mode 100644 index 0000000..fe4d9b5 --- /dev/null +++ b/doc/images/MacSync-folder-structure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/doc/images/MacSync-usage.svg b/doc/images/MacSync-usage.svg new file mode 100644 index 0000000..500d621 --- /dev/null +++ b/doc/images/MacSync-usage.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/doc/images/MacSync_logo.svg b/doc/images/MacSync_logo.svg new file mode 100644 index 0000000..74cb1db --- /dev/null +++ b/doc/images/MacSync_logo.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Easy sync + + + + M + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..81e2230 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "macsync", + "version": "0.0.0-development", + "description": "Easy sync for macOS. Dotfiles, folders, configurations, etc.", + "scripts": { + "start_install": "zsh ./bin/install.zsh", + "create-demo-folder": "zsh ./test/create-demo-folder.zsh" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Pilaton/MacSync.git" + }, + "keywords": [ + "macos", + "sync", + "synchronization", + "dotfiles", + "files", + "folder", + "cloud", + "dropbox", + "backup" + ], + "author": "pilaton <83372686+Pilaton@users.noreply.github.com> (https://github.com/Pilaton)", + "license": "MIT", + "bugs": { + "url": "https://github.com/Pilaton/MacSync/issues" + }, + "homepage": "https://github.com/Pilaton/MacSync#readme", + "os": [ + "darwin", + "linux" + ] +} diff --git a/test/create-demo-folder.zsh b/test/create-demo-folder.zsh new file mode 100644 index 0000000..609d702 --- /dev/null +++ b/test/create-demo-folder.zsh @@ -0,0 +1,5 @@ +#!/usr/bin/env zsh + +cd ~ || exit +mkdir -p demo/demo && touch demo/demo/.demo && touch .demo +echo "Done" \ No newline at end of file