Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save a local copy of gist for situation that cannot connect network #79

Open
jiminggist opened this issue Mar 31, 2013 · 10 comments
Open

Comments

@jiminggist
Copy link

Is it possible to save a copy of all gist in local? If the network is connected, using the one from gist. Otherwise we still have a copy in local and still can work.

@deiga
Copy link
Contributor

deiga commented Apr 1, 2013

It would be possible to cache gists on to disk, but there would have to be a decision on whether to cache on opening a gist or caching all gists "all the time"

Caching brings with it problems of staleness and of course takes up space

@jiminggist
Copy link
Author

The staleness is easy, in case we are connection to the internet, using the online version from gist ALL the time, just ignore and update the local cache. In offline mode, using cache then.

@deiga
Copy link
Contributor

deiga commented Apr 1, 2013

Yes, that would get rid of staleness, but it would also annihilate the actual use of caching, since getting the gists is pretty slow even for a few gists.

I'd be much more inclined to actually cache gists and use local files and check for new version when opening them or something similar.

@jiminggist
Copy link
Author

Yes, it's better! Especially you can update all items in gist into local.

@oliveagle
Copy link

what about this plan?

  1. create a .gists folder under $HOME, and git clone all gists of a github user using ssh protocol . e.g.: git clone [email protected]:12345.git .
  2. after Gist plugin create a gist finished normally, just clone the newly create gist into .gists folder.
  3. if user fire an open gist command, use cloned version in .gists folder instead of accessing the api.
  4. add other two commands called update gist and update all gists. let user decide when and which to update.

p.s.:

  • https protocal will prompt for username and password when you git push. that's why I prefer ssh.
  • git clone way will not be able to modify description of the gist

@jiminggist
Copy link
Author

The idea is genius. +1.

@deiga
Copy link
Contributor

deiga commented Apr 28, 2013

Using ssh is a really bad Idea as the whole API is built around HTTPS and github tries to get people to use it. SSH needs credentials just like HTTPS so that is not a valid argument.

Forcing the user to update gist for himself is totally redundant and defeats the purpose of this plugin. It would make more sense to cache only loaded files and then comparing timestamps when opening a cached file

@condemil condemil mentioned this issue Aug 9, 2013
@condemil
Copy link
Owner

condemil commented Aug 9, 2013

Merged with issue #16

@AeroCross said:

Thank you (and anyone who has contributed to this plugin, too) for such a magnificent plugin. It's saving lives, I tell you.

This isn't an issue — it's more of a feature suggestion.

I was wondering if there's any change to add offline access of some sort. Since gists need internet connection, it could be useful if the snipped is saved elsewhere — if there's access, check and update if necesary, but if there's not, just use the cached version.

@condemil condemil closed this as completed Aug 9, 2013
@condemil condemil reopened this Aug 9, 2013
@sergiitk
Copy link

I use gisty set on cron in order to sync all my gists.

However, it would be really awesome at least to be able to create a mapping between gist repos and Sublime Gist plugin.
I mean, it's good to have ~/.gists directory, but sometimes I directly backup local files to gist.github (f.e. ~/.gitconfig). It works well when I create gist from a file; it's possible to update it, but, unfortunately, Gist plugin loses its internal mappings after restart.

So far the best I came for syncing files back up with is zsh oneliner:

cd $GISTY_DIR/91f354bfe4a4c9a82a46; git pull -q origin master; \
cp ~/.gitconfig .; git commit -v -a -e -m "$(date)" && git push origin master

Plus, I have custom script which automatically pushes changes for choosen Sublime user settings files.
Anyway, contact me if you would like a hand with gisty setup (I use encapsulated rvm wrapper) or so on.

@sunnycmf
Copy link

hello guys, this is a really useful features that can be included in the plugin.
seems the repo isn't active development anymore,

guys, how about we pick this up and work it out together?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants