dude-cli 2.0.4 → 2.1.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/verify.yml +32 -0
- data/.rspec +0 -1
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +7 -3
- data/Gemfile +3 -1
- data/Gemfile.lock +48 -9
- data/LICENCE +20 -0
- data/README.md +32 -6
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/bin/dude +2 -2
- data/dude.gemspec +25 -18
- data/lib/dude.rb +9 -9
- data/lib/dude/code_management.rb +10 -0
- data/lib/dude/code_management/github/client.rb +23 -0
- data/lib/dude/code_management/github/create_pull_request.rb +53 -0
- data/lib/dude/commands.rb +24 -17
- data/lib/dude/commands/checkout.rb +4 -2
- data/lib/dude/commands/install.rb +32 -18
- data/lib/dude/commands/move.rb +5 -3
- data/lib/dude/commands/pr.rb +11 -0
- data/lib/dude/commands/pr/create.rb +49 -0
- data/lib/dude/commands/pr/remove.rb +15 -0
- data/lib/dude/commands/start.rb +9 -3
- data/lib/dude/commands/stop.rb +4 -2
- data/lib/dude/commands/tasks.rb +6 -3
- data/lib/dude/commands/track.rb +5 -3
- data/lib/dude/commands/version.rb +3 -1
- data/lib/dude/git.rb +3 -0
- data/lib/dude/git/checkout.rb +20 -1
- data/lib/dude/git/current_branch_name.rb +3 -1
- data/lib/dude/git/remote_name.rb +21 -0
- data/lib/dude/project_management/client.rb +14 -6
- data/lib/dude/project_management/entities/issue.rb +10 -7
- data/lib/dude/project_management/jira.rb +2 -1
- data/lib/dude/project_management/jira/client.rb +14 -7
- data/lib/dude/project_management/jira/fetch_current_task.rb +37 -0
- data/lib/dude/project_management/jira/fetch_current_tasks.rb +48 -0
- data/lib/dude/project_management/jira/get_task_name_by_id.rb +1 -1
- data/lib/dude/project_management/jira/move_task_to_list.rb +15 -13
- data/lib/dude/project_management/trello.rb +5 -3
- data/lib/dude/project_management/trello/client.rb +40 -21
- data/lib/dude/project_management/trello/fetch_current_task.rb +43 -0
- data/lib/dude/project_management/trello/fetch_current_tasks.rb +53 -0
- data/lib/dude/project_management/trello/fetch_lists.rb +24 -0
- data/lib/dude/project_management/trello/get_task_name_by_id.rb +25 -0
- data/lib/dude/project_management/trello/move_task_to_list.rb +55 -0
- data/lib/dude/settings.rb +3 -0
- data/lib/dude/templates/pull_request_template +7 -0
- data/lib/dude/time_trackers/toggl.rb +2 -0
- data/lib/dude/time_trackers/toggl/base.rb +4 -0
- data/lib/dude/time_trackers/toggl/start_time_entry.rb +3 -2
- data/lib/dude/time_trackers/toggl/stop_time_entry.rb +3 -1
- data/lib/dude/version.rb +3 -1
- metadata +77 -21
- data/lib/dude/project_management/entities/board.rb +0 -9
- data/lib/dude/project_management/jira/get_current_tasks.rb +0 -40
- data/lib/dude/project_management/trello/checkout.rb +0 -4
- data/lib/dude/project_management/trello/get_current_tasks.rb +0 -24
- data/lib/dude/project_management/trello/get_lists.rb +0 -15
- data/lib/dude/project_management/trello/move_tasks_to_list.rb +0 -14
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dude
|
4
|
+
module ProjectManagement
|
5
|
+
module Trello
|
6
|
+
class FetchLists
|
7
|
+
include Settings
|
8
|
+
|
9
|
+
def initialize(client)
|
10
|
+
@client = client
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
response = client.get("/1/board/#{settings['ATLASSIAN_BOARD_ID']}/lists", { fields: 'name' })
|
15
|
+
JSON.parse(response.body)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_reader :client
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dude
|
4
|
+
module ProjectManagement
|
5
|
+
module Trello
|
6
|
+
class GetTaskNameById
|
7
|
+
include Settings
|
8
|
+
|
9
|
+
def initialize(client, id:)
|
10
|
+
@client = client
|
11
|
+
@id = id
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
response = client.get("/1/boards/#{settings['ATLASSIAN_BOARD_ID']}/cards/#{id}")
|
16
|
+
JSON.parse(response.body)['name']
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :client, :id
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './fetch_lists'
|
4
|
+
|
5
|
+
module Dude
|
6
|
+
module ProjectManagement
|
7
|
+
module Trello
|
8
|
+
class MoveTaskToList
|
9
|
+
include Settings
|
10
|
+
|
11
|
+
def initialize(client, id:, list_name:)
|
12
|
+
@client = client
|
13
|
+
@id = id
|
14
|
+
@list_name = list_name
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
response = client.get("/1/boards/#{settings['ATLASSIAN_BOARD_ID']}/cards/#{id}", { fields: 'id' })
|
19
|
+
card_id = JSON.parse(response.body)['id']
|
20
|
+
client.put("/1/cards/#{card_id}", { idList: list_id })
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :client, :id, :list_name
|
26
|
+
|
27
|
+
def list_id
|
28
|
+
if list_name
|
29
|
+
lists.find { |list| list['name'] == list_name }['id']
|
30
|
+
else
|
31
|
+
select_list_for_moving['id']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def select_list_for_moving
|
36
|
+
puts 'Please, select list for moving:'.green.bold
|
37
|
+
|
38
|
+
print_lists
|
39
|
+
|
40
|
+
print "\nList index: ".bold
|
41
|
+
list_index = $stdin.gets.chomp
|
42
|
+
lists[list_index.to_i - 1]
|
43
|
+
end
|
44
|
+
|
45
|
+
def print_lists
|
46
|
+
lists.map { |list| list['name'] }.each_with_index { |name, index| puts "#{index + 1}: #{name.bold}" }
|
47
|
+
end
|
48
|
+
|
49
|
+
def lists
|
50
|
+
@lists ||= FetchLists.new(client).call
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/dude/settings.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dude
|
2
4
|
module Settings
|
3
5
|
CONFIG_FILE = '.duderc'
|
@@ -5,6 +7,7 @@ module Dude
|
|
5
7
|
def settings
|
6
8
|
@settings ||= read(file).strip.split("\n").map do |line|
|
7
9
|
next if line =~ /^#/ || line.empty?
|
10
|
+
|
8
11
|
line.split('=').map(&:strip)
|
9
12
|
end.compact.to_h
|
10
13
|
end
|
@@ -1,9 +1,10 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './base'
|
2
4
|
|
3
5
|
module Dude
|
4
6
|
module Toggl
|
5
7
|
class StartTimeEntry < Dude::Toggl::Base
|
6
|
-
|
7
8
|
def call(task_title:, project:)
|
8
9
|
@task_title = task_title
|
9
10
|
@project = project
|
data/lib/dude/version.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dude-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.1.0.alpha2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikita Pupko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: colorize
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.8.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:
|
26
|
+
version: 0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: dry-cli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0.6'
|
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: '
|
40
|
+
version: '0.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: faraday
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '1.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jira-ruby
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,8 +108,52 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '3.0'
|
111
|
-
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.12'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.12'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.21.2
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.21.2
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov-cobertura
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.4'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.4'
|
153
|
+
description: 'This program helps to combine such services as Jira, Toggl and git and
|
112
154
|
replace most routine activities with one simple CLI utility.
|
155
|
+
|
156
|
+
'
|
113
157
|
email:
|
114
158
|
- work.pupko@gmail.com
|
115
159
|
executables:
|
@@ -118,12 +162,15 @@ extensions: []
|
|
118
162
|
extra_rdoc_files: []
|
119
163
|
files:
|
120
164
|
- ".github/dependabot.yml"
|
165
|
+
- ".github/workflows/verify.yml"
|
121
166
|
- ".gitignore"
|
122
167
|
- ".rspec"
|
168
|
+
- ".rubocop.yml"
|
123
169
|
- ".travis.yml"
|
124
170
|
- CHANGELOG.md
|
125
171
|
- Gemfile
|
126
172
|
- Gemfile.lock
|
173
|
+
- LICENCE
|
127
174
|
- README.md
|
128
175
|
- Rakefile
|
129
176
|
- bin/console
|
@@ -131,10 +178,16 @@ files:
|
|
131
178
|
- bin/setup
|
132
179
|
- dude.gemspec
|
133
180
|
- lib/dude.rb
|
181
|
+
- lib/dude/code_management.rb
|
182
|
+
- lib/dude/code_management/github/client.rb
|
183
|
+
- lib/dude/code_management/github/create_pull_request.rb
|
134
184
|
- lib/dude/commands.rb
|
135
185
|
- lib/dude/commands/checkout.rb
|
136
186
|
- lib/dude/commands/install.rb
|
137
187
|
- lib/dude/commands/move.rb
|
188
|
+
- lib/dude/commands/pr.rb
|
189
|
+
- lib/dude/commands/pr/create.rb
|
190
|
+
- lib/dude/commands/pr/remove.rb
|
138
191
|
- lib/dude/commands/start.rb
|
139
192
|
- lib/dude/commands/stop.rb
|
140
193
|
- lib/dude/commands/tasks.rb
|
@@ -143,21 +196,24 @@ files:
|
|
143
196
|
- lib/dude/git.rb
|
144
197
|
- lib/dude/git/checkout.rb
|
145
198
|
- lib/dude/git/current_branch_name.rb
|
199
|
+
- lib/dude/git/remote_name.rb
|
146
200
|
- lib/dude/project_management/client.rb
|
147
|
-
- lib/dude/project_management/entities/board.rb
|
148
201
|
- lib/dude/project_management/entities/issue.rb
|
149
202
|
- lib/dude/project_management/jira.rb
|
150
203
|
- lib/dude/project_management/jira/client.rb
|
151
|
-
- lib/dude/project_management/jira/
|
204
|
+
- lib/dude/project_management/jira/fetch_current_task.rb
|
205
|
+
- lib/dude/project_management/jira/fetch_current_tasks.rb
|
152
206
|
- lib/dude/project_management/jira/get_task_name_by_id.rb
|
153
207
|
- lib/dude/project_management/jira/move_task_to_list.rb
|
154
208
|
- lib/dude/project_management/trello.rb
|
155
|
-
- lib/dude/project_management/trello/checkout.rb
|
156
209
|
- lib/dude/project_management/trello/client.rb
|
157
|
-
- lib/dude/project_management/trello/
|
158
|
-
- lib/dude/project_management/trello/
|
159
|
-
- lib/dude/project_management/trello/
|
210
|
+
- lib/dude/project_management/trello/fetch_current_task.rb
|
211
|
+
- lib/dude/project_management/trello/fetch_current_tasks.rb
|
212
|
+
- lib/dude/project_management/trello/fetch_lists.rb
|
213
|
+
- lib/dude/project_management/trello/get_task_name_by_id.rb
|
214
|
+
- lib/dude/project_management/trello/move_task_to_list.rb
|
160
215
|
- lib/dude/settings.rb
|
216
|
+
- lib/dude/templates/pull_request_template
|
161
217
|
- lib/dude/time_trackers/toggl.rb
|
162
218
|
- lib/dude/time_trackers/toggl/base.rb
|
163
219
|
- lib/dude/time_trackers/toggl/start_time_entry.rb
|
@@ -178,12 +234,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
234
|
requirements:
|
179
235
|
- - ">="
|
180
236
|
- !ruby/object:Gem::Version
|
181
|
-
version: 2.
|
237
|
+
version: 2.5.0
|
182
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
239
|
requirements:
|
184
|
-
- - "
|
240
|
+
- - ">"
|
185
241
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
242
|
+
version: 1.3.1
|
187
243
|
requirements: []
|
188
244
|
rubygems_version: 3.1.4
|
189
245
|
signing_key:
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'dude/project_management/entities/issue'
|
2
|
-
require 'dude/project_management/jira/client'
|
3
|
-
|
4
|
-
module Dude
|
5
|
-
module ProjectManagement
|
6
|
-
module Jira
|
7
|
-
class GetCurrentTasks
|
8
|
-
include Settings
|
9
|
-
|
10
|
-
def initialize(client)
|
11
|
-
@client = client
|
12
|
-
end
|
13
|
-
|
14
|
-
def call
|
15
|
-
board = client.Board.find(settings['ATLASSIAN_BOARD_ID'])
|
16
|
-
|
17
|
-
all_issues = case board.type
|
18
|
-
when 'kanban' then board.issues
|
19
|
-
when 'simple', 'scrum' then board.sprints(state: 'active').flat_map { |sprint| sprint.issues }
|
20
|
-
else raise Dude::ToBeImplementedError
|
21
|
-
end
|
22
|
-
|
23
|
-
all_issues.map do |issue|
|
24
|
-
Entities::Issue.new({
|
25
|
-
id: issue.key,
|
26
|
-
title: issue.summary,
|
27
|
-
description: issue.description,
|
28
|
-
status: issue.status.name,
|
29
|
-
assignee: issue&.assignee&.displayName
|
30
|
-
})
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
attr_reader :client
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# TODO
|
2
|
-
module Dude
|
3
|
-
module ProjectManagement
|
4
|
-
module Trello
|
5
|
-
class GetCurrentTasks
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
client = Trello::Client.new
|
9
|
-
|
10
|
-
response = client.get("/1/lists/#{TODO_LIST_ID}/cards", { fields: 'name,idShort' })
|
11
|
-
|
12
|
-
body = JSON.parse(response.body)
|
13
|
-
|
14
|
-
puts "To Do list\n".green.bold
|
15
|
-
|
16
|
-
body.map do |issue|
|
17
|
-
binding.pry
|
18
|
-
Entities::Issue.new(id: card['idShort'], title: card['name'], description: issue.description, status: issue.status.name)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|