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

(SDK-331) allow additional gems to be installed #178

Merged
merged 1 commit into from
Jul 20, 2017

Conversation

DavidS
Copy link
Contributor

@DavidS DavidS commented Jul 20, 2017

  • bundle install --path ignores all "system" installed gems and causes unnecessary package installs
  • bundle install (without --path) installs into GEM_HOME, which by default is non-user writeable

To still use the pre-installed packages, but allow folks to install additional gems
this sets GEM_HOME to the user's cachedir, and put all other cache locations onto GEM_PATH

See https://stackoverflow.com/a/11277228 for background

This still requires that the exact required gem versions are available in
package_cachedir.

* `bundle install --path` ignores all "system" installed gems and causes unnecessary package installs
* `bundle install` (without --path) installs into GEM_HOME, which by default is non-user writeable

To still use the pre-installed packages, but allow folks to install additional gems
this sets GEM_HOME to the user's cachedir, and put all other cache locations onto GEM_PATH

See https://stackoverflow.com/a/11277228 for background

This still requires that the exact required gem versions are available in
package_cachedir.
@DavidS
Copy link
Contributor Author

DavidS commented Jul 20, 2017

I've verified this fix on my local machine by installing a hand-built gem into the pdk native package:

david@davids:~/tmp/testmod$ pdk validate --debug
pdk (INFO): Running all available validators...
pdk (DEBUG): Using 'private/ruby/2.1.9/bin/bundle' from PDK package
[|] Checking for missing Gemfile dependenciespdk (DEBUG): Executing '/opt/puppetlabs/pdk/private/ruby/2.1.9/bin/bundle check --gemfile=/home/david/tmp/testmod/Gemfile'
[✖] Checking for missing Gemfile dependencies
The following gems are missing
 * puppet (5.0.1)
 * mcollective-client (2.11.1)
Install missing gems with `bundle install`

pdk (DEBUG): Using 'private/ruby/2.1.9/bin/bundle' from PDK package
pdk (DEBUG): Executing '/opt/puppetlabs/pdk/private/ruby/2.1.9/bin/bundle install --gemfile=/home/david/tmp/testmod/Gemfile'
[✔] Installing missing Gemfile dependencies
pdk (DEBUG): Executing '/home/david/tmp/testmod/bin/metadata-json-lint --format json /home/david/tmp/testmod/metadata.json'
[✔] Checking metadata (metadata.json)
pdk (DEBUG): Executing '/home/david/tmp/testmod/bin/rubocop --format json /home/david/tmp/testmod'
[✔] Checking Ruby code style
david@davids:~/tmp/testmod$ 

@DavidS DavidS added the bug label Jul 20, 2017
@james-stocks james-stocks merged commit 78cc976 into puppetlabs:master Jul 20, 2017
@DavidS DavidS deleted the fix-gem-home-usage branch July 20, 2017 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants