Skip to content

Conversation

@bdclark
Copy link

@bdclark bdclark commented May 24, 2014

This PR was created to address two issues... successfully installing a ruby as a non-privileged user (eg. to ~/.rubies with proper ownership) and to allow patched installations.

To install a ruby as a non-root user (eg. as vagrant:vagrant into ~/.rubies), we need to be able to pass the --no-install-deps flag to ruby-install. Otherwise the run will likely puke when ruby-install is executed as non-root and attempts to sudo to install deps (well, at leat in my test env). To allow for patched installs, we need the --patch option. In addition to these options, I also added some others for the sake of completeness (though not all of them).

I also included a commit that contains a test cookbook user_ruby and related test-kitchen suites and serverspec tests to exemplify the items mentioned above. This includes a) installing a ruby as vagrant to its home directory, and b) installing a patched ruby 2.0 into Ubuntu-14.04 (which is otherwise impossible to install due to issues w/ readline).

The user_ruby test cookbook includes some comments to give an example pattern of installing a ruby to a user's home directory. As long as the install_deps attribute is exposed in the LWRP, this should address issue #1. With it, the only attributes needed to install a ruby is the username of an (existing) user and the actual ruby to be installed. The rest can be determined with some help from our good friend etc.

As a side note, some of the logic included in the user_ruby test cookbook could be integrated directly into the LWRP, albeit at the possible expense of making it slightly more "opinionated". I guess it depends on whether the intent is to leave it all up to the implementer, or to provide reasonable (and overridable) defaults that mimic the actual ruby-install command. I'll save that for another comment/issue.

Please feel free to merge, cherry-pick, provide feedback for edits, etc.

Brian Clark added 2 commits May 24, 2014 14:11
- 'install_deps' attribute (bool, default true) provides for execution as a
  non-priveleged user without worrying about ruby-install attempting to sudo.
- Additional ruby-install options including patch, source_dir, mirror, url, md5
  included as optional attributes for additional completeness
…talls

- user_ruby test cookbook has attributes and recipe for testing non-root
  ruby installs as well as patched installs
- test-kitchen suite and serverspec test for installing ruby as vagrant
  user into into ~/.rubies
- test-kitchen suite and serverspec test for installing a patched ruby 2.0
  into Ubuntu-14.04 (problematic otherwise due to readline issues)
@rosstimson
Copy link
Owner

This looks like awesome work. Please give me a day or two to test this and get a new release out. Thanks you very much!

@bdclark
Copy link
Author

bdclark commented May 30, 2014

Thanks! (and sorry for the delayed response). You might want to sit on this PR and leave it open for a while. I took the liberty of banging around on your LWRP today and hope to push something this weekend. It should include most everything addressed in this PR, but should deal with most of it within the LWRP itself. I hope to have some unit and integration tests done this weekend (almost there).

Current progress is here

@rosstimson
Copy link
Owner

@bdclark Still sitting on this. Is this something you are still looking at doing when you get some time or shall I just look to pull in what we've got here?

@bdclark
Copy link
Author

bdclark commented Jul 14, 2014

Sorry about that @rosstimson... got a new job recently and have been overwhelmed. For now let's ignore my last comment, I'll drop my second wip branch and possibly revisit later. I'll leave this PR intact, so feel free to move forward with it if you want to. Thx!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants