gitlab_mr_release 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8af77f14d82cbb22929a4c96da8887e59a07eca
4
- data.tar.gz: 41a2cd7b9bcf208343d35f864e288e50116b76d3
3
+ metadata.gz: 67432e6eaa9cbf873418013842f565e4f946376b
4
+ data.tar.gz: 5df2a6e6d2b040de83fea5ab0b7fc2017cf0c925
5
5
  SHA512:
6
- metadata.gz: eafa6717d18a75deb34281461dc25dc81068ceeadc835aaa1441f32f9fee85559d23594d83bfd446fd42347ea5a36b2909b4d80fcdf51dae68c8219a37923016
7
- data.tar.gz: fb6fef5ed4ab15835598e84840477016c230a811acf4c845f405e358bd40dd9a31588fba040640d48096d491f8fd80322d3e653430b836aa07695b4f9180f9be
6
+ metadata.gz: 52f485ef55eb97ff5f945b3bcc003f0e518a37b0d12ae88ddd61b75b0774b4e888c62ca2fff0e93c98776c09bdef2e35d548a4c3d92f94b7bf411a3860eecba5
7
+ data.tar.gz: ac6c1b1e4bc9b10ebc89d9d21a53637c5784709bf56b4b3146a7a1c800dcda60e541e6510862173353dde856b5223140fc87682da5fdd4e91e31f7c66bae20b0
@@ -1,4 +1,4 @@
1
- GITLAB_API_ENDPOINT=http://example.com/api/v3
1
+ GITLAB_API_ENDPOINT=http://example.com/api/v4
2
2
  GITLAB_API_PRIVATE_TOKEN=XXXXXXXXXXXXXXXXXXX
3
3
  GITLAB_PROJECT_NAME=group/name
4
4
  TEMPLATE_FILE=gitlab_mr_release.md.erb
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/gitlab_mr_release/compare/v0.3.1...master)
2
+ [full changelog](http://github.com/sue445/gitlab_mr_release/compare/v0.4.0...master)
3
+
4
+ ## v0.4.0
5
+ [full changelog](http://github.com/sue445/gitlab_mr_release/compare/v0.3.1...v0.4.0)
6
+
7
+ * Support GitLab API v4
8
+ * https://github.com/sue445/gitlab_mr_release/pull/19
3
9
 
4
10
  ## v0.3.1
5
11
  [full changelog](http://github.com/sue445/gitlab_mr_release/compare/v0.3.0...v0.3.1)
data/README.md CHANGED
@@ -88,7 +88,7 @@ Environment variables read from `~/.env.gitlab` and current `.env.gitlab`
88
88
  `~/.env.gitlab`
89
89
 
90
90
  ```
91
- GITLAB_API_ENDPOINT=http://example.com/api/v3
91
+ GITLAB_API_ENDPOINT=http://example.com/api/v4
92
92
  GITLAB_API_PRIVATE_TOKEN=XXXXXXXXXXXXXXXXXXX
93
93
  TEMPLATE_FILE=gitlab_mr_release.md.erb
94
94
  DEFAULT_TITLE=Release <%= Time.now %> <%= source_branch %> -> <%= target_branch %>
@@ -10,6 +10,7 @@ module GitlabMrRelease
10
10
  config.endpoint = api_endpoint
11
11
  config.private_token = private_token
12
12
  end
13
+ @api_endpoint = api_endpoint
13
14
  @project_name = project_name
14
15
  end
15
16
 
@@ -31,9 +32,15 @@ module GitlabMrRelease
31
32
 
32
33
  # find MergeRequest with iid
33
34
  def merge_request(iid)
34
- mr = Gitlab.merge_requests(@project_name, iid: iid).first
35
- assert_merge_request_iid(mr, iid) if mr
36
- mr
35
+ if api_v4?
36
+ # API v4
37
+ Gitlab.merge_request(@project_name, iid)
38
+ else
39
+ # API v3
40
+ mr = Gitlab.merge_requests(@project_name, iid: iid).first
41
+ assert_merge_request_iid(mr, iid) if mr
42
+ mr
43
+ end
37
44
  end
38
45
 
39
46
  def generate_description(iids, template)
@@ -58,5 +65,9 @@ module GitlabMrRelease
58
65
  # NOTE: MR is found, but server is old GitLab?
59
66
  raise "MergeRequest iid does not match (expected #{iid}, but #{mr.iid})" unless iid == mr.iid
60
67
  end
68
+
69
+ def api_v4?
70
+ @api_endpoint =~ %r(/api/v4/?)
71
+ end
61
72
  end
62
73
  end
@@ -1,3 +1,3 @@
1
1
  module GitlabMrRelease
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-31 00:00:00.000000000 Z
11
+ date: 2017-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv