dude-cli 2.0.7 → 2.1.0.alpha5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +0 -1
  3. data/.rubocop.yml +5 -1
  4. data/Gemfile.lock +36 -15
  5. data/README.md +43 -35
  6. data/dude.gemspec +3 -2
  7. data/lib/dude.rb +12 -2
  8. data/lib/dude/code_management.rb +10 -0
  9. data/lib/dude/code_management/github/client.rb +27 -0
  10. data/lib/dude/code_management/github/create_pull_request.rb +61 -0
  11. data/lib/dude/commands.rb +7 -0
  12. data/lib/dude/commands/health_check.rb +15 -0
  13. data/lib/dude/commands/install.rb +63 -41
  14. data/lib/dude/commands/pr.rb +11 -0
  15. data/lib/dude/commands/pr/create.rb +49 -0
  16. data/lib/dude/commands/pr/remove.rb +15 -0
  17. data/lib/dude/commands/start.rb +10 -8
  18. data/lib/dude/commands/stop.rb +0 -2
  19. data/lib/dude/commands/tasks.rb +0 -2
  20. data/lib/dude/commands/track.rb +2 -4
  21. data/lib/dude/config.rb +18 -0
  22. data/lib/dude/git.rb +1 -0
  23. data/lib/dude/git/remote_name.rb +21 -0
  24. data/lib/dude/health_check.rb +39 -0
  25. data/lib/dude/project_management/client.rb +8 -4
  26. data/lib/dude/project_management/entities/issue.rb +8 -7
  27. data/lib/dude/project_management/jira/client.rb +21 -8
  28. data/lib/dude/project_management/jira/fetch_current_task.rb +37 -0
  29. data/lib/dude/project_management/jira/fetch_current_tasks.rb +3 -4
  30. data/lib/dude/project_management/jira/get_task_name_by_id.rb +0 -2
  31. data/lib/dude/project_management/jira/move_task_to_list.rb +0 -2
  32. data/lib/dude/project_management/{entities/board.rb → trello.rb} +1 -3
  33. data/lib/dude/project_management/trello/client.rb +56 -0
  34. data/lib/dude/project_management/trello/fetch_current_task.rb +41 -0
  35. data/lib/dude/project_management/trello/fetch_current_tasks.rb +51 -0
  36. data/lib/dude/project_management/trello/fetch_lists.rb +22 -0
  37. data/lib/dude/project_management/trello/get_task_name_by_id.rb +23 -0
  38. data/lib/dude/project_management/trello/move_task_to_list.rb +53 -0
  39. data/lib/dude/setup/github.rb +35 -0
  40. data/lib/dude/setup/jira.rb +64 -0
  41. data/lib/dude/setup/toggl.rb +47 -0
  42. data/lib/dude/setup/trello.rb +58 -0
  43. data/lib/dude/templates/duderc_template +32 -0
  44. data/lib/dude/time_trackers/toggl/base.rb +2 -4
  45. data/lib/dude/version.rb +1 -1
  46. metadata +42 -6
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dude
4
+ module Setup
5
+ class Toggl
6
+ def initialize(prompt)
7
+ @prompt = prompt
8
+ end
9
+
10
+ def call(settings:)
11
+ settings[:toggl][:token] = setup_token
12
+ settings[:toggl][:project_name] = setup_project_name
13
+ settings[:toggl][:workspace_id] = setup_workspace_id
14
+ settings
15
+ end
16
+
17
+ private
18
+
19
+ attr_reader :prompt
20
+
21
+ def setup_token
22
+ puts <<~HEREDOC
23
+ You need to create personal token
24
+
25
+ #{'1.'.bold} Log in to https://trello.com/app-key
26
+ #{'2.'.bold} Your Toggl API token can be found at the bottom of the page
27
+ #{'3.'.bold} Press --Click to Reveal-- and paste token below
28
+ HEREDOC
29
+
30
+ if prompt.yes?(Dude::Config.style_prompt('Open Toggl profile page in your browser?'))
31
+ `open https://track.toggl.com/profile`
32
+ end
33
+
34
+ prompt.ask(Dude::Config.style_prompt('Toggl token:'), required: true)
35
+ end
36
+
37
+ def setup_project_name
38
+ prompt.ask(Dude::Config.style_prompt('Your Toggl project name:'), required: true)
39
+ end
40
+
41
+ def setup_workspace_id
42
+ puts 'Can be copied from url here: https://toggl.com/app/projects/ (Example: 123456)'
43
+ prompt.ask(Dude::Config.style_prompt('Workspace ID:'), required: true)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dude
4
+ module Setup
5
+ class Trello
6
+ def initialize(prompt)
7
+ @prompt = prompt
8
+ end
9
+
10
+ def call(settings:)
11
+ settings[:trello][:key] = setup_key
12
+ settings[:trello][:token] = setup_token
13
+ settings[:trello][:board_id] = setup_board_id
14
+ settings
15
+ end
16
+
17
+ private
18
+
19
+ attr_reader :prompt
20
+
21
+ def setup_email
22
+ prompt.ask(Dude::Config.style_prompt('Jira user email:'), required: true)
23
+ end
24
+
25
+ def setup_key
26
+ puts <<~HEREDOC
27
+ You need to create personal token
28
+
29
+ #{'1.'.bold} Log in to https://trello.com/app-key
30
+ #{'2.'.bold} Copy KEY and paste it below
31
+ HEREDOC
32
+
33
+ if prompt.yes?(Dude::Config.style_prompt('Open Trello token creation page in your browser?'))
34
+ `open https://trello.com/app-key`
35
+ end
36
+
37
+ prompt.ask(Dude::Config.style_prompt('Trello key:'), required: true)
38
+ end
39
+
40
+ def setup_token
41
+ puts <<~HEREDOC
42
+ You need to create personal token
43
+
44
+ #{'1.'.bold} Log in to https://trello.com/app-key
45
+ #{'2.'.bold} From the dialog that appears click 'Allow'
46
+ #{'3.'.bold} Copy created token to clipboard and paste the it below
47
+ HEREDOC
48
+
49
+ prompt.ask(Dude::Config.style_prompt('Trello token:'), required: true)
50
+ end
51
+
52
+ def setup_board_id
53
+ puts 'Just open your Trello main board and copy id from the url (Example: 123aBcdE)'
54
+ prompt.ask(Dude::Config.style_prompt('Board ID:'), required: true)
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,32 @@
1
+ ---
2
+ :project_management_tool: jira
3
+ :jira:
4
+ :email:
5
+ :token:
6
+ :project:
7
+ :url:
8
+ :key:
9
+ :board_id:
10
+ :trello:
11
+ :board_id:
12
+ :key:
13
+ :token:
14
+ :todo_list_name: To Do
15
+ :in_progress_list_name: In Progress
16
+ :code_review_list_name: Code Review
17
+ :testing_list_name: TESTABLE
18
+ :done_list_name: Done
19
+ :toggl:
20
+ :project_name:
21
+ :token:
22
+ :workspace_id:
23
+ :task_format: "[{issue_id}] {issue_title}"
24
+ :github:
25
+ :token:
26
+ :pr_template:
27
+ :title: "[{issue_id}] {issue_title}\n"
28
+ :body: |
29
+ ## Story
30
+ [**\[{issue_id}\] {issue_title}**]({issue_url})
31
+ ## Description
32
+ Example description of the issue
@@ -5,17 +5,15 @@ require 'faraday'
5
5
  module Dude
6
6
  module Toggl
7
7
  class Base
8
- include Settings
9
-
10
8
  def toggl_api
11
9
  Faraday.new('https://api.track.toggl.com') do |conn|
12
- conn.basic_auth settings['TOGGL_TOKEN'], 'api_token'
10
+ conn.basic_auth Dude::SETTINGS.dig(:toggl, :token), 'api_token'
13
11
  conn.headers['Content-Type'] = 'application/json'
14
12
  end
15
13
  end
16
14
 
17
15
  def projects_response
18
- toggl_api.get("/api/v8/workspaces/#{settings['TOGGL_WORKSPACE_ID']}/projects")
16
+ toggl_api.get("/api/v8/workspaces/#{Dude::SETTINGS.dig(:toggl, :workspace_id)}/projects")
19
17
  end
20
18
  end
21
19
  end
data/lib/dude/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dude
4
- VERSION = '2.0.7'
4
+ VERSION = '2.1.0.alpha5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dude-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.1.0.alpha5
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-04-02 00:00:00.000000000 Z
11
+ date: 2021-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: tty-prompt
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.23.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.23.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: pry
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -178,27 +192,49 @@ files:
178
192
  - bin/setup
179
193
  - dude.gemspec
180
194
  - lib/dude.rb
195
+ - lib/dude/code_management.rb
196
+ - lib/dude/code_management/github/client.rb
197
+ - lib/dude/code_management/github/create_pull_request.rb
181
198
  - lib/dude/commands.rb
182
199
  - lib/dude/commands/checkout.rb
200
+ - lib/dude/commands/health_check.rb
183
201
  - lib/dude/commands/install.rb
184
202
  - lib/dude/commands/move.rb
203
+ - lib/dude/commands/pr.rb
204
+ - lib/dude/commands/pr/create.rb
205
+ - lib/dude/commands/pr/remove.rb
185
206
  - lib/dude/commands/start.rb
186
207
  - lib/dude/commands/stop.rb
187
208
  - lib/dude/commands/tasks.rb
188
209
  - lib/dude/commands/track.rb
189
210
  - lib/dude/commands/version.rb
211
+ - lib/dude/config.rb
190
212
  - lib/dude/git.rb
191
213
  - lib/dude/git/checkout.rb
192
214
  - lib/dude/git/current_branch_name.rb
215
+ - lib/dude/git/remote_name.rb
216
+ - lib/dude/health_check.rb
193
217
  - lib/dude/project_management/client.rb
194
- - lib/dude/project_management/entities/board.rb
195
218
  - lib/dude/project_management/entities/issue.rb
196
219
  - lib/dude/project_management/jira.rb
197
220
  - lib/dude/project_management/jira/client.rb
221
+ - lib/dude/project_management/jira/fetch_current_task.rb
198
222
  - lib/dude/project_management/jira/fetch_current_tasks.rb
199
223
  - lib/dude/project_management/jira/get_task_name_by_id.rb
200
224
  - lib/dude/project_management/jira/move_task_to_list.rb
225
+ - lib/dude/project_management/trello.rb
226
+ - lib/dude/project_management/trello/client.rb
227
+ - lib/dude/project_management/trello/fetch_current_task.rb
228
+ - lib/dude/project_management/trello/fetch_current_tasks.rb
229
+ - lib/dude/project_management/trello/fetch_lists.rb
230
+ - lib/dude/project_management/trello/get_task_name_by_id.rb
231
+ - lib/dude/project_management/trello/move_task_to_list.rb
201
232
  - lib/dude/settings.rb
233
+ - lib/dude/setup/github.rb
234
+ - lib/dude/setup/jira.rb
235
+ - lib/dude/setup/toggl.rb
236
+ - lib/dude/setup/trello.rb
237
+ - lib/dude/templates/duderc_template
202
238
  - lib/dude/time_trackers/toggl.rb
203
239
  - lib/dude/time_trackers/toggl/base.rb
204
240
  - lib/dude/time_trackers/toggl/start_time_entry.rb
@@ -219,12 +255,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
219
255
  requirements:
220
256
  - - ">="
221
257
  - !ruby/object:Gem::Version
222
- version: 2.5.0
258
+ version: 2.7.0
223
259
  required_rubygems_version: !ruby/object:Gem::Requirement
224
260
  requirements:
225
- - - ">="
261
+ - - ">"
226
262
  - !ruby/object:Gem::Version
227
- version: '0'
263
+ version: 1.3.1
228
264
  requirements: []
229
265
  rubygems_version: 3.1.4
230
266
  signing_key: