Git Product home page Git Product logo

drive-sink's Introduction

Sink

Sink is a CLI synchronisation tool that enables a user to synchronise local system files and folders with their Google Drives. It follows a git CLI like approach to facilitate straight-forward and easy synchronsiation. It uses the Google Drive API to interact with the Google Drive and OAuth to verify clients.

Installation

Install from zip file:

Download and extract the drive-sink-main folder to a suitable directory and run the following commands in that folder. (It is advised to install in a virutal environment)

  cd drive-sink-main
  pip install .

Install by cloning:

Set up a new folder and then clone the repo into the folder.

  git clone https://github.com/thakreyn/drive-sink.git
  cd drive-sink-main
  pip install .

After installation, run the command sink from the environment to use the tool.

Sink-main

Script Setup

In case of a virtual environment, one might use the script inside scripts folder by replacing the path inside the sink.bat with the path of sink.exe inside your env/scripts. And then add this script to your environment variables.

Assuming the path of env/scripts is : D:\Projects\trial\env\Scripts\sink.exe

@echo off

:: Replace the <path> with the absolute path of your env/scripts folder
:startsink  
D:\Projects\trial\env\Scripts\sink.exe %*

(NOTE: Above is applicable for windows only. Linux and Mac users need to create separate scripts)

Google Drive API Setup

As the application is based on the Google Drive API, in order to use it, you need to activate the Google Drive API for your account. Following are the steps to do so :

Enable Drive API for your account

After enabling the Drive API, you need to generate credentials for your account, the following article explains the steps to generate the credentials for your account.

Generate credentials for your account

After generating the credentials, download the .json file with credentials and rename it to credentials.json and paste it in the config folder 'after' initialising a directory.

Documentation

You can type in sink in your terminal or sink --help to see all the available commands available.

  • sink init : Initialise the folder and config details
  • sink initdrive : Verify credentials and sync files to drive
  • sink scan : Scans the directory for changes in files and folders
  • sink sync : Updates/commits the changes to the drive
  • sink log : Shows the commit log
  • sink status : Shows general config information
  • sink clean : Cleans (untracks) the given folder with option to delete drive folder as well

For further options for each command, type sink <command-name> --help

Usage Demo

  1. In order to initialise a directory for synchronisation, we need to use the command sink init Sink init2
  2. (optional) You can list the files to be ignored in the ignore.txt inside .sink` folder. For ignoring folders, just use an '!' before the name.
    Sink ignore
  3. Then we paste the credentials.json file generated by Google inside the config folder in .sink.
    Sink Cred
  4. Then run sink initdrive to verify your credentials and initialise the directory on your drive. sink initdrive
  5. For just scanning the changes in the directory, we use sink scan Sink scan
  6. For syncing/commiting the changes to drive, we use the command sink sync. We can also the -m option along with sink sync to log a commit message. Sink sync
  7. To view commit messages, we can use the command sink log. Sink log can take in number of lines as an option (defalut = 5). Sink log
  8. sink status can be used to see te config details for the current directory Sink status

License

MIT

Authors

Contributing

Contributions are always welcome! Your feedback will help me grow as a developer and help me build better and more usable apps.

drive-sink's People

Contributors

thakreyn avatar

Stargazers

 avatar  avatar Priyanshu Sawarkar avatar Hevesh Lakhwani avatar Rushikesh Kundkar avatar Sandesh Sachdev avatar ebigram avatar  avatar  avatar Vishal Sharma avatar Abhay Koushal avatar  avatar  avatar  avatar Vaishnavi Rathod avatar  avatar

Watchers

 avatar  avatar

drive-sink's Issues

Drive Sync during Update

There are 2 bugs that I have found during my test :

  1. During the sync of the folder, File name are not getting printed in the terminal
  2. If the folder is deleted in the drive and an edit has been made in the file, then the changes are not been shown.
    The file should have been uploaded once again. :)

Token Refresh Issue

A refresh error is raised when a token expires. The code is somehow not able to generate a new token and thus stops authentication process

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.