dri 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/.gitignore +3 -1
- data/.gitlab-ci.yml +32 -13
- data/.rubocop.yml +53 -0
- data/.ruby-version +1 -0
- data/.tool-versions +1 -0
- data/Gemfile +2 -3
- data/Gemfile.lock +69 -17
- data/README.md +22 -0
- data/Rakefile +3 -1
- data/bin/console +1 -0
- data/dri.gemspec +25 -22
- data/exe/dri +3 -3
- data/lib/dri/api_client.rb +41 -10
- data/lib/dri/cli.rb +2 -2
- data/lib/dri/command.rb +7 -5
- data/lib/dri/commands/fetch/failures.rb +29 -29
- data/lib/dri/commands/fetch/featureflags.rb +95 -0
- data/lib/dri/commands/fetch/quarantines.rb +53 -0
- data/lib/dri/commands/fetch/testcases.rb +18 -7
- data/lib/dri/commands/fetch/triaged.rb +14 -18
- data/lib/dri/commands/fetch.rb +36 -2
- data/lib/dri/commands/init.rb +9 -6
- data/lib/dri/commands/profile.rb +14 -5
- data/lib/dri/commands/publish/report.rb +24 -9
- data/lib/dri/commands/publish.rb +4 -5
- data/lib/dri/commands/rm/emoji.rb +5 -5
- data/lib/dri/commands/rm/profile.rb +2 -2
- data/lib/dri/commands/rm.rb +0 -1
- data/lib/dri/refinements/truncate.rb +15 -0
- data/lib/dri/report.rb +56 -41
- data/lib/dri/utils/markdown_lists.rb +7 -9
- data/lib/dri/utils/table.rb +20 -0
- data/lib/dri/version.rb +3 -1
- data/lib/dri.rb +2 -0
- metadata +67 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ae68ce5f20bab397121604708b813e8f488316559f82392a389f1750e57c89c
|
4
|
+
data.tar.gz: 30b16b0291beb7e18cc74acb9c54100c869544bba883c79729f577c8bda5dd7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad35cf45172de050ecd86c376527abc98ba535f9ad97f54f84f7be3875882c46ae897039d26a4c9f4db3c7df598608c81e8613518b7c7eeb44b7903610899406
|
7
|
+
data.tar.gz: a790667c5528fc3ad94f610b2add55b36a4fb5efd9bad3e8e10a78d44e58a8140721d4717a75def60ca829715389bebf001704a38a1a8127e1e6872228dd0fe6
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,28 +1,47 @@
|
|
1
|
-
|
1
|
+
.job_base:
|
2
|
+
image: ruby:2.7
|
3
|
+
variables:
|
4
|
+
BUNDLE_PATH: vendor/bundle
|
5
|
+
BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES: "true"
|
6
|
+
before_script:
|
7
|
+
- gem install bundler -v 2.3.9 --no-document
|
8
|
+
- bundle install
|
9
|
+
cache:
|
10
|
+
key:
|
11
|
+
files:
|
12
|
+
- dri.gemspec
|
13
|
+
- Gemfile.lock
|
14
|
+
paths:
|
15
|
+
- vendor/bundle
|
16
|
+
rules:
|
17
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
18
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
19
|
+
|
20
|
+
include:
|
21
|
+
- project: gitlab-org/quality/pipeline-common
|
22
|
+
ref: 0.3.4
|
23
|
+
file:
|
24
|
+
- /ci/gem-release.yml
|
2
25
|
|
3
26
|
stages:
|
4
27
|
- build
|
5
28
|
- test
|
6
29
|
- deploy
|
7
30
|
|
8
|
-
before_script:
|
9
|
-
- gem install bundler:2.2.22
|
10
|
-
- bundle install
|
11
|
-
|
12
31
|
build_gem:
|
13
32
|
stage: build
|
33
|
+
extends: .job_base
|
14
34
|
script:
|
15
35
|
- gem build
|
16
36
|
|
17
|
-
|
37
|
+
rubocop:
|
18
38
|
stage: test
|
39
|
+
extends: .job_base
|
19
40
|
script:
|
20
|
-
- bundle exec
|
41
|
+
- bundle exec rubocop --color
|
21
42
|
|
22
|
-
|
23
|
-
stage:
|
43
|
+
rspec:
|
44
|
+
stage: test
|
45
|
+
extends: .job_base
|
24
46
|
script:
|
25
|
-
-
|
26
|
-
rules:
|
27
|
-
- if: '$CI_COMMIT_TAG'
|
28
|
-
when: always
|
47
|
+
- bundle exec rspec --color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
gitlab-styles:
|
3
|
+
- rubocop-all.yml
|
4
|
+
- rubocop-gemspec.yml
|
5
|
+
- rubocop-lint.yml
|
6
|
+
- rubocop-naming.yml
|
7
|
+
- rubocop-performance.yml
|
8
|
+
- rubocop-rspec.yml
|
9
|
+
- rubocop-security.yml
|
10
|
+
- rubocop-style.yml
|
11
|
+
|
12
|
+
AllCops:
|
13
|
+
TargetRubyVersion: 2.7
|
14
|
+
|
15
|
+
RSpec/MultipleMemoizedHelpers:
|
16
|
+
Max: 25
|
17
|
+
AllowSubject: true
|
18
|
+
|
19
|
+
CodeReuse/ActiveRecord:
|
20
|
+
Exclude:
|
21
|
+
- spec/**/*.rb
|
22
|
+
|
23
|
+
Metrics/AbcSize:
|
24
|
+
Enabled: true
|
25
|
+
Max: 30
|
26
|
+
|
27
|
+
Metrics/BlockLength:
|
28
|
+
Enabled: true
|
29
|
+
Exclude:
|
30
|
+
- spec/**/*.rb
|
31
|
+
- dri.gemspec
|
32
|
+
|
33
|
+
Metrics/MethodLength:
|
34
|
+
Enabled: true
|
35
|
+
Max: 30
|
36
|
+
|
37
|
+
Layout/BeginEndAlignment:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
Layout/SpaceAroundMethodCallOperator:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
Lint/HashCompareByIdentity:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
Lint/RedundantSafeNavigation:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
Style/ClassEqualityComparison:
|
53
|
+
Enabled: true
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.5
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.0.2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dri (0.1.
|
4
|
+
dri (0.1.3)
|
5
5
|
httparty (~> 0.20.0)
|
6
6
|
json (~> 2.6.1)
|
7
7
|
markdown-tables (~> 1.1.1)
|
@@ -19,39 +19,88 @@ PATH
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
+
activesupport (7.0.2.3)
|
23
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
|
+
i18n (>= 1.6, < 2)
|
25
|
+
minitest (>= 5.1)
|
26
|
+
tzinfo (~> 2.0)
|
22
27
|
addressable (2.8.0)
|
23
28
|
public_suffix (>= 2.0.2, < 5.0)
|
29
|
+
ast (2.4.2)
|
30
|
+
concurrent-ruby (1.1.10)
|
24
31
|
crack (0.4.5)
|
25
32
|
rexml
|
26
33
|
diff-lcs (1.5.0)
|
34
|
+
gitlab-styles (7.0.0)
|
35
|
+
rubocop (~> 0.91, >= 0.91.1)
|
36
|
+
rubocop-gitlab-security (~> 0.1.1)
|
37
|
+
rubocop-graphql (~> 0.10)
|
38
|
+
rubocop-performance (~> 1.9.2)
|
39
|
+
rubocop-rails (~> 2.9)
|
40
|
+
rubocop-rspec (~> 1.44)
|
27
41
|
hashdiff (1.0.1)
|
28
42
|
httparty (0.20.0)
|
29
43
|
mime-types (~> 3.0)
|
30
44
|
multi_xml (>= 0.5.2)
|
45
|
+
i18n (1.10.0)
|
46
|
+
concurrent-ruby (~> 1.0)
|
31
47
|
json (2.6.1)
|
32
48
|
markdown-tables (1.1.1)
|
33
49
|
mime-types (3.4.1)
|
34
50
|
mime-types-data (~> 3.2015)
|
35
51
|
mime-types-data (3.2022.0105)
|
52
|
+
minitest (5.15.0)
|
36
53
|
multi_xml (0.6.0)
|
54
|
+
parallel (1.22.1)
|
55
|
+
parser (3.1.1.0)
|
56
|
+
ast (~> 2.4.1)
|
37
57
|
pastel (0.8.0)
|
38
58
|
tty-color (~> 0.5)
|
39
59
|
public_suffix (4.0.6)
|
40
|
-
|
60
|
+
rack (2.2.3)
|
61
|
+
rainbow (3.1.1)
|
62
|
+
rake (13.0.6)
|
63
|
+
regexp_parser (2.2.1)
|
41
64
|
rexml (3.2.5)
|
42
|
-
rspec (3.
|
43
|
-
rspec-core (~> 3.
|
44
|
-
rspec-expectations (~> 3.
|
45
|
-
rspec-mocks (~> 3.
|
46
|
-
rspec-core (3.
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-expectations (3.
|
65
|
+
rspec (3.10.0)
|
66
|
+
rspec-core (~> 3.10.0)
|
67
|
+
rspec-expectations (~> 3.10.0)
|
68
|
+
rspec-mocks (~> 3.10.0)
|
69
|
+
rspec-core (3.10.2)
|
70
|
+
rspec-support (~> 3.10.0)
|
71
|
+
rspec-expectations (3.10.2)
|
49
72
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-mocks (3.
|
73
|
+
rspec-support (~> 3.10.0)
|
74
|
+
rspec-mocks (3.10.3)
|
52
75
|
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-support (3.
|
76
|
+
rspec-support (~> 3.10.0)
|
77
|
+
rspec-support (3.10.3)
|
78
|
+
rubocop (0.93.1)
|
79
|
+
parallel (~> 1.10)
|
80
|
+
parser (>= 2.7.1.5)
|
81
|
+
rainbow (>= 2.2.2, < 4.0)
|
82
|
+
regexp_parser (>= 1.8)
|
83
|
+
rexml
|
84
|
+
rubocop-ast (>= 0.6.0)
|
85
|
+
ruby-progressbar (~> 1.7)
|
86
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
87
|
+
rubocop-ast (1.16.0)
|
88
|
+
parser (>= 3.1.1.0)
|
89
|
+
rubocop-gitlab-security (0.1.1)
|
90
|
+
rubocop (>= 0.51)
|
91
|
+
rubocop-graphql (0.14.2)
|
92
|
+
rubocop (>= 0.87, < 2)
|
93
|
+
rubocop-performance (1.9.2)
|
94
|
+
rubocop (>= 0.90.0, < 2.0)
|
95
|
+
rubocop-ast (>= 0.4.0)
|
96
|
+
rubocop-rails (2.9.1)
|
97
|
+
activesupport (>= 4.2.0)
|
98
|
+
rack (>= 1.1)
|
99
|
+
rubocop (>= 0.90.0, < 2.0)
|
100
|
+
rubocop-rspec (1.44.1)
|
101
|
+
rubocop (~> 0.87)
|
102
|
+
rubocop-ast (>= 0.7.1)
|
103
|
+
ruby-progressbar (1.11.0)
|
55
104
|
strings (0.2.1)
|
56
105
|
strings-ansi (~> 0.2)
|
57
106
|
unicode-display_width (>= 1.5, < 3.0)
|
@@ -85,7 +134,9 @@ GEM
|
|
85
134
|
pastel (~> 0.8)
|
86
135
|
strings (~> 0.2.0)
|
87
136
|
tty-screen (~> 0.8)
|
88
|
-
|
137
|
+
tzinfo (2.0.4)
|
138
|
+
concurrent-ruby (~> 1.0)
|
139
|
+
unicode-display_width (1.8.0)
|
89
140
|
unicode_utils (1.4.0)
|
90
141
|
webmock (3.14.0)
|
91
142
|
addressable (>= 2.8.0)
|
@@ -98,10 +149,11 @@ PLATFORMS
|
|
98
149
|
|
99
150
|
DEPENDENCIES
|
100
151
|
dri!
|
101
|
-
|
102
|
-
|
152
|
+
gitlab-styles (~> 7.0.0)
|
153
|
+
rake
|
154
|
+
rspec (~> 3.10.0)
|
103
155
|
timecop (~> 0.9.1)
|
104
156
|
webmock (~> 3.5)
|
105
157
|
|
106
158
|
BUNDLED WITH
|
107
|
-
2.
|
159
|
+
2.3.9
|
data/README.md
CHANGED
@@ -56,6 +56,9 @@ $ dri profile
|
|
56
56
|
- failures
|
57
57
|
- testcases
|
58
58
|
- triaged
|
59
|
+
- quarantines
|
60
|
+
- dequarantines
|
61
|
+
- featureflags
|
59
62
|
- [4. publish](#4-publish)
|
60
63
|
- report
|
61
64
|
- [5. rm](#5-rm)
|
@@ -107,6 +110,25 @@ $ dri fetch triaged
|
|
107
110
|
|
108
111
|
Fetches triaged failures which use the triage emoji specified in `dri profile`.
|
109
112
|
|
113
|
+
```shell
|
114
|
+
$ dri fetch quarantines
|
115
|
+
```
|
116
|
+
|
117
|
+
Fetches open quarantine Merge Requests to be reviewed
|
118
|
+
|
119
|
+
```shell
|
120
|
+
$ dri fetch dequarantines
|
121
|
+
```
|
122
|
+
|
123
|
+
Fetches open dequarantine Merge Requests to be reviewed
|
124
|
+
|
125
|
+
```shell
|
126
|
+
$ dri fetch featureflags
|
127
|
+
```
|
128
|
+
|
129
|
+
Fetches a list of today's feature flag changes, including the date and time in UTC of when the change occurred as well as a link to the corresponding issue from the feature-flag-log project.
|
130
|
+
Results are organized by environment (production, staging, staging ref and preprod).
|
131
|
+
|
110
132
|
#### 4. publish
|
111
133
|
|
112
134
|
```shell
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/dri.gemspec
CHANGED
@@ -1,41 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lib/dri/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name =
|
5
|
-
spec.license =
|
6
|
+
spec.name = 'dri'
|
7
|
+
spec.license = 'MIT'
|
6
8
|
spec.version = Dri::VERSION
|
7
|
-
spec.authors = [
|
8
|
-
spec.email = [
|
9
|
+
spec.authors = ['GitLab Quality']
|
10
|
+
spec.email = ['quality+dri@gitlab.com']
|
9
11
|
|
10
|
-
spec.summary =
|
12
|
+
spec.summary = 'CLI app to help triage GitLab QA pipelines'
|
11
13
|
spec.homepage = 'https://gitlab.com/gitlab-org/quality/dri'
|
12
|
-
spec.required_ruby_version = Gem::Requirement.new(
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
13
15
|
|
14
16
|
# Specify which files should be added to the gem when it is released.
|
15
17
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
16
|
-
spec.files
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
17
19
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
20
|
end
|
19
|
-
spec.bindir =
|
21
|
+
spec.bindir = 'exe'
|
20
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = [
|
23
|
+
spec.require_paths = ['lib']
|
22
24
|
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency
|
26
|
-
spec.add_dependency
|
27
|
-
spec.add_dependency
|
25
|
+
spec.add_dependency 'httparty', '~> 0.20.0'
|
26
|
+
spec.add_dependency 'json', '~> 2.6.1'
|
27
|
+
spec.add_dependency 'markdown-tables', '~> 1.1.1'
|
28
|
+
spec.add_dependency 'pastel', '~> 0.8.0'
|
29
|
+
spec.add_dependency 'thor', '~> 1.0.1'
|
28
30
|
spec.add_dependency 'tty-box', '~> 0.7.0'
|
31
|
+
spec.add_dependency 'tty-config', '~> 0.4.0'
|
32
|
+
spec.add_dependency 'tty-editor', '~> 0.6'
|
33
|
+
spec.add_dependency 'tty-font', '~> 0.5'
|
29
34
|
spec.add_dependency 'tty-logger', '~> 0.6.0'
|
30
|
-
spec.add_dependency
|
31
|
-
spec.add_dependency
|
32
|
-
spec.add_dependency
|
33
|
-
spec.add_dependency "markdown-tables", "~> 1.1.1"
|
34
|
-
spec.add_dependency 'json', '~> 2.6.1'
|
35
|
-
spec.add_dependency 'httparty', '~> 0.20.0'
|
35
|
+
spec.add_dependency 'tty-prompt', '~> 0.23.1'
|
36
|
+
spec.add_dependency 'tty-spinner', '~> 0.9'
|
37
|
+
spec.add_dependency 'tty-table', '~> 0.12.0'
|
36
38
|
|
37
|
-
spec.add_development_dependency
|
39
|
+
spec.add_development_dependency 'gitlab-styles', '~> 7.0.0'
|
40
|
+
spec.add_development_dependency 'rake'
|
38
41
|
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
39
|
-
spec.add_development_dependency 'webmock', '~> 3.5'
|
40
42
|
spec.add_development_dependency "timecop", "~> 0.9.1"
|
43
|
+
spec.add_development_dependency 'webmock', '~> 3.5'
|
41
44
|
end
|
data/exe/dri
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
lib_path = File.expand_path('../lib', __dir__)
|
5
|
-
|
5
|
+
$LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
|
6
6
|
require 'dri/cli'
|
7
7
|
|
8
8
|
Signal.trap('INT') do
|
@@ -12,7 +12,7 @@ end
|
|
12
12
|
|
13
13
|
begin
|
14
14
|
Dri::CLI.start
|
15
|
-
rescue Dri::CLI::Error =>
|
16
|
-
puts "ERROR: #{
|
15
|
+
rescue Dri::CLI::Error => e
|
16
|
+
puts "ERROR: #{e.message}"
|
17
17
|
exit 1
|
18
18
|
end
|
data/lib/dri/api_client.rb
CHANGED
@@ -3,14 +3,15 @@
|
|
3
3
|
require "httparty"
|
4
4
|
require "json"
|
5
5
|
require "tty-config"
|
6
|
+
require 'cgi'
|
6
7
|
|
7
8
|
module Dri
|
8
|
-
class ApiClient
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
class ApiClient # rubocop:disable Metrics/ClassLength
|
10
|
+
API_URL = 'https://gitlab.com/api/v4'
|
11
|
+
TESTCASES_PROJECT_ID = '11229385'
|
12
|
+
TRIAGE_PROJECT_ID = '15291320'
|
13
|
+
GITLAB_PROJECT_ID = '278964'
|
14
|
+
FEATURE_FLAG_LOG_PROJECT_ID = '15208716'
|
14
15
|
|
15
16
|
def initialize(config)
|
16
17
|
profile = config.read
|
@@ -50,6 +51,26 @@ module Dri
|
|
50
51
|
fetch_json(url.join)
|
51
52
|
end
|
52
53
|
|
54
|
+
# Fetch MRs
|
55
|
+
#
|
56
|
+
# @see https://docs.gitlab.com/ee/api/merge_requests.html for all passable options
|
57
|
+
#
|
58
|
+
# @param [Hash<String>] options
|
59
|
+
# @option options [String] state
|
60
|
+
# @option options [String] order_by
|
61
|
+
# @option options [String] sort
|
62
|
+
# @option options [String] milestone
|
63
|
+
# @option options [String] labels
|
64
|
+
def fetch_mrs(project_id:, **options)
|
65
|
+
uri = URI(API_URL)
|
66
|
+
uri.query = HTTParty::HashConversions.to_params(options)
|
67
|
+
|
68
|
+
# CGI.escape('gitlab-org/gitlab') => 'gitlab-org%2Fgitlab'
|
69
|
+
uri.path = File.join(uri.path, 'projects', CGI.escape(project_id), 'merge_requests')
|
70
|
+
|
71
|
+
fetch_json(uri.to_s)
|
72
|
+
end
|
73
|
+
|
53
74
|
def fetch_current_triage_issue
|
54
75
|
url = ["#{API_URL}/projects/"]
|
55
76
|
url << "#{TRIAGE_PROJECT_ID}/issues?state=opened"
|
@@ -87,6 +108,16 @@ module Dri
|
|
87
108
|
delete_json(url)
|
88
109
|
end
|
89
110
|
|
111
|
+
def fetch_feature_flag_logs(date:, page:)
|
112
|
+
url = ["#{API_URL}/projects/"]
|
113
|
+
url << "#{FEATURE_FLAG_LOG_PROJECT_ID}/issues"
|
114
|
+
url << "?created_after=#{date}"
|
115
|
+
url << "&per_page=100"
|
116
|
+
url << "&page=#{page}"
|
117
|
+
|
118
|
+
fetch_json(url.join)
|
119
|
+
end
|
120
|
+
|
90
121
|
private
|
91
122
|
|
92
123
|
def post_json(url, body)
|
@@ -97,7 +128,7 @@ module Dri
|
|
97
128
|
}
|
98
129
|
}
|
99
130
|
|
100
|
-
response =
|
131
|
+
response = HTTParty.post(url, options)
|
101
132
|
handle_response(response)
|
102
133
|
end
|
103
134
|
|
@@ -107,12 +138,12 @@ module Dri
|
|
107
138
|
end
|
108
139
|
|
109
140
|
def handle_response(response)
|
110
|
-
#puts response.to_json
|
141
|
+
# puts response.to_json
|
111
142
|
response
|
112
143
|
end
|
113
144
|
|
114
145
|
def fetch_json(url)
|
115
|
-
response =
|
146
|
+
response = HTTParty.get(url, headers: header)
|
116
147
|
|
117
148
|
if response.code != 200
|
118
149
|
puts "Response error code \"#{response.code}\" - Unable to sync with GitLab"
|
@@ -122,4 +153,4 @@ module Dri
|
|
122
153
|
handle_response(JSON.parse(response.body))
|
123
154
|
end
|
124
155
|
end
|
125
|
-
end
|
156
|
+
end
|
data/lib/dri/cli.rb
CHANGED
@@ -25,14 +25,14 @@ module Dri
|
|
25
25
|
end
|
26
26
|
|
27
27
|
class_option :no_color, type: :boolean, default: false,
|
28
|
-
|
28
|
+
desc: "Disable colorization in output"
|
29
29
|
|
30
30
|
desc 'version', 'dri version'
|
31
31
|
def version
|
32
32
|
require_relative 'version'
|
33
33
|
puts "v#{Dri::VERSION}"
|
34
34
|
end
|
35
|
-
map %w
|
35
|
+
map %w[--version -v] => :version
|
36
36
|
|
37
37
|
require_relative 'commands/rm'
|
38
38
|
register Dri::Commands::Rm, 'rm', 'rm [SUBCOMMAND]', 'Remove triage-related items'
|
data/lib/dri/command.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative 'command'
|
3
4
|
require_relative 'api_client'
|
4
5
|
|
6
|
+
require 'dri/refinements/truncate'
|
7
|
+
|
5
8
|
require "tty-config"
|
6
9
|
require "pastel"
|
7
10
|
require 'forwardable'
|
@@ -11,7 +14,6 @@ module Dri
|
|
11
14
|
extend Forwardable
|
12
15
|
|
13
16
|
def_delegators :command, :run
|
14
|
-
attr_reader :config, :emoji, :token, :username, :timezone, :profile
|
15
17
|
|
16
18
|
def pastel(**options)
|
17
19
|
Pastel.new(**options)
|
@@ -54,10 +56,10 @@ module Dri
|
|
54
56
|
end
|
55
57
|
|
56
58
|
def verify_config_exists
|
57
|
-
if
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
return if config.exist?
|
60
|
+
|
61
|
+
logger.error "Oops, could not find a configuration. Try using #{add_color('dri init', :yellow)} first."
|
62
|
+
exit 1
|
61
63
|
end
|
62
64
|
|
63
65
|
def add_color(str, *color)
|