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

gpm install: cache downloads (enhancement request) #1243

Open
mplx opened this issue Jan 11, 2017 · 4 comments
Open

gpm install: cache downloads (enhancement request) #1243

mplx opened this issue Jan 11, 2017 · 4 comments

Comments

@mplx
Copy link

mplx commented Jan 11, 2017

I'd like to request two features for the grav package manager regarding installation of themes and plugins.

  1. cache downloads

gpm install will always download the plugin or theme. Maybe it would be possible to cache downloads in user home like composer does (i.e. download to ~/.grav/cache), if requested file is present in the cache it would be (optionally?) verifyed but not downloaded again and taken from there.

  1. version parameter

Currently gpm install only installs the latest tagged version. There are several scenarios where it is usefull to install a specific version of a plugin/theme so I'd like to propose a --version parameter to install a specific tag/branch/commit.

  • install the latest commit of a branch (--version=dev-master), ie. a commit has not been tagged yet (like hpstr theme has been tagged 1.5.0 in July 2016 but fixed in September)
  • install an older version (--version=1.1.0, --version=6a0ffcc), i.e. due to compatibility issues like if a deploy script would install an older grav version than current the required plugin/theme version is not sticky and may result in errors One of the packages require Grav >=1.1.9. Please update Grav to the latest release.
@w00fz
Copy link
Member

w00fz commented Jan 11, 2017

I like the idea of caching the packages downloaded. It might not really be that beneficial if you only run 1 site as all you would do is caching new releases after new releases. Although if you have more than 1 instance this could be quite useful and a bandwidth saver.

We would have to take into consideration a cleanup mechanism as well because we don't want the cache folder to just grow unconditionally, especially so considering most hosting services have a quota limit.

Re your second suggestion, not sure you are aware that this is already possible via direct-install (more details: bin/gpm help direct-install).

@mplx
Copy link
Author

mplx commented Jan 11, 2017

@w00fz, thanks for the direct-install hint, I wasn't aware of this :/ a quick test with bin/gpm direct-install https://github.com/getgrav/grav-theme-hpstr/archive/6a0ffccd43a157e523b4536065382e3381ee22ae.zip worked like a charm, so this is definitly a fix for my issue :) +1

Maybe a parameter --version would still be nice for official plugins/themes for convenience issues and could be expanded in future (i.e. --version=1.2.* to allow bugfixes for a plugin but no new features which might break an interface)

@mplx
Copy link
Author

mplx commented Jan 11, 2017

request 2 of this issue (--version) is related/duplicate to #1200 and #880 so this issue should be just about the download cache anymore

@mplx mplx changed the title gpm install enhancement request gpm install: cache downloads (enhancement request) Jan 11, 2017
@mahagr
Copy link
Member

mahagr commented Jan 12, 2017

👍 on caching files locally, mostly because of its really useful also on automated build system as well.

There are a few things to consider:

  1. Cache also meta-information of all packages (across all installations, not just into sites cache)
  2. If server cannot be contacted, user should still be able to see available packages and install cached extensions (nice if you're working offline or behind firewall)
  3. There's not always home folder available; caching should also work as www-data and other non-users
  4. Option to pre-fill cache without installing package: bin/gpm download admin

On --version I fully agree it would be useful. In Joomla my biggest grief for many years is that I can only update Joomla to the latest version. What if you have customizations in your site, which only works with an older release? You may want to update your site to the latest working version and deal with the code changes later when you have some extra time to do it.

@rhukster rhukster mentioned this issue Feb 6, 2017
10 tasks
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

3 participants