Skip to content

proffapt/gsync

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 

Contributors Forks Stargazers Issues MIT License LinkedIn

gsync

Automate the unique process(by me) for syncing your configuration from your local machine to github.
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. Change.log
  6. License
  7. Contact
  8. Acknowledgments

About The Project

GSYNC is a tool for those who like to sync their configuration files in real-time to github, so how does it exactly do that? Read the code for detailed understanding.. from v1.2.1 it can be managed as if it is a kind of a service and has beautiful logs for every folder being monitored

TIP: Use it as a editor alias to open your fav editor and create your configuration file, it will do the job of syncing it to your github and automate this process for future use after you are done editing it.

(back to top)

Why linking config files ?

  • Suppose you wanna sync your .bashrc in ~/, you will have to git init your ~/ which will show everywhere (main) in your terminal and might clash with your sub directories which are some local git projects, so yeah just move it somewhere else.. link that to original location and sync the file now

(back to top)

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

You will need to install the following dependencies for the project to work.

  • fswatch for macOS; inotify-tools for GNU+Linux
  • git
    git config pull.rebase true
    git config credential.helper store
  • gh
    gh auth login
    gh auth refresh -h github.com -s delete_repo

(back to top)

Installation

Now since we are done with the setting up of environment suitable for the project to compile/run, let's install and configure the project on your system locally now.

  1. Clone the repo.
  2. Make the script executable.
  3. Add suitable alias for it.
    git clone https://github.com/proffapt/gsync.git
    cd ./gsync
    chmod +x ./gsync
    echo "alias gsync='$PWD/gsync'"
  4. Add the echoed line to your shell config file.
  5. Finally, source your config file

(back to top)

Usage

  1. Execute the help menu for script
    gsync
  1. Use cases for the script are as follows:
  • Create mode

    gsync create -c ~/config.file  -g ~/configs
  • Delete mode

    gsync delete -c ~/config.file  -g ~/configs
  • Default mode

    gsync default -g ~/configs
    gsync create -c ~/config.file
    gsync delete -c ~/config.file
  • Logs management

    gsync clear-logs -g ~/configs
    gsync clear-logs -g configs
    gsync clear-logs -g all
    gsync logs -g ~/configs
    gsync logs -g configs
    gsync logs
  • Service management

    gsync start
    gsync selective-start
    gsync stop
    gsync selective-stop
    gsync restart
    gsync status
    gsync enable
    gsync disable
  • [BONUS] Folder Syncing :)

    gsync create -c ~/random.file -g ~/folder_to_sync
    rm ~/folder_to_sync/random.file ~/random.file
  1. Now if you used create mode, edit your configuration file(config.file here), the syncscript will do it's job and sync the configuration file to specified github repo.

* See output screenshots of various cases in images folder.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Changelog

v1.3

Added or Changed

  • Completely new and robust logic for syncing changes

       - Can sync changes even when done with GUI and CLI, by any process
       - Leaves no dangling process.
    
  • Support for automatically starting the monitoring process on login

  • Elaborative and colorful logs in a separate log-file, cleared on every login

  • Super convenient logs and process/service management

  • Service management is more binocular, supports starting and stopping of individual processes specified by user

  • Also included enable and disable modes for services

Removed

  • -a argument. No need for any alias now, edit however you want
  • Old one way method of editing and syncing files
  • Shell dependency

(back to top)

License

Distributed under the BSD-2-Clause License. See LICENSE.txt for more information.

(back to top)

Contact

Arpit Bhardwaj - Twitter - Telegram - proffapt@protonmail.com

Company website: Cybernity - CybernityForum

Project Link: https://github.com/proffapt/gsync

(back to top)

Acknowledgments

(back to top)