[vcap-dev] cfenv, inspired by cf shell helper


Mike Youngstrom
 

I finally got around to using this tool. Don't know why it took me so
long. :) Nice work Ben!

Mike

On Mon, Jun 2, 2014 at 9:57 AM, Ben Hale <bhale(a)gopivotal.com> wrote:

After reading Dan's post
<https://groups.google.com/a/cloudfoundry.org/d/msg/vcap-dev/Hy1WEJ452Xc/EGudP63gIfgJ>
about cf shell helper last Friday, I was inspired. Actually, I became a
bit obsessed by the idea of switching Cloud Foundry environments. On a
daily basis I work across 3 instances of Cloud Foundry, in at least 5
different spaces so running cf api, cf login, and cf target, is a way of
life and not one I'm particularly fond of. Immediately upon seeing his
work, I recognized how similar it was to another tool I use on a daily
basis, rbenv. So this weekend I forked rbenv, created cfenv, and am
happy to announce it today.

cfenv <https://github.com/nebhale/cfenv> is a way of managing multiple
Cloud Foundry environments simultaneously, using a series of CF_HOME
directories. It allows you to choose the Cloud Foundry environment at a
global level (using a ~/.cfenv/environment file), at a project level
(using a .cf-environment file), or in a particular shell (using a
CFENV_ENVIRONMENT environment variable). An example of how I might use
cfenv:

1. Most of the day I spend pushing to my own development environment.
Therefore I've run cfenv global development to ensure that by default
I use api.run.pivotal.io/bhale/development.
2. Whenever I work on the java-buildpack-system-tests
<https://github.com/cloudfoundry/java-buildpack-system-test> I want to
push to our system test environment. Therefore, I've gone into that
project's directory and run cfenv local system-test to ensure that I
always push into api.run.pivotal.io/jbp-test/system-test.
3. Occasionally I need to push to a copy of Cloud Foundry installed
using bosh-lite to test offline buildpack behavior. When that happens
I run cfenv shell bosh-lite to ensure that I push to
api.10.244.0.34.xip.io/admin/admin without affecting any other shells.

Suffice it to say, if you're familiar with how rbenv works, you'll feel
right at home with cfenv. Please see the installation instructions
<https://github.com/nebhale/cfenv#installation> for how to install it
(and its close relative cf-build
<https://github.com/nebhale/cf-build#installation>), but for OS X
Homebrew users, TL;DR:

$ brew tap nebhale/personal
$ brew install cfenv cf-build
$ echo 'eval "$(cfenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

$ cfenv create development
$ cfenv global development
$ cf login

Please note that this project is not, in any way, associated with Pivotal
or my day job working on the Cloud Foundry Java Experience; this is just
something I've put together, and will be supporting, in my spare time.

Once again, a huge thanks goes out to Dan Mikusa for highlighting the
issue and a possible path to solving it. Hope you guys find cfenv as
useful as I do.


-Ben Hale

--
You received this message because you are subscribed to the Google Groups
"Cloud Foundry Developers" group.
To view this discussion on the web visit
https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/da357b6a-ae54-4ffc-a03a-4139fbd1643a%40cloudfoundry.org
<https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/da357b6a-ae54-4ffc-a03a-4139fbd1643a%40cloudfoundry.org?utm_medium=email&utm_source=footer>
.

To unsubscribe from this group and stop receiving emails from it, send an
email to vcap-dev+unsubscribe(a)cloudfoundry.org.