Skip to content

Commit

Permalink
Write readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sue445 committed Nov 14, 2015
1 parent d8b8551 commit 5ba0869
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 13 deletions.
82 changes: 69 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,89 @@
# GitlabMrRelease

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gitlab_mr_release`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem
Release MergeRequest generator for GitLab

[![Build Status](https://travis-ci.org/sue445/gitlab_mr_release.svg?branch=master)](https://travis-ci.org/sue445/gitlab_mr_release)
[![Code Climate](https://codeclimate.com/github/sue445/gitlab_mr_release/badges/gpa.svg)](https://codeclimate.com/github/sue445/gitlab_mr_release)
[![Coverage Status](https://coveralls.io/repos/sue445/gitlab_mr_release/badge.svg?branch=master&service=github)](https://coveralls.io/github/sue445/gitlab_mr_release?branch=master)
[![Dependency Status](https://gemnasium.com/sue445/gitlab_mr_release.svg)](https://gemnasium.com/sue445/gitlab_mr_release)

## Requirements

* Ruby v2.1+
* GitLab v7.11.0+

## Installation

Add this line to your application's Gemfile:
```
$ gem install gitlab_mr_release
```

## Usage
### init

```ruby
gem 'gitlab_mr_release'
Copy setting files. And edit these files.

```sh
$ gitlab_mr_release init
create .env.gitlab
create gitlab_mr_release.md.erb
```

And then execute:
### create
```sh
$ gitlab_mr_release create --source=develop --target=master
MergeRequst is created: http://example.com/your/project/merge_requests/10
```

$ bundle
description is accepetd MergeRequests between `--source` and `--target`

Or install it yourself as:
![merge_request](img/merge_request.png)

$ gem install gitlab_mr_release
detail

## Usage
```sh
$ gitlab_mr_release help create
Usage:
gitlab_mr_release create -s, --source=SOURCE -t, --target=TARGET

Options:
-s, --source=SOURCE # Source branch (e.g. develop)
-t, --target=TARGET # Target branch (e.g. master)
[--title=TITLE] # MergeRequest title (default. 'Release :source -> :target')

Create merge requrst
```

## ProTip
### .env.gitlab
Environment variables read from `~/.env.gitlab` and current `.env.gitlab`

`~/.env.gitlab`

```
GITLAB_API_ENDPOINT=http://example.com/api/v3
GITLAB_API_PRIVATE_TOKEN=XXXXXXXXXXXXXXXXXXX
TEMPLATE_FILE=gitlab_mr_release.md.erb
```

current `.env.gitlab`

```
GITLAB_PROJECT_NAME=group/name
TEMPLATE_FILE=gitlab_mr_release.md.erb
```

If defined both `~/.env.gitlab` and current `.env.gitlab`, current `.env.gitlab` is priority

### variables in template
```markdown
# MergeRequests
<% merge_requests.each do |mr| %>
* [ ] !<%= mr.iid %> <%= mr.title %>
<% end %>
```

TODO: Write usage instructions here
`merge_requests` is array of [MergeRequest](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/merge_requests.md#get-single-mr)

## Development

Expand All @@ -37,7 +93,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gitlab_mr_release.
Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/gitlab_mr_release.


## License
Expand Down
Binary file added img/merge_request.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5ba0869

Please sign in to comment.