github.com/asifdxtreme/cli@v6.1.3-0.20150123051144-9ead8700b4ae+incompatible/README.md (about)

     1  Cloud Foundry CLI [![Build Status](https://travis-ci.org/cloudfoundry/cli.png?branch=master)](https://travis-ci.org/cloudfoundry/cli)
     2  =================
     3  
     4  This is the official command line client for Cloud Foundry.
     5  
     6  You can follow our development progress on [Pivotal Tracker](https://www.pivotaltracker.com/s/projects/892938).
     7  
     8  Getting Started
     9  ===============
    10  Download and run the installer for your platform from the [Downloads Section](#downloads).
    11  
    12  Once installed, you can log in and push an app.
    13  ```
    14  $ cd [my-app-directory]
    15  $ cf api api.[my-cloudfoundry].com
    16  Setting api endpoint to https://api.[my-cloudfoundry].com...
    17  OK
    18  
    19  $ cf login
    20  API endpoint: https://api.[my-cloudfoundry].com
    21  
    22  Email> [my-email]
    23  
    24  Password> [my-password]
    25  Authenticating...
    26  OK
    27  
    28  $ cf push
    29  ```
    30  #Further Reading and Getting Help
    31  You can find further documentation at the docs page for the CLI [here](http://docs.cloudfoundry.org/devguide/#cf).
    32  There is also help available in the CLI itself; type `cf help` for more information.
    33  Each command also has help output available via `cf [command] --help` or `cf [command] -h`.
    34  Finally, if you are still stuck, feel free to open a GitHub issue.
    35  
    36  Downloads
    37  =========
    38  **WARNING:** Edge binaries are published with each new 'push' that passes though CI. These binaries are *not intended for wider use*; they're for developers to test new features and fixes as they are completed.
    39  
    40  | Stable Installers | Stable Binaries | Edge Binaries |
    41  | :---------------: |:---------------:| :------------:|
    42  | [Mac OS X 64 bit](https://cli.run.pivotal.io/stable?release=macosx64&source=github) | [Mac OS X 64 bit](https://cli.run.pivotal.io/stable?release=macosx64-binary&source=github) | [Mac OS X 64 bit](https://cli.run.pivotal.io/edge?arch=macosx64&source=github) |
    43  | [Windows 32 bit](https://cli.run.pivotal.io/stable?release=windows32&source=github) | [Windows 32 bit](https://cli.run.pivotal.io/stable?release=windows32-exe&source=github) | [Windows 32 bit](https://cli.run.pivotal.io/edge?arch=windows32&source=github) |
    44  | [Windows 64 bit](https://cli.run.pivotal.io/stable?release=windows64&source=github) | [Windows 64 bit](https://cli.run.pivotal.io/stable?release=windows64-exe&source=github) | [Windows 64 bit](https://cli.run.pivotal.io/edge?arch=windows64&source=github) |
    45  | [Redhat 32 bit](https://cli.run.pivotal.io/stable?release=redhat32&source=github) | [Linux 32 bit](https://cli.run.pivotal.io/stable?release=linux32-binary&source=github) | [Linux 32 bit](https://cli.run.pivotal.io/edge?arch=linux32&source=github) |
    46  | [Redhat 64 bit](https://cli.run.pivotal.io/stable?release=redhat64&source=github) | [Linux 64 bit](https://cli.run.pivotal.io/stable?release=linux64-binary&source=github) | [Linux 64 bit](https://cli.run.pivotal.io/edge?arch=linux64&source=github) |
    47  | [Debian 32 bit](https://cli.run.pivotal.io/stable?release=debian32&source=github)
    48  | [Debian 64 bit](https://cli.run.pivotal.io/stable?release=debian64&source=github)
    49  
    50  
    51  **Experimental:** Install CF for OSX through [Homebrew](http://brew.sh/) via the [pivotal's homebrew-tap](https://github.com/pivotal/homebrew-tap):
    52  
    53  ```
    54  $ brew tap pivotal/tap
    55  $ brew install cloudfoundry-cli
    56  ```
    57  
    58  **Releases:** Information about our releases can be found [here](https://github.com/cloudfoundry/cli/releases)
    59  
    60  Troubleshooting / FAQs
    61  ======================
    62  
    63  Known Issues
    64  ------------
    65  * .cfignore used in `cf push` must be in UTF8 encoding for CLI to interpret correctly.
    66  
    67  Linux
    68  -----
    69  * "bash: .cf: No such file or directory". Ensure that you're using the correct binary or installer for your architecture. See http://askubuntu.com/questions/133389/no-such-file-or-directory-but-the-file-exists
    70  
    71  Filing Bugs
    72  ===========
    73  
    74  ##### For simple bugs (eg: text formatting, help messages, etc), please provide
    75  
    76  - the command you ran
    77  - what occurred
    78  - what you expected to occur
    79  
    80  ##### For bugs related to HTTP requests or strange behavior, please run the command with env var `CF_TRACE=true` and provide
    81  
    82  - the command you ran
    83  - the trace output
    84  - a high-level description of the bug
    85  
    86  ##### For panics and other crashes, please provide
    87  
    88  - the command you ran
    89  - the stack trace generated (if any)
    90  - any other relevant information
    91  
    92  Forking the repository for development
    93  ======================================
    94  
    95  1. Install [Go](https://golang.org)
    96  1. [Ensure your $GOPATH is set correctly](http://golang.org/cmd/go/#hdr-GOPATH_environment_variable)
    97  1. Install [godep](https://github.com/tools/godep)
    98  1. Get the cli source code: `go get github.com/cloudfoundry/cli`
    99    * (Ignore any warnings about "no buildable Go source files")
   100  1. Run `godep restore` (note: this will modify the dependencies in your $GOPATH)
   101  1. Fork the repository
   102  1. Add your fork as a remote: `cd $GOPATH/src/github.com/cloudfoundry/cli && git remote add your_name https://github.com/your_name/cli`
   103  
   104  Building
   105  ========
   106  To prepare your build environment, run `go get github.com/jteeuwen/go-bindata/...`
   107  
   108  1. Run `./bin/build`
   109  1. The binary will be built into the `./out` directory.
   110  
   111  Optionally, you can use `bin/run` to compile and run the executable in one step.
   112  
   113  Developing
   114  ==========
   115  
   116  1. Install [Mercurial](http://mercurial.selenic.com/)
   117  1. Run `go get code.google.com/p/go.tools/cmd/vet`
   118  1. Write a Ginkgo test.
   119  1. Run `bin/test` and watch the test fail.
   120  1. Make the test pass.
   121  1. Submit a pull request to the `master` branch.
   122  
   123  _*_ For development guide on writing a cli plugin, see [here](https://github.com/cloudfoundry/cli/tree/master/plugin_examples)
   124  
   125  
   126  Contributing
   127  ============
   128  
   129  Major new feature proposals are given as a publically viewable google document with commenting allowed and discussed on the [vcap-dev](https://groups.google.com/a/cloudfoundry.org/forum/#!forum/vcap-dev) mailing list.
   130  
   131  Pull Requests
   132  ---------------------
   133  
   134  Pull Requests should be made against the `master` branch.
   135  
   136  Architecture overview
   137  ---------------------
   138  
   139  A command is a struct that implements this interface:
   140  
   141  ```
   142  type Command interface {
   143  	Metadata() command_metadata.CommandMetadata
   144  	GetRequirements(requirementsFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error)
   145  	Run(c *cli.Context)
   146  }
   147  ```
   148  
   149  `Metadata()` is just a description of the command name, usage and flags:
   150  ```
   151  type CommandMetadata struct {
   152  	Name            string
   153  	ShortName       string
   154  	Usage           string
   155  	Description     string
   156  	Flags           []cli.Flag
   157  	SkipFlagParsing bool
   158  }
   159  ```
   160  
   161  `GetRequirements()` returns a list of requirements that need to be met before a command can be invoked.
   162  
   163  `Run()` is the method that your command implements to do whatever it's supposed to do. The `context` object
   164  provides flags and arguments.
   165  
   166  When the command is run, it communicates with api using repositories (they are in `cf/api`).
   167  
   168  Dependencies are injected into each command, so tests can inject a fake. This means that dependencies are
   169  typically declared as an interface type, and not a concrete type. (see `cf/commands/factory.go`)
   170  
   171  Some dependencies are managed by a repository locator in `cf/api/repository_locator.go`.
   172  
   173  Repositories communicate with the api endpoints through a Gateway (see `cf/net`).
   174  
   175  Models are data structures related to Cloud Foundry (see `cf/models`). For example, some models are
   176  apps, buildpacks, domains, etc.
   177  
   178  
   179  Managing dependencies
   180  ---------------------
   181  
   182  Command dependencies are managed by the commands factory. The app uses the command factory (in `cf/commands/factory.go`)
   183  to instantiate them, this allows not sharing the knowledge of their dependencies with the app itself.
   184  
   185  As for repositories, we use the repository locator to handle their dependencies. You can find it in `cf/api/repository_locator.go`.
   186  
   187  Example command
   188  ---------------
   189  
   190  Create Space is a good example of a command. Its tests include checking arguments, requiring the user
   191  to be logged in, and the actual behavior of the command itself. You can find it in `cf/commands/space/create_space.go`.
   192  
   193  Current conventions
   194  ===================
   195  
   196  Creating Commands
   197  -----------------
   198  
   199  Resources that include several commands have been broken out into their own sub-package using the Resource name. An example
   200  of this convention is the Space resource and package (see `cf/commands/space`)
   201  
   202  In addition, command file and methods naming follows a CRUD like convention. For example, the Space resource includes commands
   203  such a CreateSpace, ListSpaces, DeleteSpace, etc.
   204  
   205  Creating Repositories
   206  ---------------------
   207  
   208  Although not ideal, we use the name "Repository" for API related operations as opposed to "Service". Repository was chosen
   209  to avoid confusion with Service model objects (i.e. creating Services and Service Instances within Cloud Foundry).
   210  
   211  By convention, Repository methods return a model object and an error. Models are used in both Commands and Repositories
   212  to model Cloud Foundry data. This convention provides a consistent method signature across repositories.