# Groundskeeper The goal of this gem is to manage the workflow related to releasing and deploying Rails applications. ## Installation Install this gem globally via: ```bash gem install groundskeeper-bitcore ``` Note: if you have multiple versions of Ruby installed (via RVM e.g.), you will need to install this gem for each of them. Additionally, to integrate with Jira you will need to set some environment variables. One standard place to do this is in the `~/.bash_profile`: ```bash export JIRA_USERNAME="my-username" export JIRA_API_TOKEN="my-token" export JIRA_SITE="https://cbit123.atlassian.net" ``` For integration with Bitbucket, [create an app password](https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html) with permissions of `Pull requests: Read Write`: ```bash export BITBUCKET_USERNAME="bitbucket_username" export BITBUCKET_APP_PASSWORD="app_password" ``` For integration with Sentry, find or create your auth token [from here](https://sentry.io/settings/account/api/auth-tokens/) with the scopes `event:admin, event:read, member:read, org:read, project:read, project:releases, team:read`: ```bash export SENTRY_AUTH_TOKEN="auth-token" export SENTRY_ORG=cbits ``` Then you will need to [install/update the Sentry CLI](https://docs.sentry.io/learn/cli/installation/). Jira integration also depends on a repository that contains metadata for projects. Clone it as follows: ```bash git clone git@github.com:NU-CBITS/project_details.git ~/.project_details ``` To integrate with Slack, set the following environment variables: ```bash SLACK_WORKSPACE SLACK_CHANNEL SLACK_TOKEN ``` ## Usage To display tag/release information about a Rails project, use the `info` command within a Rails application directory: ```bash ground info ``` To create a new release tag, use the `release` command within a Rails application directory: ```bash ground release ``` To prepare the server (only required the first time) for deployment, add nginx flag if deploying to nginx server: ```bash tag=0.0.0 stage=production ground predeploy [--nginx] ``` To deploy the release (note that `stage` is optional and will be set to staging by default): ```bash tag=0.0.0 stage=production ground deploy ``` ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`. You will then need to create a version branch `release/x.x.x` and push to version control. After merge checks pass merge the branch and pull changes into local master branch. Create and push the new tag `git tag x.x.x` and `git push origin master --tags`. Then if you have permissions, push the `.gem` file to [rubygems.org](https://rubygems.org) with `gem push