Ninny
This project is archived as it won't receive any more bug fixes, feature development, or security updates.
Ninny is a command line workflow for git with GitLab. It is maintained by the engineers of Dispatch.
We use Ninny to help us automate our development pipelines. We create weekly staging branches straight from main
, merge feature branches into the current staging branch, and deploy to our staging environment directly from the current staging branch. We date all of our staging branches with YYYY.MM.DD
appended to the end so that if we need to recreate a new staging branch mid-week (typically if the staging branch gets very out of date from main
), then we know exactly which branch is the latest.
Ninny is based off of SportsEngine's Octopolo command-line tool.
Installation
To use this gem with an application on GitLab, add this line to your project's Gemfile:
gem 'ninny'
And then execute:
$ bundle install
Then, you'll need to install the gem on your local computer:
$ gem install ninny
Usage
To use this gem with a GitLab project, you'll need to add the following information in a .ninny.yml
file in the root directory of the project:
repo_type: gitlab
gitlab_project_id: GITLAB_PROJECT_ID
deploy_branch: DEPLOY_BRANCH
The GITLAB_PROJECT_ID
can be found in the general settings of the entire project. The DEPLOY_BRANCH
is most likely your project's default branch.
Then, each developer on the project should set up a file at ~/.ninny.yml
on their computer. To help with this, they can run the following and follow the prompts:
$ ninny setup
Do you have a new GitLab private token? (Y/n) Yes # enter 'y'
Enter private token: abc123def456ghi789jk # enter your private token
User config updated!
Or, you can pass the private token in as part of the command:
$ ninny setup --token abc123def456ghi789jk # or '-t abc123def456ghi789jk' for short
User config updated!
The private token should be a personal access token for that person's GitLab account (generated here).
If that command doesn't work, then you can manually create/update that file like this:
gitlab_private_token: abc123def456ghi789jk # private token goes here
After the config files are set up, these commands are available:
# To create a new staging branch of this format: staging.YYYY.MM.DD
$ ninny new_staging
# To list the current/latest staging branch
$ ninny staging_branch
# To merge the current branch into the current/latest staging branch
$ ninny stage_up
At any point, ninny help
will show the help screen.
Development
Making Changes
- Clone or fork the repository
- Create a feature branch for your changes
- Run
bundle install
- Make your changes
- Run
bundle exec rake
to run the tests- Run
bundle exec guard
to run tests continuously as you develop
- Run
- Test the gem locally
- Run
gem build *.gemspec
to build the gem locally - Run
gem install --local ninny-X.X.X.gem
to install the gem locally
- Run
- Make a pull request back to this repository
Releasing
- Make sure the
lib/ninny/version.rb
file is updated with a new version - Run
git tag vX.X.X && git push --tag
- Run
gem build *.gemspec
- Run
gem push *.gem
to push the new version to RubyGems - Run
rm *.gem
to clean up your local repository
To set up your local machine to push to RubyGems via the API, see the RubyGems documentation.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/dispatchitinc/ninny. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Code of Conduct
Everyone interacting in the Ninny project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Contributor Covenant code of conduct.
Copyright
Copyright (c) 2019 Dispatch. See MIT License for further details.