gitlab_mr_release 0.4.0 → 1.0.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: 67432e6eaa9cbf873418013842f565e4f946376b
4
- data.tar.gz: 5df2a6e6d2b040de83fea5ab0b7fc2017cf0c925
3
+ metadata.gz: cc48c402abe1f670c8c18c04c576c255a9cc1ec8
4
+ data.tar.gz: d8b9de1a425fb13cb90385c06276bb974b52dcc3
5
5
  SHA512:
6
- metadata.gz: 52f485ef55eb97ff5f945b3bcc003f0e518a37b0d12ae88ddd61b75b0774b4e888c62ca2fff0e93c98776c09bdef2e35d548a4c3d92f94b7bf411a3860eecba5
7
- data.tar.gz: ac6c1b1e4bc9b10ebc89d9d21a53637c5784709bf56b4b3146a7a1c800dcda60e541e6510862173353dde856b5223140fc87682da5fdd4e91e31f7c66bae20b0
6
+ metadata.gz: 1b78fb3343cdc42a95edbf9c1880e02f87c3f1f9b8591a86fb9dceb9308dae684d7744cc5e02aa77cad4408c62e1cd6e4bc677baee67cda937322c605bedc86c
7
+ data.tar.gz: 1db0224850457c577ab8367766f9c76229bf5dae3a5c55424264f009394cd9e1a4ade55b97f3edc3f5441c25616c84ce9931f93b99b07aa0dceb67a19407fe45
@@ -1,5 +1,13 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/gitlab_mr_release/compare/v0.4.0...master)
2
+ [full changelog](http://github.com/sue445/gitlab_mr_release/compare/v1.0.0...master)
3
+
4
+ ## v1.0.0
5
+ [full changelog](http://github.com/sue445/gitlab_mr_release/compare/v0.4.0...v1.0.0)
6
+
7
+ * Drop GitLab API v3 supports
8
+ * https://github.com/sue445/gitlab_mr_release/pull/21
9
+ * Reduced API calls at `gitlab_mr_release create`
10
+ * https://github.com/sue445/gitlab_mr_release/pull/23
3
11
 
4
12
  ## v0.4.0
5
13
  [full changelog](http://github.com/sue445/gitlab_mr_release/compare/v0.3.1...v0.4.0)
data/Gemfile CHANGED
@@ -7,3 +7,8 @@ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
7
7
  # NOTE: activesupport 5.x supports only ruby 2.2.2+
8
8
  gem "activesupport", "< 5.0.0"
9
9
  end
10
+
11
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.0")
12
+ # NOTE: byebug 9.1.0+ requires ruby 2.2.0+
13
+ gem "byebug", "< 9.1.0"
14
+ end
data/README.md CHANGED
@@ -13,7 +13,8 @@ This is inspired by the [git-pr-release](https://github.com/motemen/git-pr-relea
13
13
  ## Requirements
14
14
 
15
15
  * Ruby v2.1+
16
- * GitLab v7.11.0+
16
+ * GitLab v8.17.0+
17
+ * GitLab API v4+
17
18
 
18
19
  ## Installation
19
20
 
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "pry-byebug"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
  spec.add_development_dependency "rspec"
33
+ spec.add_development_dependency "rspec-parameterized"
33
34
  spec.add_development_dependency "simplecov"
34
35
  spec.add_development_dependency "webmock", ">= 3.0.0"
35
36
  end
@@ -2,5 +2,5 @@ require "gitlab_mr_release/version"
2
2
  require "gitlab_mr_release/project"
3
3
 
4
4
  module GitlabMrRelease
5
- # Your code goes here...
5
+ class InvalidApiVersionError < StandardError; end
6
6
  end
@@ -48,6 +48,10 @@ module GitlabMrRelease
48
48
  project_name: ENV["GITLAB_PROJECT_NAME"],
49
49
  )
50
50
 
51
+ unless project.api_version >= 4
52
+ raise InvalidApiVersionError, "'#{ENV["GITLAB_API_ENDPOINT"]}' seems not to be GitLab API v4+. gitlab_mr_release requires GitLab API v4+"
53
+ end
54
+
51
55
  mr = project.create_merge_request(
52
56
  source_branch: source_branch,
53
57
  target_branch: target_branch,
@@ -14,6 +14,11 @@ module GitlabMrRelease
14
14
  @project_name = project_name
15
15
  end
16
16
 
17
+ def api_version
18
+ @api_endpoint =~ %r(/api/v([0-9]+)/?)
19
+ $1.to_i
20
+ end
21
+
17
22
  def web_url
18
23
  @web_url ||= Gitlab.project(@project_name).web_url
19
24
  end
@@ -30,21 +35,8 @@ module GitlabMrRelease
30
35
  end.compact.map(&:to_i)
31
36
  end
32
37
 
33
- # find MergeRequest with iid
34
- def merge_request(iid)
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
44
- end
45
-
46
38
  def generate_description(iids, template)
47
- merge_requests = iids.map { |iid| merge_request(iid) }
39
+ merge_requests = Gitlab.merge_requests(@project_name, iids: iids)
48
40
  ERB.new(template, nil, "-").result(binding).strip
49
41
  end
50
42
 
@@ -58,16 +50,5 @@ module GitlabMrRelease
58
50
  }
59
51
  Gitlab.create_merge_request(@project_name, title, options)
60
52
  end
61
-
62
- private
63
-
64
- def assert_merge_request_iid(mr, iid)
65
- # NOTE: MR is found, but server is old GitLab?
66
- raise "MergeRequest iid does not match (expected #{iid}, but #{mr.iid})" unless iid == mr.iid
67
- end
68
-
69
- def api_v4?
70
- @api_endpoint =~ %r(/api/v4/?)
71
- end
72
53
  end
73
54
  end
@@ -1,3 +1,3 @@
1
1
  module GitlabMrRelease
2
- VERSION = "0.4.0"
2
+ VERSION = "1.0.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.4.0
4
+ version: 1.0.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-07-25 00:00:00.000000000 Z
11
+ date: 2017-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rspec-parameterized
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: simplecov
155
169
  requirement: !ruby/object:Gem::Requirement