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

Mike Youngstrom <youngm@...>

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


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

After reading Dan's post
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

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. 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

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