gitlab_mr_release 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +12 -0
- data/lib/gitlab_mr_release/cli.rb +16 -5
- data/lib/gitlab_mr_release/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61e097e8b3a6fa3ce74183de3146060ca452dc4d
|
4
|
+
data.tar.gz: b773591304833694146b9e60de9a09ad37eb19be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 813dcb7a7f0cfc50f5df943e98eb46c5046f41f4ef89fe0f5fa361a24e831e33397f204b1b65831547fc9bc65a2fb37740b0b55c804102df07d77d1c765cd868
|
7
|
+
data.tar.gz: 50512479fd6a58bf347b3924241d1b9803af96fb3d50fc95ffa0613161130c27b4863c5129e31fe39e73455e87df0fc5c60f8b10277043177eaad1fdc88a8598
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## Unreleased
|
2
|
-
[full changelog](http://github.com/sue445/rubicure/compare/v0.
|
2
|
+
[full changelog](http://github.com/sue445/rubicure/compare/v0.2.0...master)
|
3
|
+
|
4
|
+
## v0.2.0
|
5
|
+
[full changelog](http://github.com/sue445/rubicure/compare/v0.1.1...v0.2.0)
|
6
|
+
|
7
|
+
* Support `DEFAULT_TITLE` with erb
|
8
|
+
* https://github.com/sue445/gitlab_mr_release/pull/11
|
3
9
|
|
4
10
|
## v0.1.1
|
5
11
|
[full changelog](http://github.com/sue445/rubicure/compare/v0.1.0...v0.1.1)
|
data/README.md
CHANGED
@@ -76,6 +76,7 @@ Environment variables read from `~/.env.gitlab` and current `.env.gitlab`
|
|
76
76
|
GITLAB_API_ENDPOINT=http://example.com/api/v3
|
77
77
|
GITLAB_API_PRIVATE_TOKEN=XXXXXXXXXXXXXXXXXXX
|
78
78
|
TEMPLATE_FILE=gitlab_mr_release.md.erb
|
79
|
+
DEFAULT_TITLE=Release <%= Time.now %> <%= source_branch %> -> <%= target_branch %>
|
79
80
|
```
|
80
81
|
|
81
82
|
current `.env.gitlab`
|
@@ -97,6 +98,17 @@ If defined both `~/.env.gitlab` and current `.env.gitlab`, current `.env.gitlab`
|
|
97
98
|
|
98
99
|
`merge_requests` is array of [MergeRequest](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/merge_requests.md#get-single-mr)
|
99
100
|
|
101
|
+
### variables in DEFAULT_TITLE
|
102
|
+
```sh
|
103
|
+
DEFAULT_TITLE=Release <%= Time.now %> <%= source_branch %> -> <%= target_branch %>
|
104
|
+
```
|
105
|
+
|
106
|
+
`DEFAULT_TITLE` supports erb.
|
107
|
+
|
108
|
+
* `source_branch` is `--source` in commandline args
|
109
|
+
* `target_branch` is `--target` in commandline args
|
110
|
+
|
111
|
+
|
100
112
|
## Development
|
101
113
|
|
102
114
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec gitlab_mr_release` to use the gem in this directory, ignoring other installed copies of this gem.
|
@@ -8,6 +8,8 @@ module GitlabMrRelease
|
|
8
8
|
|
9
9
|
GITLAB_ENV_FILES = %w(.env.gitlab ~/.env.gitlab)
|
10
10
|
|
11
|
+
DEFAULT_TITLE_TEMPLATE = "Release <%= Time.now %> <%= source_branch %> -> <%= target_branch %>"
|
12
|
+
|
11
13
|
def self.source_root
|
12
14
|
"#{__dir__}/../templates"
|
13
15
|
end
|
@@ -34,8 +36,6 @@ module GitlabMrRelease
|
|
34
36
|
assert_env("GITLAB_API_PRIVATE_TOKEN")
|
35
37
|
assert_env("GITLAB_PROJECT_NAME")
|
36
38
|
|
37
|
-
title = options[:title] || default_title
|
38
|
-
|
39
39
|
template = File.read(template_file)
|
40
40
|
|
41
41
|
project = GitlabMrRelease::Project.new(
|
@@ -47,7 +47,7 @@ module GitlabMrRelease
|
|
47
47
|
mr = project.create_merge_request(
|
48
48
|
source_branch: options[:source],
|
49
49
|
target_branch: options[:target],
|
50
|
-
title:
|
50
|
+
title: generate_title,
|
51
51
|
template: template,
|
52
52
|
)
|
53
53
|
|
@@ -73,8 +73,19 @@ MergeRequest is created
|
|
73
73
|
raise "Error: Environment variable #{name} is required" unless ENV[name]
|
74
74
|
end
|
75
75
|
|
76
|
-
def
|
77
|
-
|
76
|
+
def generate_title
|
77
|
+
return options[:title] if options[:title]
|
78
|
+
|
79
|
+
generate_default_title(
|
80
|
+
title_template: ENV["DEFAULT_TITLE"],
|
81
|
+
source_branch: options[:source],
|
82
|
+
target_branch: options[:target],
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
def generate_default_title(title_template:, source_branch:, target_branch:)
|
87
|
+
title_template ||= DEFAULT_TITLE_TEMPLATE
|
88
|
+
ERB.new(title_template).result(binding).strip
|
78
89
|
end
|
79
90
|
|
80
91
|
def template_file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_mr_release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|