errbit_github_plugin 0.3.0 → 0.4.0
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 +5 -5
- data/.envrc +1 -0
- data/.rspec +2 -1
- data/.rubocop.yml +367 -0
- data/.ruby-version +1 -0
- data/.standard.yml +1 -0
- data/README.md +5 -4
- data/Rakefile +2 -0
- data/lib/errbit_github_plugin/{error.rb → authentication_error.rb} +2 -0
- data/lib/errbit_github_plugin/issue_tracker.rb +36 -24
- data/lib/errbit_github_plugin/version.rb +3 -1
- data/lib/errbit_github_plugin.rb +6 -4
- metadata +19 -96
- data/.gitignore +0 -20
- data/.travis.yml +0 -9
- data/Gemfile +0 -2
- data/errbit_github_plugin.gemspec +0 -32
- data/spec/issue_tracker_spec.rb +0 -156
- data/spec/spec_helper.rb +0 -28
- data/vendor/assets/images/github_create.png +0 -0
- data/vendor/assets/images/github_inactive.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 297a2628ce82518179d2e1c49e6e3fa74d5196e0477989441ef642e59a9d53fc
|
4
|
+
data.tar.gz: e77faf9c3f5de3af16b4a05d9e684c5fe0ec6697f3135aae2a8fefd97647075b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f47ea7b0efa36f9224db491ebee2cc1f147a6ae0ad66cc59fb45dc470b82a4ba97b308d6a060002a45dbdd72c262a41ac08cc22380e0055ff5cf9e71728ec83
|
7
|
+
data.tar.gz: 58040aeb2ae35411303e871e279cb5dea26499d58cad30e070174edefbc707c27bf281c5c86960537173d133b08a8d9e1be2ed342935838260bce9e069821025
|
data/.envrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export JRUBY_OPTS="--debug"
|
data/.rspec
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,367 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-disable_syntax
|
3
|
+
|
4
|
+
plugins:
|
5
|
+
- rubocop-performance
|
6
|
+
- rubocop-rake
|
7
|
+
- rubocop-rspec
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
TargetRubyVersion: 3.1
|
11
|
+
NewCops: enable
|
12
|
+
|
13
|
+
# We use standard as a linter and formatter instead Rubocop.
|
14
|
+
# Also, we are explicitly disable all rubocop rules what
|
15
|
+
# already enabled in standard. And standard-performance.
|
16
|
+
|
17
|
+
# Standard rules. Style:
|
18
|
+
|
19
|
+
# Enforced by standard. Disable.
|
20
|
+
Style/StringLiterals:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# Enforced by standard. Disable.
|
24
|
+
Style/HashSyntax:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
# Enforced by standard. Disable.
|
28
|
+
Style/NestedParenthesizedCalls:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
# Enforced by standard. Disable.
|
32
|
+
Style/RedundantRegexpArgument:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
# Enforced by standard. Disable.
|
36
|
+
Style/PercentLiteralDelimiters:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
# Enforced by standard. Disable.
|
40
|
+
Style/RedundantBegin:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
# Enforced by standard. Disable.
|
44
|
+
Style/SuperWithArgsParentheses:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
# Enforced by standard. Disable.
|
48
|
+
Style/Encoding:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
# Enforced by standard. Disable.
|
52
|
+
Style/NumericLiteralPrefix:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
# Enforced by standard. Disable.
|
56
|
+
Style/RedundantParentheses:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
# Enforced by standard. Disable.
|
60
|
+
Style/EmptyMethod:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
# Enforced by standard. Disable.
|
64
|
+
Style/SingleLineMethods:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# Enforced by standard. Disable.
|
68
|
+
Style/SafeNavigation:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
# Enforced by standard. Disable.
|
72
|
+
Style/RescueStandardError:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
# Enforced by standard. Disable.
|
76
|
+
Style/RedundantSelf:
|
77
|
+
Enabled: false
|
78
|
+
|
79
|
+
# Enforced by standard. Disable.
|
80
|
+
Style/TernaryParentheses:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
# Enforced by standard. Disable.
|
84
|
+
Style/RedundantLineContinuation:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
# Enforced by standard. Disable.
|
88
|
+
Style/SlicingWithRange:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
# Enforced by standard. Disable.
|
92
|
+
Style/MultilineIfModifier:
|
93
|
+
Enabled: false
|
94
|
+
|
95
|
+
# Enforced by standard. Disable.
|
96
|
+
Style/RedundantCondition:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
# Enforced by standard. Disable.
|
100
|
+
Style/RedundantInterpolation:
|
101
|
+
Enabled: false
|
102
|
+
|
103
|
+
# Enforced by standard. Disable.
|
104
|
+
Style/OrAssignment:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
# Enforced by standard. Disable.
|
108
|
+
Style/ConditionalAssignment:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
# Enforced by standard. Disable.
|
112
|
+
Style/ItAssignment:
|
113
|
+
Enabled: false
|
114
|
+
|
115
|
+
# Enforced by standard. Disable.
|
116
|
+
Style/EachWithObject:
|
117
|
+
Enabled: false
|
118
|
+
|
119
|
+
# Enforced by standard. Disable.
|
120
|
+
Style/GlobalStdStream:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
# Enforced by standard. Disable.
|
124
|
+
Style/StringLiteralsInInterpolation:
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
# Disabled as in standard.
|
128
|
+
Style/HashAsLastArrayItem:
|
129
|
+
Enabled: false
|
130
|
+
|
131
|
+
# Enforced by standard. Disable.
|
132
|
+
Style/Alias:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
# Standard rules. Layout:
|
136
|
+
|
137
|
+
# Enforced by standard. Disable.
|
138
|
+
Layout/HashAlignment:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
# Enforced by standard. Disable.
|
142
|
+
Layout/FirstArrayElementIndentation:
|
143
|
+
Enabled: false
|
144
|
+
|
145
|
+
# Enforced by standard. Disable.
|
146
|
+
Layout/SpaceInsideHashLiteralBraces:
|
147
|
+
Enabled: false
|
148
|
+
|
149
|
+
# Enforced by standard. Disable.
|
150
|
+
Layout/SpaceInsideStringInterpolation:
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
# Enforced by standard. Disable.
|
154
|
+
Layout/DotPosition:
|
155
|
+
Enabled: false
|
156
|
+
|
157
|
+
# Enforced by standard. Disable.
|
158
|
+
Layout/ExtraSpacing:
|
159
|
+
Enabled: false
|
160
|
+
|
161
|
+
# Enforced by standard. Disable.
|
162
|
+
Layout/ArgumentAlignment:
|
163
|
+
Enabled: false
|
164
|
+
|
165
|
+
# Enforced by standard. Disable.
|
166
|
+
Layout/MultilineMethodCallBraceLayout:
|
167
|
+
Enabled: false
|
168
|
+
|
169
|
+
# Enforced by standard. Disable.
|
170
|
+
Layout/AccessModifierIndentation:
|
171
|
+
Enabled: false
|
172
|
+
|
173
|
+
# Enforced by standard. Disable.
|
174
|
+
Layout/FirstHashElementIndentation:
|
175
|
+
Enabled: false
|
176
|
+
|
177
|
+
# Enforced by standard. Disable.
|
178
|
+
Layout/IndentationWidth:
|
179
|
+
Enabled: false
|
180
|
+
|
181
|
+
# Enforced by standard. Disable.
|
182
|
+
Layout/ElseAlignment:
|
183
|
+
Enabled: false
|
184
|
+
|
185
|
+
# Enforced by standard. Disable.
|
186
|
+
Layout/EndAlignment:
|
187
|
+
Enabled: false
|
188
|
+
|
189
|
+
# Enforced by standard. Disable.
|
190
|
+
Layout/MultilineHashBraceLayout:
|
191
|
+
Enabled: false
|
192
|
+
|
193
|
+
# Enforced by standard. Disable.
|
194
|
+
Layout/EmptyLineBetweenDefs:
|
195
|
+
Enabled: false
|
196
|
+
|
197
|
+
# Enforced by standard. Disable.
|
198
|
+
Layout/MultilineArrayBraceLayout:
|
199
|
+
Enabled: false
|
200
|
+
|
201
|
+
# Enforced by standard. Disable.
|
202
|
+
Layout/EmptyLineAfterMagicComment:
|
203
|
+
Enabled: false
|
204
|
+
|
205
|
+
# Enforced by standard. Disable.
|
206
|
+
Layout/SpaceAroundOperators:
|
207
|
+
Enabled: false
|
208
|
+
|
209
|
+
# Enforced by standard. Disable.
|
210
|
+
Layout/ArrayAlignment:
|
211
|
+
Enabled: false
|
212
|
+
|
213
|
+
# Enforced by standard. Disable.
|
214
|
+
Layout/AssignmentIndentation:
|
215
|
+
Enabled: false
|
216
|
+
|
217
|
+
# Enforced by standard. Disable.
|
218
|
+
Layout/ClosingParenthesisIndentation:
|
219
|
+
Enabled: false
|
220
|
+
|
221
|
+
# Enforced by standard. Disable.
|
222
|
+
Layout/LineLength:
|
223
|
+
Enabled: false
|
224
|
+
|
225
|
+
# Enforced by standard. Disable.
|
226
|
+
Layout/MultilineMethodCallIndentation:
|
227
|
+
Enabled: false
|
228
|
+
|
229
|
+
# Enforced by standard. Disable.
|
230
|
+
Layout/CaseIndentation:
|
231
|
+
Enabled: false
|
232
|
+
|
233
|
+
# Standard rules. Lint:
|
234
|
+
|
235
|
+
# Enforced by standard. Disable.
|
236
|
+
Lint/ImplicitStringConcatenation:
|
237
|
+
Enabled: false
|
238
|
+
|
239
|
+
# Enforced by standard. Disable.
|
240
|
+
Lint/TripleQuotes:
|
241
|
+
Enabled: false
|
242
|
+
|
243
|
+
# Enforced by standard. Disable.
|
244
|
+
Lint/IneffectiveAccessModifier:
|
245
|
+
Enabled: false
|
246
|
+
|
247
|
+
# Enforced by standard. Disable.
|
248
|
+
Lint/SymbolConversion:
|
249
|
+
Enabled: false
|
250
|
+
|
251
|
+
# Enforced by rubocop and standard
|
252
|
+
Lint/CopDirectiveSyntax:
|
253
|
+
Enabled: true
|
254
|
+
|
255
|
+
# Enforced by standard. Disable.
|
256
|
+
Lint/DuplicateMethods:
|
257
|
+
Enabled: false
|
258
|
+
|
259
|
+
# Enforced by standard. Disable.
|
260
|
+
Lint/ConstantDefinitionInBlock:
|
261
|
+
Enabled: false
|
262
|
+
|
263
|
+
# Enforced by standard. Disable.
|
264
|
+
Lint/UselessTimes:
|
265
|
+
Enabled: false
|
266
|
+
|
267
|
+
# Standard-performance rules.
|
268
|
+
|
269
|
+
# Enforced by standard-performance. Disable.
|
270
|
+
Performance/Detect:
|
271
|
+
Enabled: false
|
272
|
+
|
273
|
+
# Enforced by standard-performance. Disable.
|
274
|
+
Performance/StringIdentifierArgument:
|
275
|
+
Enabled: false
|
276
|
+
|
277
|
+
# Enforced by standard-performance. Disable.
|
278
|
+
Performance/RegexpMatch:
|
279
|
+
Enabled: false
|
280
|
+
|
281
|
+
# Always enable rubocop Security:
|
282
|
+
|
283
|
+
# Enforced by rubocop and standard
|
284
|
+
Security/JSONLoad:
|
285
|
+
Enabled: true
|
286
|
+
|
287
|
+
# Our rubocop rules
|
288
|
+
|
289
|
+
# Bundler rules.
|
290
|
+
|
291
|
+
Bundler/OrderedGems:
|
292
|
+
Enabled: false
|
293
|
+
|
294
|
+
# Gemspec rules
|
295
|
+
|
296
|
+
Gemspec/OrderedDependencies:
|
297
|
+
Enabled: false
|
298
|
+
|
299
|
+
# Style rules
|
300
|
+
|
301
|
+
# Don't allow %i[foo bar baz]
|
302
|
+
Style/SymbolArray:
|
303
|
+
Enabled: true
|
304
|
+
EnforcedStyle: brackets
|
305
|
+
|
306
|
+
# Don't allow %w[foo bar baz]
|
307
|
+
Style/WordArray:
|
308
|
+
Enabled: true
|
309
|
+
EnforcedStyle: brackets
|
310
|
+
|
311
|
+
# Disable warnings like "Missing top-level documentation comment for"
|
312
|
+
Style/Documentation:
|
313
|
+
Enabled: false
|
314
|
+
|
315
|
+
# Disable as in standard.
|
316
|
+
Style/ArgumentsForwarding:
|
317
|
+
Enabled: false
|
318
|
+
|
319
|
+
# RSpec rules
|
320
|
+
|
321
|
+
# Prefer eq over be.
|
322
|
+
RSpec/BeEq:
|
323
|
+
Enabled: false
|
324
|
+
|
325
|
+
# Prefer eq over eql.
|
326
|
+
RSpec/BeEql:
|
327
|
+
Enabled: false
|
328
|
+
|
329
|
+
# We prefer to use `expect` over `allow`.
|
330
|
+
RSpec/StubbedMock:
|
331
|
+
Enabled: false
|
332
|
+
|
333
|
+
# We prefer multiple before blocks in tests.
|
334
|
+
RSpec/ScatteredSetup:
|
335
|
+
Enabled: false
|
336
|
+
|
337
|
+
# We use `expect` in before hooks.
|
338
|
+
RSpec/ExpectInHook:
|
339
|
+
Enabled: false
|
340
|
+
|
341
|
+
# We use item_1, item_2, etc. Disable.
|
342
|
+
RSpec/IndexedLet:
|
343
|
+
Enabled: false
|
344
|
+
|
345
|
+
# We don't use named subject's
|
346
|
+
RSpec/NamedSubject:
|
347
|
+
Enabled: false
|
348
|
+
|
349
|
+
# Naming rules:
|
350
|
+
|
351
|
+
# Disable anonymous block forwarding.
|
352
|
+
Naming/BlockForwarding:
|
353
|
+
Enabled: true
|
354
|
+
EnforcedStyle: explicit
|
355
|
+
|
356
|
+
# Enable and exclude specific files.
|
357
|
+
Naming/FileName:
|
358
|
+
Enabled: true
|
359
|
+
|
360
|
+
# Disabled syntax:
|
361
|
+
|
362
|
+
# Disable shorthand hash syntax like: ({ x:, y: })
|
363
|
+
# Disable % style literals
|
364
|
+
Style/DisableSyntax:
|
365
|
+
DisableSyntax:
|
366
|
+
- shorthand_hash_syntax
|
367
|
+
- percent_literals
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.7
|
data/.standard.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby_version: 3.1
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
# Errbit
|
1
|
+
# Errbit GitHub Plugin
|
2
2
|
|
3
|
-
[
|
4
|
-
[
|
3
|
+
[](https://github.com/errbit/errbit_github_plugin/actions/workflows/rspec.yml)
|
4
|
+
[](https://github.com/errbit/errbit_github_plugin/actions/workflows/jruby.yml)
|
5
|
+
[](https://github.com/standardrb/standard)
|
5
6
|
|
6
|
-
This plugin provides GitHub issue tracker integration for Errbit and it is the
|
7
|
+
This plugin provides GitHub issue tracker integration for Errbit, and it is the
|
7
8
|
only plugin included by default in Errbit.
|
data/Rakefile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/object/blank"
|
4
|
+
require "octokit"
|
2
5
|
|
3
6
|
module ErrbitGithubPlugin
|
4
7
|
class IssueTracker < ErrbitPlugin::IssueTracker
|
8
|
+
LABEL = "github"
|
5
9
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
'user profile, and allow Errbit to create issues using your ' <<
|
12
|
-
'OAuth token.'
|
10
|
+
NOTE = "Please configure your GitHub repository in the <strong>GITHUB " \
|
11
|
+
"REPO</strong> field above.<br> Instead of providing your " \
|
12
|
+
"username & password, you can link your GitHub account to your " \
|
13
|
+
"user profile, and allow Errbit to create issues using your " \
|
14
|
+
"OAuth token."
|
13
15
|
|
14
16
|
FIELDS = {
|
15
17
|
username: {
|
@@ -35,13 +37,13 @@ module ErrbitGithubPlugin
|
|
35
37
|
def self.icons
|
36
38
|
@icons ||= {
|
37
39
|
create: [
|
38
|
-
|
40
|
+
"image/png", ErrbitGithubPlugin.read_static_file("github_create.png")
|
39
41
|
],
|
40
42
|
goto: [
|
41
|
-
|
43
|
+
"image/png", ErrbitGithubPlugin.read_static_file("github_goto.png")
|
42
44
|
],
|
43
45
|
inactive: [
|
44
|
-
|
46
|
+
"image/png", ErrbitGithubPlugin.read_static_file("github_inactive.png")
|
45
47
|
]
|
46
48
|
}
|
47
49
|
end
|
@@ -56,12 +58,15 @@ module ErrbitGithubPlugin
|
|
56
58
|
|
57
59
|
def errors
|
58
60
|
errors = []
|
59
|
-
|
60
|
-
|
61
|
+
|
62
|
+
if self.class.fields.detect { |f| options[f[0]].blank? }
|
63
|
+
errors << [:base, "You must specify your GitHub username and password"]
|
61
64
|
end
|
65
|
+
|
62
66
|
if repo.blank?
|
63
|
-
errors << [:base,
|
67
|
+
errors << [:base, "You must specify your GitHub repository url."]
|
64
68
|
end
|
69
|
+
|
65
70
|
errors
|
66
71
|
end
|
67
72
|
|
@@ -70,12 +75,14 @@ module ErrbitGithubPlugin
|
|
70
75
|
end
|
71
76
|
|
72
77
|
def create_issue(title, body, user: {})
|
73
|
-
if user[
|
74
|
-
|
75
|
-
login: user[
|
78
|
+
github_client = if user["github_login"] && user["github_oauth_token"]
|
79
|
+
Octokit::Client.new(
|
80
|
+
login: user["github_login"], access_token: user["github_oauth_token"]
|
81
|
+
)
|
76
82
|
else
|
77
|
-
|
78
|
-
login: options[
|
83
|
+
Octokit::Client.new(
|
84
|
+
login: options["username"], password: options["password"]
|
85
|
+
)
|
79
86
|
end
|
80
87
|
issue = github_client.create_issue(repo, title, body)
|
81
88
|
issue.html_url
|
@@ -83,13 +90,18 @@ module ErrbitGithubPlugin
|
|
83
90
|
raise ErrbitGithubPlugin::AuthenticationError, "Could not authenticate with GitHub. Please check your username and password."
|
84
91
|
end
|
85
92
|
|
93
|
+
# @param url [String]
|
94
|
+
# @param user [Hash]
|
95
|
+
# @return [String] The URL of the closed issue
|
86
96
|
def close_issue(url, user: {})
|
87
|
-
if user[
|
88
|
-
|
89
|
-
login: user[
|
97
|
+
github_client = if user["github_login"] && user["github_oauth_token"]
|
98
|
+
Octokit::Client.new(
|
99
|
+
login: user["github_login"], access_token: user["github_oauth_token"]
|
100
|
+
)
|
90
101
|
else
|
91
|
-
|
92
|
-
login: options[
|
102
|
+
Octokit::Client.new(
|
103
|
+
login: options["username"], password: options["password"]
|
104
|
+
)
|
93
105
|
end
|
94
106
|
# It would be better to get the number from issue.number when we create the issue,
|
95
107
|
# however, since we only have the url, get the number from it.
|
data/lib/errbit_github_plugin.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "errbit_github_plugin/version"
|
2
|
-
require
|
3
|
-
require
|
4
|
+
require "errbit_github_plugin/authentication_error"
|
5
|
+
require "errbit_github_plugin/issue_tracker"
|
4
6
|
|
5
7
|
module ErrbitGithubPlugin
|
6
8
|
def self.root
|
7
|
-
File.expand_path
|
9
|
+
File.expand_path "../..", __FILE__
|
8
10
|
end
|
9
11
|
|
10
12
|
def self.read_static_file(file)
|
11
|
-
File.read(File.join(
|
13
|
+
File.read(File.join(root, "static", file))
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errbit_github_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Crosby
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: errbit_plugin
|
@@ -25,7 +24,7 @@ dependencies:
|
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '0'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
27
|
+
name: faraday-retry
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - ">="
|
@@ -39,83 +38,13 @@ dependencies:
|
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '0'
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: guard
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: guard-rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: coveralls
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: bundler
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rake
|
41
|
+
name: octokit
|
113
42
|
requirement: !ruby/object:Gem::Requirement
|
114
43
|
requirements:
|
115
44
|
- - ">="
|
116
45
|
- !ruby/object:Gem::Version
|
117
46
|
version: '0'
|
118
|
-
type: :
|
47
|
+
type: :runtime
|
119
48
|
prerelease: false
|
120
49
|
version_requirements: !ruby/object:Gem::Requirement
|
121
50
|
requirements:
|
@@ -129,7 +58,7 @@ dependencies:
|
|
129
58
|
- - ">="
|
130
59
|
- !ruby/object:Gem::Version
|
131
60
|
version: '0'
|
132
|
-
type: :
|
61
|
+
type: :runtime
|
133
62
|
prerelease: false
|
134
63
|
version_requirements: !ruby/object:Gem::Requirement
|
135
64
|
requirements:
|
@@ -143,30 +72,29 @@ executables: []
|
|
143
72
|
extensions: []
|
144
73
|
extra_rdoc_files: []
|
145
74
|
files:
|
146
|
-
- ".
|
75
|
+
- ".envrc"
|
147
76
|
- ".rspec"
|
148
|
-
- ".
|
149
|
-
-
|
77
|
+
- ".rubocop.yml"
|
78
|
+
- ".ruby-version"
|
79
|
+
- ".standard.yml"
|
150
80
|
- LICENSE.txt
|
151
81
|
- README.md
|
152
82
|
- Rakefile
|
153
|
-
- errbit_github_plugin.gemspec
|
154
83
|
- lib/errbit_github_plugin.rb
|
155
|
-
- lib/errbit_github_plugin/
|
84
|
+
- lib/errbit_github_plugin/authentication_error.rb
|
156
85
|
- lib/errbit_github_plugin/issue_tracker.rb
|
157
86
|
- lib/errbit_github_plugin/version.rb
|
158
|
-
- spec/issue_tracker_spec.rb
|
159
|
-
- spec/spec_helper.rb
|
160
87
|
- static/github_create.png
|
161
88
|
- static/github_goto.png
|
162
89
|
- static/github_inactive.png
|
163
|
-
- vendor/assets/images/github_create.png
|
164
|
-
- vendor/assets/images/github_inactive.png
|
165
90
|
homepage: https://github.com/errbit/errbit_github_plugin
|
166
91
|
licenses:
|
167
92
|
- MIT
|
168
|
-
metadata:
|
169
|
-
|
93
|
+
metadata:
|
94
|
+
homepage_uri: https://github.com/errbit/errbit_github_plugin
|
95
|
+
source_code_uri: https://github.com/errbit/errbit_github_plugin
|
96
|
+
bug_tracker_uri: https://github.com/errbit/errbit_github_plugin/issues
|
97
|
+
rubygems_mfa_required: 'true'
|
170
98
|
rdoc_options: []
|
171
99
|
require_paths:
|
172
100
|
- lib
|
@@ -174,19 +102,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
102
|
requirements:
|
175
103
|
- - ">="
|
176
104
|
- !ruby/object:Gem::Version
|
177
|
-
version:
|
105
|
+
version: 3.1.0
|
178
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
107
|
requirements:
|
180
108
|
- - ">="
|
181
109
|
- !ruby/object:Gem::Version
|
182
110
|
version: '0'
|
183
111
|
requirements: []
|
184
|
-
|
185
|
-
rubygems_version: 2.2.2
|
186
|
-
signing_key:
|
112
|
+
rubygems_version: 3.6.7
|
187
113
|
specification_version: 4
|
188
114
|
summary: GitHub integration for Errbit
|
189
|
-
test_files:
|
190
|
-
- spec/issue_tracker_spec.rb
|
191
|
-
- spec/spec_helper.rb
|
192
|
-
has_rdoc:
|
115
|
+
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'errbit_github_plugin/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'errbit_github_plugin'
|
8
|
-
spec.version = ErrbitGithubPlugin::VERSION
|
9
|
-
spec.authors = ['Stephen Crosby']
|
10
|
-
spec.email = ['stevecrozz@gmail.com']
|
11
|
-
|
12
|
-
spec.description = %q{GitHub integration for Errbit}
|
13
|
-
spec.summary = %q{GitHub integration for Errbit}
|
14
|
-
spec.homepage = 'https://github.com/errbit/errbit_github_plugin'
|
15
|
-
spec.license = 'MIT'
|
16
|
-
|
17
|
-
spec.files = `git ls-files`.split($/)
|
18
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = ['lib']
|
21
|
-
|
22
|
-
spec.add_dependency 'errbit_plugin'
|
23
|
-
spec.add_dependency 'octokit'
|
24
|
-
|
25
|
-
spec.add_development_dependency 'rspec'
|
26
|
-
spec.add_development_dependency 'guard'
|
27
|
-
spec.add_development_dependency 'guard-rspec'
|
28
|
-
spec.add_development_dependency 'coveralls'
|
29
|
-
spec.add_development_dependency 'bundler'
|
30
|
-
spec.add_development_dependency 'rake'
|
31
|
-
spec.add_development_dependency 'activesupport'
|
32
|
-
end
|
data/spec/issue_tracker_spec.rb
DELETED
@@ -1,156 +0,0 @@
|
|
1
|
-
describe ErrbitGithubPlugin::IssueTracker do
|
2
|
-
describe '.label' do
|
3
|
-
it 'return LABEL' do
|
4
|
-
expect(described_class.label).to eq described_class::LABEL
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
describe '.note' do
|
9
|
-
it 'return NOTE' do
|
10
|
-
expect(described_class.note).to eq described_class::NOTE
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '.fields' do
|
15
|
-
it 'return FIELDS' do
|
16
|
-
expect(described_class.fields).to eq described_class::FIELDS
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '.icons' do
|
21
|
-
|
22
|
-
it 'puts create icon onto the icons' do
|
23
|
-
expect(described_class.icons[:create][0]).to eq 'image/png'
|
24
|
-
expect(
|
25
|
-
described_class.icons[:create][1]
|
26
|
-
).to eq ErrbitGithubPlugin.read_static_file('github_create.png')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'puts goto icon onto the icons' do
|
30
|
-
expect(described_class.icons[:goto][0]).to eq 'image/png'
|
31
|
-
expect(
|
32
|
-
described_class.icons[:goto][1]
|
33
|
-
).to eq ErrbitGithubPlugin.read_static_file('github_goto.png')
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'puts inactive icon onto the icons' do
|
37
|
-
expect(described_class.icons[:inactive][0]).to eq 'image/png'
|
38
|
-
expect(
|
39
|
-
described_class.icons[:inactive][1]
|
40
|
-
).to eq ErrbitGithubPlugin.read_static_file('github_inactive.png')
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
let(:tracker) { described_class.new(options) }
|
45
|
-
|
46
|
-
describe '#configured?' do
|
47
|
-
context 'with errors' do
|
48
|
-
let(:options) { { invalid_key: '' } }
|
49
|
-
it 'return false' do
|
50
|
-
expect(tracker.configured?).to eq false
|
51
|
-
end
|
52
|
-
end
|
53
|
-
context 'without errors' do
|
54
|
-
let(:options) do
|
55
|
-
{ username: 'foo', password: 'bar', github_repo: 'user/repos' }
|
56
|
-
end
|
57
|
-
it 'return true' do
|
58
|
-
expect(tracker.configured?).to eq true
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe '#url' do
|
64
|
-
let(:options) { { github_repo: 'repo' } }
|
65
|
-
it 'returns issues url' do
|
66
|
-
expect(tracker.url).to eq 'https://github.com/repo/issues'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#errors' do
|
71
|
-
subject { tracker.errors }
|
72
|
-
context 'without username' do
|
73
|
-
let(:options) { { username: '', password: 'bar', github_repo: 'repo' } }
|
74
|
-
it { is_expected.not_to be_empty }
|
75
|
-
end
|
76
|
-
context 'without password' do
|
77
|
-
let(:options) do
|
78
|
-
{ username: '', password: 'bar', github_repo: 'repo' }
|
79
|
-
end
|
80
|
-
it { is_expected.not_to be_empty }
|
81
|
-
end
|
82
|
-
context 'without github_repo' do
|
83
|
-
let(:options) do
|
84
|
-
{ username: 'foo', password: 'bar', github_repo: '' }
|
85
|
-
end
|
86
|
-
it { is_expected.not_to be_empty }
|
87
|
-
end
|
88
|
-
context 'with completed options' do
|
89
|
-
let(:options) do
|
90
|
-
{ username: 'foo', password: 'bar', github_repo: 'repo' }
|
91
|
-
end
|
92
|
-
it { is_expected.to be_empty }
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '#repo' do
|
97
|
-
let(:options) { { github_repo: 'baz' } }
|
98
|
-
it 'returns github repo' do
|
99
|
-
expect(tracker.repo).to eq 'baz'
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
describe '#create_issue' do
|
104
|
-
subject { tracker.create_issue('title', 'body', user: user) }
|
105
|
-
let(:options) do
|
106
|
-
{ username: 'foo', password: 'bar', github_repo: 'user/repos' }
|
107
|
-
end
|
108
|
-
let(:fake_github_client) do
|
109
|
-
double('Fake GitHub Client').tap do |github_client|
|
110
|
-
github_client.stub(:create_issue).and_return(fake_issue)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
let(:fake_issue) do
|
114
|
-
double('Fake Issue').tap do |issue|
|
115
|
-
issue.stub(:html_url).and_return('http://github.com/user/repos/issues/878')
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
context 'signed in with token' do
|
120
|
-
let(:user) do
|
121
|
-
{
|
122
|
-
'github_login' => 'bob',
|
123
|
-
'github_oauth_token' => 'valid_token'
|
124
|
-
}
|
125
|
-
end
|
126
|
-
it 'return issue url' do
|
127
|
-
Octokit::Client.stub(:new).with(
|
128
|
-
login: user['github_login'], access_token: user['github_oauth_token']
|
129
|
-
).and_return(fake_github_client)
|
130
|
-
expect(subject).to eq fake_issue.html_url
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
context 'signed in with password' do
|
135
|
-
let(:user) { {} }
|
136
|
-
it 'return issue url' do
|
137
|
-
(Octokit::Client).stub(:new).with(
|
138
|
-
login: options['username'], password: options['password']
|
139
|
-
).and_return(fake_github_client)
|
140
|
-
expect(subject).to eq fake_issue.html_url
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
context 'when unauthentication error' do
|
145
|
-
let(:user) do
|
146
|
-
{ 'github_login' => 'alice', 'github_oauth_token' => 'invalid_token' }
|
147
|
-
end
|
148
|
-
it 'raise AuthenticationError' do
|
149
|
-
(Octokit::Client).stub(:new).with(
|
150
|
-
login: user['github_login'], access_token: user['github_oauth_token']
|
151
|
-
).and_raise(Octokit::Unauthorized)
|
152
|
-
expect { subject }.to raise_error
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
if ENV['COVERAGE']
|
2
|
-
require 'simplecov'
|
3
|
-
if ENV['CI']
|
4
|
-
require 'coveralls'
|
5
|
-
Coveralls.wear!
|
6
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
-
SimpleCov::Formatter::HTMLFormatter,
|
8
|
-
Coveralls::SimpleCov::Formatter
|
9
|
-
]
|
10
|
-
end
|
11
|
-
|
12
|
-
SimpleCov.start
|
13
|
-
end
|
14
|
-
|
15
|
-
require 'errbit_plugin'
|
16
|
-
require 'errbit_github_plugin'
|
17
|
-
require 'active_support/all'
|
18
|
-
|
19
|
-
RSpec.configure do |config|
|
20
|
-
config.run_all_when_everything_filtered = true
|
21
|
-
config.filter_run :focus
|
22
|
-
|
23
|
-
# Run specs in random order to surface order dependencies. If you find an
|
24
|
-
# order dependency and want to debug it, you can fix the order by providing
|
25
|
-
# the seed, which is printed after each run.
|
26
|
-
# --seed 1234
|
27
|
-
config.order = 'random'
|
28
|
-
end
|
Binary file
|
Binary file
|