dude-cli 2.0.7 → 2.1.0.alpha5
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 +4 -4
- data/.rspec +0 -1
- data/.rubocop.yml +5 -1
- data/Gemfile.lock +36 -15
- data/README.md +43 -35
- data/dude.gemspec +3 -2
- data/lib/dude.rb +12 -2
- data/lib/dude/code_management.rb +10 -0
- data/lib/dude/code_management/github/client.rb +27 -0
- data/lib/dude/code_management/github/create_pull_request.rb +61 -0
- data/lib/dude/commands.rb +7 -0
- data/lib/dude/commands/health_check.rb +15 -0
- data/lib/dude/commands/install.rb +63 -41
- 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 +10 -8
- data/lib/dude/commands/stop.rb +0 -2
- data/lib/dude/commands/tasks.rb +0 -2
- data/lib/dude/commands/track.rb +2 -4
- data/lib/dude/config.rb +18 -0
- data/lib/dude/git.rb +1 -0
- data/lib/dude/git/remote_name.rb +21 -0
- data/lib/dude/health_check.rb +39 -0
- data/lib/dude/project_management/client.rb +8 -4
- data/lib/dude/project_management/entities/issue.rb +8 -7
- data/lib/dude/project_management/jira/client.rb +21 -8
- data/lib/dude/project_management/jira/fetch_current_task.rb +37 -0
- data/lib/dude/project_management/jira/fetch_current_tasks.rb +3 -4
- data/lib/dude/project_management/jira/get_task_name_by_id.rb +0 -2
- data/lib/dude/project_management/jira/move_task_to_list.rb +0 -2
- data/lib/dude/project_management/{entities/board.rb → trello.rb} +1 -3
- data/lib/dude/project_management/trello/client.rb +56 -0
- data/lib/dude/project_management/trello/fetch_current_task.rb +41 -0
- data/lib/dude/project_management/trello/fetch_current_tasks.rb +51 -0
- data/lib/dude/project_management/trello/fetch_lists.rb +22 -0
- data/lib/dude/project_management/trello/get_task_name_by_id.rb +23 -0
- data/lib/dude/project_management/trello/move_task_to_list.rb +53 -0
- data/lib/dude/setup/github.rb +35 -0
- data/lib/dude/setup/jira.rb +64 -0
- data/lib/dude/setup/toggl.rb +47 -0
- data/lib/dude/setup/trello.rb +58 -0
- data/lib/dude/templates/duderc_template +32 -0
- data/lib/dude/time_trackers/toggl/base.rb +2 -4
- data/lib/dude/version.rb +1 -1
- metadata +42 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a9d94fda51194e817efc77f7d46cf2cf7f8e94351c7cb989f7dd0512637e16f
|
4
|
+
data.tar.gz: 842f71093238abc9e102594629dc20ea6dc4677968c526dc6d0695ffd99a61d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ff9e01d64edc716ec55b366a03774eeb29819061e9ff52d4075f68780eb5f9f3fdb8249b5f31dc032e24d859dac341badda6cb19a074f58e55becefeafd32ca
|
7
|
+
data.tar.gz: 1739d16b3db6b32d57d0f186ea918c6358c2ff6e026cb1a5daf29e9c9e0b8e09d509bc034cfc94030bdf2c4169e312b527870f01271512bdf36451bc0ab4467b
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -2,8 +2,12 @@ Style/Documentation:
|
|
2
2
|
Enabled: false
|
3
3
|
|
4
4
|
AllCops:
|
5
|
+
NewCops: enable
|
5
6
|
SuggestExtensions: false
|
6
|
-
TargetRubyVersion: 2.
|
7
|
+
TargetRubyVersion: 2.7
|
7
8
|
|
8
9
|
Metrics/BlockLength:
|
9
10
|
IgnoredMethods: ['describe', 'context']
|
11
|
+
|
12
|
+
Layout/FirstHashElementIndentation:
|
13
|
+
EnforcedStyle: consistent
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dude-cli (2.0.
|
4
|
+
dude-cli (2.1.0.alpha5)
|
5
5
|
colorize (~> 0.8.1)
|
6
6
|
dry-cli (~> 0.6)
|
7
7
|
faraday (~> 1.1)
|
8
8
|
jira-ruby (~> 2.1)
|
9
|
+
tty-prompt (~> 0.23.1)
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
activesupport (6.1.3)
|
14
|
+
activesupport (6.1.3.2)
|
14
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
16
|
i18n (>= 1.6, < 2)
|
16
17
|
minitest (>= 5.1)
|
@@ -24,14 +25,21 @@ GEM
|
|
24
25
|
concurrent-ruby (1.1.8)
|
25
26
|
diff-lcs (1.4.4)
|
26
27
|
docile (1.3.5)
|
27
|
-
dry-cli (0.
|
28
|
-
|
29
|
-
|
28
|
+
dry-cli (0.7.0)
|
29
|
+
faraday (1.4.2)
|
30
|
+
faraday-em_http (~> 1.0)
|
31
|
+
faraday-em_synchrony (~> 1.0)
|
32
|
+
faraday-excon (~> 1.1)
|
30
33
|
faraday-net_http (~> 1.0)
|
34
|
+
faraday-net_http_persistent (~> 1.1)
|
31
35
|
multipart-post (>= 1.2, < 3)
|
32
|
-
ruby2_keywords
|
36
|
+
ruby2_keywords (>= 0.0.4)
|
37
|
+
faraday-em_http (1.0.0)
|
38
|
+
faraday-em_synchrony (1.0.0)
|
39
|
+
faraday-excon (1.1.0)
|
33
40
|
faraday-net_http (1.0.1)
|
34
|
-
|
41
|
+
faraday-net_http_persistent (1.1.0)
|
42
|
+
i18n (1.8.10)
|
35
43
|
concurrent-ruby (~> 1.0)
|
36
44
|
jira-ruby (2.1.5)
|
37
45
|
activesupport
|
@@ -42,17 +50,19 @@ GEM
|
|
42
50
|
method_source (1.0.0)
|
43
51
|
minitest (5.14.4)
|
44
52
|
multipart-post (2.1.1)
|
45
|
-
oauth (0.5.
|
53
|
+
oauth (0.5.6)
|
46
54
|
parallel (1.20.1)
|
47
|
-
parser (3.0.
|
55
|
+
parser (3.0.1.1)
|
48
56
|
ast (~> 2.4.1)
|
49
|
-
|
57
|
+
pastel (0.8.0)
|
58
|
+
tty-color (~> 0.5)
|
59
|
+
pry (0.14.1)
|
50
60
|
coderay (~> 1.1)
|
51
61
|
method_source (~> 1.0)
|
52
62
|
rainbow (3.0.0)
|
53
63
|
rake (13.0.3)
|
54
64
|
regexp_parser (2.1.1)
|
55
|
-
rexml (3.2.
|
65
|
+
rexml (3.2.5)
|
56
66
|
rspec (3.10.0)
|
57
67
|
rspec-core (~> 3.10.0)
|
58
68
|
rspec-expectations (~> 3.10.0)
|
@@ -66,17 +76,17 @@ GEM
|
|
66
76
|
diff-lcs (>= 1.2.0, < 2.0)
|
67
77
|
rspec-support (~> 3.10.0)
|
68
78
|
rspec-support (3.10.2)
|
69
|
-
rubocop (1.
|
79
|
+
rubocop (1.15.0)
|
70
80
|
parallel (~> 1.10)
|
71
81
|
parser (>= 3.0.0.0)
|
72
82
|
rainbow (>= 2.2.2, < 4.0)
|
73
83
|
regexp_parser (>= 1.8, < 3.0)
|
74
84
|
rexml
|
75
|
-
rubocop-ast (>= 1.
|
85
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
76
86
|
ruby-progressbar (~> 1.7)
|
77
87
|
unicode-display_width (>= 1.4.0, < 3.0)
|
78
|
-
rubocop-ast (1.
|
79
|
-
parser (>=
|
88
|
+
rubocop-ast (1.5.0)
|
89
|
+
parser (>= 3.0.1.1)
|
80
90
|
ruby-progressbar (1.11.0)
|
81
91
|
ruby2_keywords (0.0.4)
|
82
92
|
simplecov (0.21.2)
|
@@ -87,9 +97,20 @@ GEM
|
|
87
97
|
simplecov (~> 0.8)
|
88
98
|
simplecov-html (0.12.3)
|
89
99
|
simplecov_json_formatter (0.1.2)
|
100
|
+
tty-color (0.6.0)
|
101
|
+
tty-cursor (0.7.1)
|
102
|
+
tty-prompt (0.23.1)
|
103
|
+
pastel (~> 0.8)
|
104
|
+
tty-reader (~> 0.8)
|
105
|
+
tty-reader (0.9.0)
|
106
|
+
tty-cursor (~> 0.7)
|
107
|
+
tty-screen (~> 0.8)
|
108
|
+
wisper (~> 2.0)
|
109
|
+
tty-screen (0.8.1)
|
90
110
|
tzinfo (2.0.4)
|
91
111
|
concurrent-ruby (~> 1.0)
|
92
112
|
unicode-display_width (2.0.0)
|
113
|
+
wisper (2.0.1)
|
93
114
|
zeitwerk (2.4.2)
|
94
115
|
|
95
116
|
PLATFORMS
|
data/README.md
CHANGED
@@ -8,7 +8,9 @@
|
|
8
8
|
|
9
9
|
A daily assistant in the hard work of a programmer
|
10
10
|
|
11
|
-
This program helps to combine such services as [Jira](https://atlassian.net), [Toggl](https://toggl.com) and replace most routine activities with one simple CLI utility.
|
11
|
+
This program helps to combine such services as [Jira](https://atlassian.net), [Trello](https://trello.com), [Toggl](https://toggl.com), etc. and replace most routine activities with one simple CLI utility.
|
12
|
+
|
13
|
+

|
12
14
|
|
13
15
|
## Installation
|
14
16
|
|
@@ -26,45 +28,49 @@ Or install it yourself as:
|
|
26
28
|
|
27
29
|
$ gem install dude-cli
|
28
30
|
|
29
|
-
After that create .duderc file in your
|
31
|
+
After that create .duderc.yml file in your work project directory by command:
|
30
32
|
|
31
33
|
$ dude install
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
`PROJECT_MANAGEMENT_TOOL=jira` - Project management (Now only Jira supported)
|
36
|
-
`ATLASSIAN_EMAIL` - Your Jira email
|
37
|
-
|
38
|
-
`ATLASSIAN_TOKEN` - How to create Atlassian token: https://support.siteimprove.com/hc/en-gb/articles/360004317332-How-to-create-an-API-token-from-your-Atlassian-account
|
39
|
-
|
40
|
-
`ATLASSIAN_URL` - URL of your project. Example: https://example.atlassian.net
|
35
|
+
It will offer you a step by step instruction how to setup dude:
|
41
36
|
|
42
|
-
|
37
|
+

|
43
38
|
|
44
|
-
|
45
|
-
Just open your atlassian main board and copy id from the url after rapidView=*ID* part.
|
39
|
+
You always could edit this file manually and setup some stuff like Toggl time entry name or Github PR template
|
46
40
|
|
47
|
-
|
41
|
+
Default template could be found here: [lib/dude/templates/duderc_template](/lib/dude/templates/duderc_template)
|
48
42
|
|
43
|
+
### Additional configuration variables:
|
49
44
|
|
50
45
|
#### Replace it with your project list names. Skip for empty lists
|
51
46
|
|
47
|
+
```yaml
|
48
|
+
:todo_list_name: To Do
|
49
|
+
:in_progress_list_name: In Progress
|
50
|
+
:code_review_list_name: Code Review
|
51
|
+
:testing_list_name: TESTABLE
|
52
|
+
:done_list_name: Done
|
52
53
|
```
|
53
|
-
TODO_LIST_NAME=To Do
|
54
|
-
IN_PROGRESS_LIST_NAME=In Progress
|
55
|
-
CODE_REVIEW_LIST_NAME=Code Review
|
56
|
-
TESTING_LIST_NAME=TESTABLE
|
57
|
-
DONE_LIST_NAME=Done
|
58
|
-
```
|
59
|
-
|
60
|
-
`TOGGL_PROJECT_NAME` - Your Toggl project name
|
61
54
|
|
62
|
-
|
55
|
+
#### Use the *{issue_id}* and *{issue_title}* and specify format for the task titles in Toggl or keep it as it is
|
63
56
|
|
64
|
-
|
57
|
+
```yaml
|
58
|
+
:toggl:
|
59
|
+
:task_format: [{issue_id}] {issue_title}
|
60
|
+
```
|
65
61
|
|
66
|
-
####
|
67
|
-
|
62
|
+
#### Github PR template looks like this (Available variables: *{issue_id}*, *{issue_title}*, *{issue_url}*)
|
63
|
+
|
64
|
+
```yaml
|
65
|
+
:github:
|
66
|
+
:pr_template:
|
67
|
+
:title: "[{issue_id}] {issue_title}\n"
|
68
|
+
:body: |
|
69
|
+
## Story
|
70
|
+
[**\[{issue_id}\] {issue_title}**]({issue_url})
|
71
|
+
## Description
|
72
|
+
Example description of the issue
|
73
|
+
```
|
68
74
|
|
69
75
|
## Usage
|
70
76
|
|
@@ -79,14 +85,16 @@ alias dude="rvm 2.7.2 do dude"
|
|
79
85
|
|
80
86
|
| Command | Required parameters | Optional parameters | Description |
|
81
87
|
|:-------------:|:-------------------|:-------------------|:--------------------------------------------------------------------------------------|
|
82
|
-
| dude install
|
83
|
-
| dude checkout
|
84
|
-
| dude track
|
85
|
-
| dude tasks
|
86
|
-
| dude stop
|
87
|
-
| dude start
|
88
|
-
| dude move
|
89
|
-
| dude
|
88
|
+
| dude install | - | - | Create .duderc file in your home directory |
|
89
|
+
| dude checkout | ISSUE_ID | - | Checkout to branch with name "ID-issue-title" |
|
90
|
+
| dude track | ISSUE_ID | - | Start time entry in Toggl with issue project, title and id |
|
91
|
+
| dude tasks | - | - | Show all issues in current project (For current sprint) |
|
92
|
+
| dude stop | - | - | Stop current time entry in Toggl |
|
93
|
+
| dude start | ISSUE_ID | - | Do `checkout`, `track` and `move` actions |
|
94
|
+
| dude move | ISSUE_ID | --list=NAME | Move issue to another column (Will provide options if called without --list parameter) |
|
95
|
+
| dude pr create | | | Creates PR in Github using template |
|
96
|
+
| dude version | - | - | Display gem version |
|
97
|
+
| dude healthcheck | - | - | Check configuration of all dependencies |
|
90
98
|
|
91
99
|
You also can use `dude help` for short description of every command.
|
92
100
|
|
@@ -100,4 +108,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
100
108
|
|
101
109
|
## Changelog
|
102
110
|
|
103
|
-
|
111
|
+
[CHANGELOG.md](/CHANGELOG.md)
|
data/dude.gemspec
CHANGED
@@ -16,13 +16,13 @@ Gem::Specification.new do |spec|
|
|
16
16
|
DESC
|
17
17
|
spec.homepage = 'https://github.com/npupko/dude'
|
18
18
|
spec.license = 'MIT'
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
20
20
|
|
21
21
|
spec.metadata['homepage_uri'] = spec.homepage
|
22
22
|
spec.metadata['source_code_uri'] = 'https://github.com/npupko/dude'
|
23
23
|
spec.metadata['changelog_uri'] = 'https://github.com/npupko/dude/blob/master/CHANGELOG.md'
|
24
24
|
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|demo)/}) }
|
26
26
|
|
27
27
|
spec.bindir = 'bin'
|
28
28
|
spec.executables = ['dude']
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_runtime_dependency 'dry-cli', '~> 0.6'
|
33
33
|
spec.add_runtime_dependency 'faraday', '~> 1.1'
|
34
34
|
spec.add_runtime_dependency 'jira-ruby', '~> 2.1'
|
35
|
+
spec.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
|
35
36
|
|
36
37
|
spec.add_development_dependency 'pry', '~> 0.14.0'
|
37
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
data/lib/dude.rb
CHANGED
@@ -2,13 +2,23 @@
|
|
2
2
|
|
3
3
|
require 'colorize'
|
4
4
|
|
5
|
+
begin
|
6
|
+
require 'pry'
|
7
|
+
rescue LoadError
|
8
|
+
nil
|
9
|
+
end
|
10
|
+
|
5
11
|
require_relative './dude/settings'
|
6
12
|
require_relative './dude/version'
|
7
13
|
require_relative './dude/commands'
|
8
14
|
require_relative './dude/git'
|
15
|
+
require_relative './dude/code_management'
|
16
|
+
require_relative './dude/config'
|
9
17
|
|
10
18
|
module Dude
|
11
|
-
|
19
|
+
SETTINGS = Dude::Config.configure_with('.duderc.yml')
|
20
|
+
LIST_OF_AVAILABLE_PROJECT_MANAGEMENT_TOOLS = %w[jira trello].freeze
|
12
21
|
|
13
|
-
|
22
|
+
class ToBeImplementedError < StandardError; end
|
23
|
+
class TaskNotFoundError < StandardError; end
|
14
24
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './create_pull_request'
|
4
|
+
|
5
|
+
module Dude
|
6
|
+
module CodeManagement
|
7
|
+
module Github
|
8
|
+
class Client
|
9
|
+
def client
|
10
|
+
@client ||= Faraday.new('https://api.github.com/', {
|
11
|
+
headers: { Authorization: "token #{Dude::SETTINGS.dig(:github, :token)}" }
|
12
|
+
})
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_pull_request(issue:, owner:, repo:, params:)
|
16
|
+
CreatePullRequest.new.call(client, issue: issue, owner: owner, repo: repo, params: params)
|
17
|
+
end
|
18
|
+
|
19
|
+
def health_check
|
20
|
+
client.get('https://api.github.com/user').status == 200
|
21
|
+
rescue StandardError
|
22
|
+
false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Dude
|
6
|
+
module CodeManagement
|
7
|
+
module Github
|
8
|
+
class CreatePullRequest
|
9
|
+
def call(client, issue:, owner:, repo:, params:)
|
10
|
+
@issue = issue
|
11
|
+
@owner = owner
|
12
|
+
@repo = repo
|
13
|
+
@params = params
|
14
|
+
|
15
|
+
return unless issue
|
16
|
+
|
17
|
+
response = client.post("https://api.github.com/repos/#{owner}/#{repo}/pulls", body.to_json)
|
18
|
+
res = JSON.parse(response.body)
|
19
|
+
|
20
|
+
return github_error unless res['errors'] && res['errors'].empty?
|
21
|
+
|
22
|
+
url = res['html_url']
|
23
|
+
puts "Pull request has been created: #{url}"
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :issue, :owner, :repo, :params
|
29
|
+
|
30
|
+
def github_error
|
31
|
+
puts <<~HEREDOC
|
32
|
+
#{'Error:'.red.bold} GitHub cannot create new Pull Request from #{params[:head].bold} branch. Try to push your branch and try again
|
33
|
+
HEREDOC
|
34
|
+
end
|
35
|
+
|
36
|
+
def body
|
37
|
+
{
|
38
|
+
title: params[:title] || template[:title],
|
39
|
+
body: params[:body] || template[:body],
|
40
|
+
head: params[:head],
|
41
|
+
base: params[:base]
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def template
|
46
|
+
Dude::SETTINGS.dig(:github, :pr_template).tap do |template|
|
47
|
+
template[:title] = fill_variables(template[:title])
|
48
|
+
template[:body] = fill_variables(template[:body])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def fill_variables(text)
|
53
|
+
text
|
54
|
+
.then { _1.gsub('{issue_id}', issue.id) }.chomp
|
55
|
+
.then { _1.gsub('{issue_url}', issue.url) }
|
56
|
+
.then { _1.gsub('{issue_title}', issue.title) }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/dude/commands.rb
CHANGED
@@ -9,6 +9,8 @@ require_relative './commands/start'
|
|
9
9
|
require_relative './commands/track'
|
10
10
|
require_relative './commands/stop'
|
11
11
|
require_relative './commands/install'
|
12
|
+
require_relative './commands/pr'
|
13
|
+
require_relative './commands/health_check'
|
12
14
|
|
13
15
|
module Dude
|
14
16
|
module Commands
|
@@ -22,5 +24,10 @@ module Dude
|
|
22
24
|
register 'track', Dude::Commands::Track, aliases: ['tr']
|
23
25
|
register 'stop', Dude::Commands::Stop
|
24
26
|
register 'start', Dude::Commands::Start, aliases: ['st']
|
27
|
+
register 'healthcheck', Dude::Commands::HealthCheck
|
28
|
+
|
29
|
+
register 'pr' do |prefix|
|
30
|
+
prefix.register 'create', Dude::Commands::PR::Create
|
31
|
+
end
|
25
32
|
end
|
26
33
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../health_check'
|
4
|
+
|
5
|
+
module Dude
|
6
|
+
module Commands
|
7
|
+
class HealthCheck < Dry::CLI::Command
|
8
|
+
desc 'Run healthcheck for enabled integrations'
|
9
|
+
|
10
|
+
def call
|
11
|
+
Dude::HealthCheck.new.call
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|