rake_github 0.8.0.pre.5 → 0.8.0.pre.6

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
  SHA256:
3
- metadata.gz: 7955c3ad1445546cd4f62398929bd4b2d13aee7d10147ac369cf39ea288bdd63
4
- data.tar.gz: dd2c0dd41a7eda65fb7e7843cd4a3316feb5ef4c3adec37837a6394c13fca178
3
+ metadata.gz: a3e9be68ad0beb57b1e36b452b430bb9125277f907ca4ce07a8b7a3fc3866b13
4
+ data.tar.gz: 99b865614f763cd674e45459a359cdab295454d9af2ea2c3e9864549dae273c5
5
5
  SHA512:
6
- metadata.gz: 97d0733f1e4a8f68c7af39a8e80644bb821daa16aa7ed775cca4c039639f469d43ff0f952f6448084215150ce5a115c22e4df7102b0cbdd2738bccfb9142ddc4
7
- data.tar.gz: '05383ba6e2f13005b2ad412a9cfc13cb738c84df2ab142884174a29a95f15affb048b85c07b35b85c0c22a961b2d5eff6f6be4660cccd603910e6666037aed98'
6
+ metadata.gz: 3014f287b8d2dc142c87b186c961a5cd6d82f58e7b3ac35162f5d0d8c5554174db8852a7cb87d98646cb6f8ede435cfd018cb0cdc11cb31e9bb3dd7d9386af67
7
+ data.tar.gz: a9b22df5da0453c6d893f685e3a9ee1214ca9ec928ec98603fe349b79ab6b4dc142f676cefb8d5662a1ab71152f0b60f08a530008e927d6971a630dcca6ec20c
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_github (0.8.0.pre.5)
4
+ rake_github (0.8.0.pre.6)
5
5
  colored2 (~> 3.1)
6
+ git (~> 1.9.1)
6
7
  octokit (~> 4.16)
7
8
  rake_factory (~> 0.23)
8
9
  sshkey (~> 2.0)
@@ -10,11 +11,12 @@ PATH
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- activesupport (5.2.6)
14
+ activesupport (6.1.4.1)
14
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (>= 0.7, < 2)
16
- minitest (~> 5.1)
17
- tzinfo (~> 1.1)
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ tzinfo (~> 2.0)
19
+ zeitwerk (~> 2.3)
18
20
  addressable (2.8.0)
19
21
  public_suffix (>= 2.0.2, < 5.0)
20
22
  colored2 (3.1.2)
@@ -42,9 +44,11 @@ GEM
42
44
  faraday-patron (1.0.0)
43
45
  faraday-rack (1.0.0)
44
46
  gem-release (2.2.2)
47
+ git (1.9.1)
48
+ rchardet (~> 1.8)
45
49
  hamster (3.0.0)
46
50
  concurrent-ruby (~> 1.0)
47
- i18n (1.8.10)
51
+ i18n (1.8.11)
48
52
  concurrent-ruby (~> 1.0)
49
53
  lino (3.0.0)
50
54
  hamster (~> 3.0)
@@ -73,6 +77,7 @@ GEM
73
77
  colored2 (~> 3.1)
74
78
  rake_factory (~> 0.23)
75
79
  sshkey (~> 2.0)
80
+ rchardet (1.8.0)
76
81
  rspec (3.10.0)
77
82
  rspec-core (~> 3.10.0)
78
83
  rspec-expectations (~> 3.10.0)
@@ -99,15 +104,15 @@ GEM
99
104
  simplecov-html (0.12.3)
100
105
  simplecov_json_formatter (0.1.3)
101
106
  sshkey (2.0.0)
102
- thread_safe (0.3.6)
103
- tzinfo (1.2.9)
104
- thread_safe (~> 0.1)
107
+ tzinfo (2.0.4)
108
+ concurrent-ruby (~> 1.0)
109
+ zeitwerk (2.5.1)
105
110
 
106
111
  PLATFORMS
107
112
  ruby
108
113
 
109
114
  DEPENDENCIES
110
- activesupport (~> 5.2)
115
+ activesupport (~> 6.1)
111
116
  bundler (~> 2.0)
112
117
  gem-release (~> 2.0)
113
118
  memfs (~> 1.0)
@@ -120,4 +125,4 @@ DEPENDENCIES
120
125
  simplecov (~> 0.16)
121
126
 
122
127
  BUNDLED WITH
123
- 2.2.25
128
+ 2.3.5
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rake_factory'
4
+ require 'octokit'
5
+ require 'git'
6
+
7
+ module RakeGithub
8
+ module Tasks
9
+ module PullRequests
10
+ class Merge < RakeFactory::Task
11
+ default_description(RakeFactory::DynamicValue.new do |t|
12
+ "Merges pull request on the current branch in the #{t.repository} repository"
13
+ end)
14
+
15
+ parameter :repository, required: true
16
+ parameter :access_token, required: true
17
+ parameter :commit_message, default: ''
18
+
19
+ action do |t|
20
+ current_branch = Git.open(Pathname.new('.')).current_branch
21
+ github_client = Octokit::Client.new(access_token: access_token)
22
+
23
+ open_prs = github_client.pull_requests(t.repository)
24
+
25
+ current_pr = open_prs
26
+ .find { |pr| pr[:head][:ref] == current_branch }
27
+
28
+ raise NoPullRequestError.new current_branch if current_pr.nil?
29
+
30
+ github_client.merge_pull_request(
31
+ t.repository,
32
+ current_pr[:number],
33
+ format(t.commit_message % current_pr[:title])
34
+ )
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ class NoPullRequestError < StandardError
42
+ attr_reader :branch_name
43
+ def initialize(branch_name)
44
+ @branch_name = branch_name
45
+ end
46
+
47
+ def message
48
+ "No pull request associated with branch %s" % branch_name
49
+ end
50
+ end
@@ -0,0 +1 @@
1
+ require_relative 'pull_requests/merge'
@@ -1,2 +1,3 @@
1
1
  require_relative 'tasks/deploy_keys'
2
2
  require_relative 'tasks/releases'
3
+ require_relative 'tasks/pull_requests'
@@ -1,3 +1,3 @@
1
1
  module RakeGithub
2
- VERSION = '0.8.0.pre.5'
2
+ VERSION = '0.8.0.pre.6'
3
3
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.pre.5
4
+ version: 0.8.0.pre.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-14 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake_factory
14
+ name: colored2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.23'
19
+ version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.23'
26
+ version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sshkey
28
+ name: git
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: 1.9.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: 1.9.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: octokit
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,27 +53,27 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.16'
55
55
  - !ruby/object:Gem::Dependency
56
- name: colored2
56
+ name: rake_factory
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.1'
61
+ version: '0.23'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.1'
68
+ version: '0.23'
69
69
  - !ruby/object:Gem::Dependency
70
- name: bundler
70
+ name: sshkey
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '2.0'
76
- type: :development
76
+ type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
@@ -81,131 +81,145 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rake
84
+ name: activesupport
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '13.0'
89
+ version: '6.1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '13.0'
96
+ version: '6.1'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rake_circle_ci
98
+ name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.9'
103
+ version: '2.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.9'
110
+ version: '2.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rake_github
112
+ name: gem-release
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.5'
117
+ version: '2.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.5'
124
+ version: '2.0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rake_ssh
126
+ name: memfs
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.4'
131
+ version: '1.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.4'
138
+ version: '1.0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: rake_gpg
140
+ name: rake
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.12'
145
+ version: '13.0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.12'
152
+ version: '13.0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: rspec
154
+ name: rake_circle_ci
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '3.9'
159
+ version: '0.9'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '3.9'
166
+ version: '0.9'
167
167
  - !ruby/object:Gem::Dependency
168
- name: gem-release
168
+ name: rake_github
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '2.0'
173
+ version: '0.5'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '2.0'
180
+ version: '0.5'
181
181
  - !ruby/object:Gem::Dependency
182
- name: activesupport
182
+ name: rake_gpg
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '5.2'
187
+ version: '0.12'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '5.2'
194
+ version: '0.12'
195
195
  - !ruby/object:Gem::Dependency
196
- name: memfs
196
+ name: rake_ssh
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '1.0'
201
+ version: '0.4'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '1.0'
208
+ version: '0.4'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rspec
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '3.9'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '3.9'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: simplecov
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -244,6 +258,8 @@ files:
244
258
  - lib/rake_github/tasks/deploy_keys/destroy.rb
245
259
  - lib/rake_github/tasks/deploy_keys/ensure.rb
246
260
  - lib/rake_github/tasks/deploy_keys/provision.rb
261
+ - lib/rake_github/tasks/pull_requests.rb
262
+ - lib/rake_github/tasks/pull_requests/merge.rb
247
263
  - lib/rake_github/tasks/releases.rb
248
264
  - lib/rake_github/tasks/releases/create.rb
249
265
  - lib/rake_github/version.rb