gitlab_awesome_release 0.1.0.beta5 → 0.1.0.beta6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/README.md +87 -6
- data/img/private_token.png +0 -0
- data/lib/gitlab_awesome_release/cli.rb +20 -16
- data/lib/gitlab_awesome_release/project.rb +9 -1
- data/lib/gitlab_awesome_release/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ed66cdb87806104213ff64c55a4ef882b40f4af
|
4
|
+
data.tar.gz: 4a2670019037a5bfdbd2f7a934c0230fa91196e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 210c2476ac7ab7dfb574eb2eb7258a2dc3266d82880739299f7dbaddb6ff1d55665c22518445f01a2ee964898f1e03bd907b219fa06b0f072b194d814f090fc5
|
7
|
+
data.tar.gz: bfef44f89224418257752c0888dc1cac939bc1fe7df5deb2751d673f2a5c3f84c000f03a1915103ff1eadfaa3a05998d94e89527918eee89d8064c2c8dadbf72
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
## Unreleased
|
2
|
-
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v0.1.0.
|
2
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v0.1.0.beta5...HEAD)
|
3
3
|
|
4
4
|
|
5
|
+
## v0.1.0.beta5
|
6
|
+
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v0.1.0.beta4...v0.1.0.beta5)
|
7
|
+
|
8
|
+
* Refactoring [!9](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/9) *@sue445*
|
9
|
+
* Impl marking [!10](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/10) *@sue445*
|
10
|
+
* from -> from_tag, to -> to_tag [!11](https://gitlab.com/sue445/gitlab_awesome_release/merge_requests/11) *@sue445*
|
11
|
+
|
5
12
|
## v0.1.0.beta4
|
6
13
|
[full changelog](https://gitlab.com/sue445/gitlab_awesome_release/compare/v0.1.0.beta3...v0.1.0.beta4)
|
7
14
|
|
data/README.md
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
# GitlabAwesomeRelease
|
2
|
-
|
3
|
-
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_awesome_release`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
2
|
+
Generate changelog from tags and MergeRequests on [GitLab](https://about.gitlab.com/)
|
6
3
|
|
7
4
|
[](https://badge.fury.io/rb/gitlab_awesome_release)
|
8
5
|
[](https://gitlab.com/ci/projects/9759?ref=master)
|
9
6
|
[](https://gemnasium.com/a2f4eb18c1920eb39d8e9f1f807dd830)
|
10
7
|
|
8
|
+
## Example
|
9
|
+
see [CHANGELOG.md](CHANGELOG.md)
|
10
|
+
|
11
11
|
## Requirements
|
12
12
|
|
13
|
-
* Ruby
|
13
|
+
* Ruby v2.1+
|
14
|
+
* GitLab v7.11.0+
|
14
15
|
|
15
16
|
## Installation
|
16
17
|
|
@@ -30,7 +31,87 @@ Or install it yourself as:
|
|
30
31
|
|
31
32
|
## Usage
|
32
33
|
|
33
|
-
|
34
|
+
### `create_note`
|
35
|
+
generate changelog
|
36
|
+
|
37
|
+
```sh
|
38
|
+
$ gitlab_awesome_release create_note --filename=CHANGELOG.md
|
39
|
+
```
|
40
|
+
|
41
|
+
### options
|
42
|
+
All options can be specified in both the command arguments and environment variables
|
43
|
+
|
44
|
+
* `--gitlab-api-endpoint` , `GITLAB_API_ENDPOINT` **(either one is required)**
|
45
|
+
* GitLab API endpoint (e.g. `http://example.com/api/v3`)
|
46
|
+
* `--gitlab-api-private-token` , `GITLAB_API_PRIVATE_TOKEN` **(either one is required)**
|
47
|
+
* Your private token. see [/profile/account](img/private_token.png)
|
48
|
+
* `--gitlab-project-name` , `GITLAB_PROJECT_NAME` **(either one is required)**
|
49
|
+
* Target project (e.g. `group/repo_name`)
|
50
|
+
* `--from-tag` , `FROM_TAG`
|
51
|
+
* The first tag to create a changelog
|
52
|
+
* default: oldest tag
|
53
|
+
* `--to-tag` , `TO_TAG`
|
54
|
+
* The last tag to create a changelog
|
55
|
+
* default: latest tag
|
56
|
+
* `--filename` , `FILENAME`
|
57
|
+
* Filepath to changelog file (e.g. `CHANGELOG.md`)
|
58
|
+
* if empty, output to console
|
59
|
+
* `--allow-tag-format` , `ALLOW_TAG_FORMAT`
|
60
|
+
* Tag format for release note heading (regular expresion pattern)
|
61
|
+
* default: `^v?[\d.]+`
|
62
|
+
* `--log-level` , `LOG_LEVEL`
|
63
|
+
* Log level `(debug|info|warn|error|fatal|unknown)`
|
64
|
+
* default: `info`
|
65
|
+
|
66
|
+
### marking
|
67
|
+
Add version label to MergeRequests
|
68
|
+
|
69
|
+
example) https://gitlab.com/sue445/gitlab_awesome_release/merge_requests?state=merged
|
70
|
+
|
71
|
+
```sh
|
72
|
+
$ gitlab_awesome_release marking --from-tag=v0.1.0 --to-tag=v0.2.0
|
73
|
+
```
|
74
|
+
|
75
|
+
### options
|
76
|
+
All options can be specified in both the command arguments and environment variables
|
77
|
+
|
78
|
+
* `--gitlab-api-endpoint` , `GITLAB_API_ENDPOINT` **(either one is required)**
|
79
|
+
* GitLab API endpoint (e.g. `http://example.com/api/v3`)
|
80
|
+
* `--gitlab-api-private-token` , `GITLAB_API_PRIVATE_TOKEN` **(either one is required)**
|
81
|
+
* Your private token. see [/profile/account](img/private_token.png)
|
82
|
+
* `--gitlab-project-name` , `GITLAB_PROJECT_NAME` **(either one is required)**
|
83
|
+
* Target project (e.g. `group/repo_name`)
|
84
|
+
* `--from-tag` , `FROM_TAG` **(either one is required)**
|
85
|
+
* The first tag to marking
|
86
|
+
* `--to-tag` , `TO_TAG` **(either one is required)**
|
87
|
+
* The last tag to marking
|
88
|
+
* `--label` , `LABEL`
|
89
|
+
* Label to be added to the MergeRequest
|
90
|
+
* default: `--to-tag` or `TO_TAG`
|
91
|
+
* `--log-level` , `LOG_LEVEL`
|
92
|
+
* Log level `(debug|info|warn|error|fatal|unknown)`
|
93
|
+
* default: `info`
|
94
|
+
|
95
|
+
## ProTip
|
96
|
+
Environment variables read from `~/.env.gitlab` and current `.env.gitlab`
|
97
|
+
|
98
|
+
`~/.env.gitlab`
|
99
|
+
|
100
|
+
```
|
101
|
+
GITLAB_API_ENDPOINT=http://example.com/api/v3
|
102
|
+
GITLAB_API_PRIVATE_TOKEN=XXXXXXXXXXXXXXXXXXX
|
103
|
+
ALLOW_TAG_FORMAT=^v?[\d.]+
|
104
|
+
```
|
105
|
+
|
106
|
+
current `.env.gitlab`
|
107
|
+
|
108
|
+
```
|
109
|
+
GITLAB_PROJECT_NAME=group/name
|
110
|
+
ALLOW_TAG_FORMAT=^v?[\d.]+
|
111
|
+
```
|
112
|
+
|
113
|
+
If defined both `~/.env.gitlab` and current `.env.gitlab`, current `.env.gitlab` is priority
|
114
|
+
|
34
115
|
|
35
116
|
## Development
|
36
117
|
|
Binary file
|
@@ -6,7 +6,11 @@ module GitlabAwesomeRelease
|
|
6
6
|
class CLI < Thor
|
7
7
|
DEFAULT_VERSION_FORMAT = "^v?[\\d.]+"
|
8
8
|
GITLAB_ENV_FILES = %w(.env.gitlab ~/.env.gitlab)
|
9
|
-
|
9
|
+
|
10
|
+
GITLAB_API_DESCRIPTION = "GitLab API endpoint (e.g. http://example.com/api/v3)"
|
11
|
+
GITLAB_API_PRIVATE_TOKEN_DESCRIPTION = "Your private token"
|
12
|
+
GITLAB_API_PROJECT_NAME = "Target project (e.g. group/repo_name)"
|
13
|
+
LOG_LEVEL_DESCRIPTION = "Log level (debug|info|warn|error|fatal|unknown)"
|
10
14
|
|
11
15
|
desc "version", "Show gitlab_awesome_release version"
|
12
16
|
def version
|
@@ -14,14 +18,14 @@ module GitlabAwesomeRelease
|
|
14
18
|
end
|
15
19
|
|
16
20
|
desc "create_note", "generate changelog"
|
17
|
-
option :
|
18
|
-
option :
|
19
|
-
option :
|
20
|
-
option :
|
21
|
-
option :
|
22
|
-
option :
|
23
|
-
option :allow_tag_format,
|
24
|
-
option :log_level,
|
21
|
+
option :gitlab_api_endpoint, desc: GITLAB_API_DESCRIPTION
|
22
|
+
option :gitlab_api_private_token, desc: GITLAB_API_PRIVATE_TOKEN_DESCRIPTION
|
23
|
+
option :gitlab_project_name, desc: GITLAB_API_PROJECT_NAME
|
24
|
+
option :from_tag, desc: "The first tag to create a changelog (default: oldest tag)"
|
25
|
+
option :to_tag, desc: "The last tag to create a changelog (default: latest tag)"
|
26
|
+
option :filename, desc: "Filepath to changelog file (e.g. CHANGELOG.md). if empty, output to console"
|
27
|
+
option :allow_tag_format, desc: "Tag format for release note heading (regular expresion pattern)", default: DEFAULT_VERSION_FORMAT
|
28
|
+
option :log_level, desc: LOG_LEVEL_DESCRIPTION, default: "info"
|
25
29
|
def create_note
|
26
30
|
Dotenv.load(*GITLAB_ENV_FILES)
|
27
31
|
|
@@ -38,13 +42,13 @@ module GitlabAwesomeRelease
|
|
38
42
|
end
|
39
43
|
|
40
44
|
desc "marking", "Add version label to MergeRequests"
|
41
|
-
option :
|
42
|
-
option :
|
43
|
-
option :
|
44
|
-
option :
|
45
|
-
option :
|
46
|
-
option :
|
47
|
-
option :log_level,
|
45
|
+
option :gitlab_api_endpoint, desc: GITLAB_API_DESCRIPTION
|
46
|
+
option :gitlab_api_private_token, desc: GITLAB_API_PRIVATE_TOKEN_DESCRIPTION
|
47
|
+
option :gitlab_project_name, desc: GITLAB_API_PROJECT_NAME
|
48
|
+
option :from_tag, desc: "The first tag to marking"
|
49
|
+
option :to_tag, desc: "The last tag to marking"
|
50
|
+
option :label, desc: "Label to be added to the MergeRequest"
|
51
|
+
option :log_level, desc: LOG_LEVEL_DESCRIPTION, default: "info"
|
48
52
|
def marking
|
49
53
|
Dotenv.load(*GITLAB_ENV_FILES)
|
50
54
|
|
@@ -101,8 +101,11 @@ module GitlabAwesomeRelease
|
|
101
101
|
"* #{mr.title} [!#{iid}](#{mr_url}) *@#{mr.author.username}*"
|
102
102
|
end
|
103
103
|
|
104
|
+
# find MergeRequest with iid
|
104
105
|
def merge_request(iid)
|
105
|
-
Gitlab.merge_requests(escaped_project_name, iid: iid).first
|
106
|
+
mr = Gitlab.merge_requests(escaped_project_name, iid: iid).first
|
107
|
+
assert_merge_request_iid(mr, iid) if mr
|
108
|
+
mr
|
106
109
|
end
|
107
110
|
|
108
111
|
def add_merge_request_label(mr, label)
|
@@ -136,5 +139,10 @@ module GitlabAwesomeRelease
|
|
136
139
|
str << merge_request_summary(iid) + "\n"
|
137
140
|
end
|
138
141
|
end
|
142
|
+
|
143
|
+
def assert_merge_request_iid(mr, iid)
|
144
|
+
# NOTE: MR is found, but server is old GitLab?
|
145
|
+
raise "MergeRequest iid does not match (expected #{iid}, but #{mr.iid})" unless iid == mr.iid
|
146
|
+
end
|
139
147
|
end
|
140
148
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_awesome_release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- bin/setup
|
201
201
|
- exe/gitlab_awesome_release
|
202
202
|
- gitlab_awesome_release.gemspec
|
203
|
+
- img/private_token.png
|
203
204
|
- lib/gitlab_awesome_release.rb
|
204
205
|
- lib/gitlab_awesome_release/array_within_ext.rb
|
205
206
|
- lib/gitlab_awesome_release/cli.rb
|