Skip to content

Added Homebrew documentation #1186

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

Merged
merged 1 commit into from
Mar 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions docs/usage/command-line.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
# Command Line

If you want a command line version installed on your machine then you can use [Chocolatey](http://chocolatey.org) to install GitVersion
If you want a command line version installed on your machine then you can use [Chocolatey](http://chocolatey.org) or [Homebrew](https://brew.sh/) to install GitVersion.

Available on [Chocolatey](http://chocolatey.org) under [GitVersion.Portable](http://chocolatey.org/packages/GitVersion.Portable)
## Chocolatey

> choco install GitVersion.Portable
Available on [Chocolatey](http://chocolatey.org) under [GitVersion.Portable](http://chocolatey.org/packages/GitVersion.Portable).

```shell
choco install GitVersion.Portable
```

Switches are available with `GitVersion /?`

## Homebrew

To install GitVersion with [Homebrew](https://brew.sh/), type:

```shell
brew install gitversion
```

Switches are available with `gitversion --help`. Even though the documentation uses a slash `/` for all switches, you need to use a dash `-` instead, since `/` is interpreted as a root path on POSIX based operating systems.

## Output

By default GitVersion returns a json object to stdout containing all the [variables](../more-info/variables.md) which GitVersion generates. This works great if you want to get your build scripts to parse the json object then use the variables, but there is a simpler way.

`GitVersion.exe /output buildserver` will change the mode of GitVersion to write out the variables to whatever build server it is running in. You can then use those variables in your build scripts or run different tools to create versioned NuGet packages or whatever you would like to do. See [build servers](../build-server-support/build-server-support.md) for more information about this.

## Inject version metadata into the assembly
`GitVersion.exe /updateassemblyinfo` will recursively search for all `AssemblyInfo.cs` or `AssemblyInfo.vb` files in the git repo and update them.
`GitVersion.exe /updateassemblyinfo` will recursively search for all `AssemblyInfo.cs` or `AssemblyInfo.vb` files in the git repo and update them.
It will update the following assembly attributes:

* `AssemblyVersion` will be set to the `AssemblySemVer` variable.
Expand All @@ -24,15 +38,15 @@ It will update the following assembly attributes:

Note that contrary to when using the [MSBuild Task](msbuild-task.md) the attributes must already exist in the `AssemblyInfo.cs` or `AssemblyInfo.vb` files prior to calling GitVersion.

By adding `/updateassemblyinfo <filenames>` the name of AssemblyInfo file to update can be set. This switch can accept multiple files with the path to the file specified relative to the working directory.
By adding `/updateassemblyinfo <filenames>` the name of AssemblyInfo file to update can be set. This switch can accept multiple files with the path to the file specified relative to the working directory.

GitVersion can generate an assembly info source file for you if it does not already exist. Use the `/ensureassemblyinfo` switch alongside `/updateassemblyinfo <filename>`, if the filename specified does not exist it will be generated based on a known template that adds:

* `AssemblyVersion` will be set to the `AssemblySemVer` variable.
* `AssemblyFileVersion` will be set to the `MajorMinorPatch` variable with a appended `.0`.
* `AssemblyInformationalVersion` will be set to the `InformationalVersion` variable.

This can be done for *.cs, *.vb and *.fs files.
This can be done for *.cs, *.vb and *.fs files.

When requesting that GitVersion generate an assembly info file you are limited to only specifying a single `<filename>` within the `/updateassemblyinfo` switch, this is to prevent the creation of mulitple assembly info files with the same assembly version attributes. If this occurs your build will fail.

Expand All @@ -57,7 +71,7 @@ Will result in command line argument error
Will iterate through each file and update known attributes (`AssemblyVersion`, `AssemblyFileVersion`, `AssemblyInformationalVersion`).

## Override config
`/overrideconfig [key=value]` will override appropriate key from 'GitVersion.yml'.
`/overrideconfig [key=value]` will override appropriate key from 'GitVersion.yml'.

At the moment only `tag-prefix` option is supported. Read more about [Configuration](/configuration/).

Expand All @@ -67,4 +81,4 @@ It will not change config file 'GitVersion.yml'.
`GitVersion.exe /output json /overrideconfig tag-prefix=custom`

## Mono
To use on mac or linux, install `mono-complete` then just run `mono GitVersion.exe`
To use on mac or linux, install `mono-complete` then just run `mono GitVersion.exe`