dude-cli 2.1.0.alpha2 → 2.1.0
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 +2 -2
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +29 -9
- data/README.md +44 -44
- data/dude.gemspec +3 -2
- data/lib/dude.rb +11 -1
- data/lib/dude/code_management/github/client.rb +7 -3
- data/lib/dude/code_management/github/create_pull_request.rb +16 -8
- data/lib/dude/commands.rb +4 -0
- data/lib/dude/commands/commit.rb +23 -0
- data/lib/dude/commands/health_check.rb +15 -0
- data/lib/dude/commands/install.rb +63 -53
- data/lib/dude/commands/pr/remove.rb +1 -1
- data/lib/dude/commands/start.rb +6 -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/commit.rb +20 -0
- data/lib/dude/health_check.rb +39 -0
- data/lib/dude/project_management/client.rb +1 -3
- data/lib/dude/project_management/jira/client.rb +16 -8
- data/lib/dude/project_management/jira/fetch_current_task.rb +3 -3
- data/lib/dude/project_management/jira/fetch_current_tasks.rb +2 -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/trello/client.rb +9 -5
- data/lib/dude/project_management/trello/fetch_current_task.rb +2 -4
- data/lib/dude/project_management/trello/fetch_current_tasks.rb +0 -2
- data/lib/dude/project_management/trello/fetch_lists.rb +1 -3
- data/lib/dude/project_management/trello/get_task_name_by_id.rb +1 -3
- data/lib/dude/project_management/trello/move_task_to_list.rb +1 -3
- 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 +29 -6
- data/lib/dude/templates/pull_request_template +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8791dfac3c2ed7f7c58a7a6fef335d4abdb924a504ff09eb3a8dabbd1a882682
|
4
|
+
data.tar.gz: 61d08e0ed19364bc034d093fae732858a6b0c912bbdfc22bb27f32206496119b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eea06c3268ae65e384114ee39bddc9eae6b4141fe84a00f32c88967ce906361cbff4f5a6f8127871c35db0b65951e5ace54a44472a4ded0c9918ea4217a367d1
|
7
|
+
data.tar.gz: e63eab6fcde90c458b235072772991624813d31523737671cfcb99ca068e3a98b9a0159e5306141e3418e95e49c4aa1f21d84823ad265d04be3caa7c34c10135
|
@@ -10,7 +10,7 @@ jobs:
|
|
10
10
|
- uses: actions/checkout@v2
|
11
11
|
- uses: ruby/setup-ruby@v1
|
12
12
|
with:
|
13
|
-
ruby-version: 2.
|
13
|
+
ruby-version: 2.7 # Not needed with a .ruby-version file
|
14
14
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
15
15
|
- name: Run Rubocop
|
16
16
|
run: bundle exec rubocop
|
@@ -21,7 +21,7 @@ jobs:
|
|
21
21
|
- uses: actions/checkout@v2
|
22
22
|
- uses: ruby/setup-ruby@v1
|
23
23
|
with:
|
24
|
-
ruby-version: 2.
|
24
|
+
ruby-version: 2.7 # Not needed with a .ruby-version file
|
25
25
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
26
26
|
- name: Run RSpec
|
27
27
|
run: COVERAGE=true bundle exec rspec
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dude-cli (2.1.0
|
4
|
+
dude-cli (2.1.0)
|
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/
|
@@ -25,19 +26,25 @@ GEM
|
|
25
26
|
diff-lcs (1.4.4)
|
26
27
|
docile (1.3.5)
|
27
28
|
dry-cli (0.7.0)
|
28
|
-
faraday (1.
|
29
|
+
faraday (1.7.0)
|
29
30
|
faraday-em_http (~> 1.0)
|
30
31
|
faraday-em_synchrony (~> 1.0)
|
31
32
|
faraday-excon (~> 1.1)
|
33
|
+
faraday-httpclient (~> 1.0.1)
|
32
34
|
faraday-net_http (~> 1.0)
|
33
35
|
faraday-net_http_persistent (~> 1.1)
|
36
|
+
faraday-patron (~> 1.0)
|
37
|
+
faraday-rack (~> 1.0)
|
34
38
|
multipart-post (>= 1.2, < 3)
|
35
39
|
ruby2_keywords (>= 0.0.4)
|
36
40
|
faraday-em_http (1.0.0)
|
37
41
|
faraday-em_synchrony (1.0.0)
|
38
42
|
faraday-excon (1.1.0)
|
43
|
+
faraday-httpclient (1.0.1)
|
39
44
|
faraday-net_http (1.0.1)
|
40
|
-
faraday-net_http_persistent (1.
|
45
|
+
faraday-net_http_persistent (1.2.0)
|
46
|
+
faraday-patron (1.0.0)
|
47
|
+
faraday-rack (1.0.0)
|
41
48
|
i18n (1.8.10)
|
42
49
|
concurrent-ruby (~> 1.0)
|
43
50
|
jira-ruby (2.1.5)
|
@@ -51,13 +58,15 @@ GEM
|
|
51
58
|
multipart-post (2.1.1)
|
52
59
|
oauth (0.5.6)
|
53
60
|
parallel (1.20.1)
|
54
|
-
parser (3.0.
|
61
|
+
parser (3.0.2.0)
|
55
62
|
ast (~> 2.4.1)
|
63
|
+
pastel (0.8.0)
|
64
|
+
tty-color (~> 0.5)
|
56
65
|
pry (0.14.1)
|
57
66
|
coderay (~> 1.1)
|
58
67
|
method_source (~> 1.0)
|
59
68
|
rainbow (3.0.0)
|
60
|
-
rake (13.0.
|
69
|
+
rake (13.0.6)
|
61
70
|
regexp_parser (2.1.1)
|
62
71
|
rexml (3.2.5)
|
63
72
|
rspec (3.10.0)
|
@@ -73,19 +82,19 @@ GEM
|
|
73
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
83
|
rspec-support (~> 3.10.0)
|
75
84
|
rspec-support (3.10.2)
|
76
|
-
rubocop (1.
|
85
|
+
rubocop (1.19.1)
|
77
86
|
parallel (~> 1.10)
|
78
87
|
parser (>= 3.0.0.0)
|
79
88
|
rainbow (>= 2.2.2, < 4.0)
|
80
89
|
regexp_parser (>= 1.8, < 3.0)
|
81
90
|
rexml
|
82
|
-
rubocop-ast (>= 1.
|
91
|
+
rubocop-ast (>= 1.9.1, < 2.0)
|
83
92
|
ruby-progressbar (~> 1.7)
|
84
93
|
unicode-display_width (>= 1.4.0, < 3.0)
|
85
|
-
rubocop-ast (1.
|
94
|
+
rubocop-ast (1.10.0)
|
86
95
|
parser (>= 3.0.1.1)
|
87
96
|
ruby-progressbar (1.11.0)
|
88
|
-
ruby2_keywords (0.0.
|
97
|
+
ruby2_keywords (0.0.5)
|
89
98
|
simplecov (0.21.2)
|
90
99
|
docile (~> 1.1)
|
91
100
|
simplecov-html (~> 0.11)
|
@@ -94,9 +103,20 @@ GEM
|
|
94
103
|
simplecov (~> 0.8)
|
95
104
|
simplecov-html (0.12.3)
|
96
105
|
simplecov_json_formatter (0.1.2)
|
106
|
+
tty-color (0.6.0)
|
107
|
+
tty-cursor (0.7.1)
|
108
|
+
tty-prompt (0.23.1)
|
109
|
+
pastel (~> 0.8)
|
110
|
+
tty-reader (~> 0.8)
|
111
|
+
tty-reader (0.9.0)
|
112
|
+
tty-cursor (~> 0.7)
|
113
|
+
tty-screen (~> 0.8)
|
114
|
+
wisper (~> 2.0)
|
115
|
+
tty-screen (0.8.1)
|
97
116
|
tzinfo (2.0.4)
|
98
117
|
concurrent-ruby (~> 1.0)
|
99
118
|
unicode-display_width (2.0.0)
|
119
|
+
wisper (2.0.1)
|
100
120
|
zeitwerk (2.4.2)
|
101
121
|
|
102
122
|
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
|
+
![Dude](/demo/dude.gif)
|
12
14
|
|
13
15
|
## Installation
|
14
16
|
|
@@ -26,54 +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|trello` - Project management (Now only Jira and Trello supported)
|
36
|
-
|
37
|
-
##### Jira setup
|
38
|
-
|
39
|
-
`ATLASSIAN_EMAIL` - Your Jira email
|
40
|
-
|
41
|
-
`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
|
42
|
-
|
43
|
-
`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:
|
44
36
|
|
45
|
-
|
37
|
+
![Setup Wizard](/demo/wizard.gif)
|
46
38
|
|
47
|
-
|
48
|
-
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
|
49
40
|
|
50
|
-
|
41
|
+
Default template could be found here: [lib/dude/templates/duderc_template](/lib/dude/templates/duderc_template)
|
51
42
|
|
52
|
-
|
53
|
-
You could generate your key and token here: https://trello.com/app-key
|
54
|
-
|
55
|
-
`TRELLO_KEY`
|
56
|
-
|
57
|
-
`TRELLO_TOKEN`
|
43
|
+
### Additional configuration variables:
|
58
44
|
|
59
45
|
#### Replace it with your project list names. Skip for empty lists
|
60
46
|
|
61
|
-
```
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
67
53
|
```
|
68
54
|
|
69
|
-
|
55
|
+
#### Use the *{issue_id}* and *{issue_title}* and specify format for the task titles in Toggl or keep it as it is
|
70
56
|
|
71
|
-
|
72
|
-
|
73
|
-
|
57
|
+
```yaml
|
58
|
+
:toggl:
|
59
|
+
:task_format: [{issue_id}] {issue_title}
|
60
|
+
```
|
74
61
|
|
75
|
-
####
|
76
|
-
|
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
|
+
```
|
77
74
|
|
78
75
|
## Usage
|
79
76
|
|
@@ -88,14 +85,17 @@ alias dude="rvm 2.7.2 do dude"
|
|
88
85
|
|
89
86
|
| Command | Required parameters | Optional parameters | Description |
|
90
87
|
|:-------------:|:-------------------|:-------------------|:--------------------------------------------------------------------------------------|
|
91
|
-
| dude install
|
92
|
-
| dude checkout
|
93
|
-
| dude track
|
94
|
-
| dude tasks
|
95
|
-
| dude
|
96
|
-
| dude
|
97
|
-
| dude
|
98
|
-
| 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 commit | ISSUE_ID | - | Create commit with the ID and title of current story |
|
93
|
+
| dude stop | - | - | Stop current time entry in Toggl |
|
94
|
+
| dude start | ISSUE_ID | - | Do `checkout`, `track` and `move` actions |
|
95
|
+
| dude move | ISSUE_ID | --list=NAME | Move issue to another column (Will provide options if called without --list parameter) |
|
96
|
+
| dude pr create | | | Creates PR in Github using template |
|
97
|
+
| dude version | - | - | Display gem version |
|
98
|
+
| dude healthcheck | - | - | Check configuration of all dependencies |
|
99
99
|
|
100
100
|
You also can use `dude help` for short description of every command.
|
101
101
|
|
@@ -109,4 +109,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
109
109
|
|
110
110
|
## Changelog
|
111
111
|
|
112
|
-
|
112
|
+
[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,14 +2,24 @@
|
|
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'
|
9
15
|
require_relative './dude/code_management'
|
16
|
+
require_relative './dude/config'
|
10
17
|
|
11
18
|
module Dude
|
19
|
+
SETTINGS = Dude::Config.configure_with('.duderc.yml')
|
20
|
+
LIST_OF_AVAILABLE_PROJECT_MANAGEMENT_TOOLS = %w[jira trello].freeze
|
21
|
+
|
12
22
|
class ToBeImplementedError < StandardError; end
|
13
23
|
|
14
|
-
|
24
|
+
class TaskNotFoundError < StandardError; end
|
15
25
|
end
|
@@ -6,17 +6,21 @@ module Dude
|
|
6
6
|
module CodeManagement
|
7
7
|
module Github
|
8
8
|
class Client
|
9
|
-
include Settings
|
10
|
-
|
11
9
|
def client
|
12
10
|
@client ||= Faraday.new('https://api.github.com/', {
|
13
|
-
headers: { Authorization: "token #{
|
11
|
+
headers: { Authorization: "token #{Dude::SETTINGS.dig(:github, :token)}" }
|
14
12
|
})
|
15
13
|
end
|
16
14
|
|
17
15
|
def create_pull_request(issue:, owner:, repo:, params:)
|
18
16
|
CreatePullRequest.new.call(client, issue: issue, owner: owner, repo: repo, params: params)
|
19
17
|
end
|
18
|
+
|
19
|
+
def health_check
|
20
|
+
client.get('https://api.github.com/user').status == 200
|
21
|
+
rescue StandardError
|
22
|
+
false
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -6,16 +6,19 @@ module Dude
|
|
6
6
|
module CodeManagement
|
7
7
|
module Github
|
8
8
|
class CreatePullRequest
|
9
|
-
include Settings
|
10
|
-
|
11
9
|
def call(client, issue:, owner:, repo:, params:)
|
12
10
|
@issue = issue
|
13
11
|
@owner = owner
|
14
12
|
@repo = repo
|
15
13
|
@params = params
|
16
14
|
|
15
|
+
return unless issue
|
16
|
+
|
17
17
|
response = client.post("https://api.github.com/repos/#{owner}/#{repo}/pulls", body.to_json)
|
18
18
|
res = JSON.parse(response.body)
|
19
|
+
|
20
|
+
return github_error if res['errors'] && !res['errors'].empty?
|
21
|
+
|
19
22
|
url = res['html_url']
|
20
23
|
puts "Pull request has been created: #{url}"
|
21
24
|
end
|
@@ -24,20 +27,25 @@ module Dude
|
|
24
27
|
|
25
28
|
attr_reader :issue, :owner, :repo, :params
|
26
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
|
+
|
27
36
|
def body
|
28
37
|
{
|
29
|
-
title: params[:title] || template[
|
30
|
-
body: params[:body] || template[
|
38
|
+
title: params[:title] || template[:title],
|
39
|
+
body: params[:body] || template[:body],
|
31
40
|
head: params[:head],
|
32
41
|
base: params[:base]
|
33
42
|
}
|
34
43
|
end
|
35
44
|
|
36
45
|
def template
|
37
|
-
|
38
|
-
|
39
|
-
template[
|
40
|
-
template['body'] = fill_variables(template['body'])
|
46
|
+
Dude::SETTINGS.dig(:github, :pr_template).tap do |template|
|
47
|
+
template[:title] = fill_variables(template[:title])
|
48
|
+
template[:body] = fill_variables(template[:body])
|
41
49
|
end
|
42
50
|
end
|
43
51
|
|
data/lib/dude/commands.rb
CHANGED
@@ -5,11 +5,13 @@ require_relative './commands/version'
|
|
5
5
|
require_relative './commands/tasks'
|
6
6
|
require_relative './commands/move'
|
7
7
|
require_relative './commands/checkout'
|
8
|
+
require_relative './commands/commit'
|
8
9
|
require_relative './commands/start'
|
9
10
|
require_relative './commands/track'
|
10
11
|
require_relative './commands/stop'
|
11
12
|
require_relative './commands/install'
|
12
13
|
require_relative './commands/pr'
|
14
|
+
require_relative './commands/health_check'
|
13
15
|
|
14
16
|
module Dude
|
15
17
|
module Commands
|
@@ -20,9 +22,11 @@ module Dude
|
|
20
22
|
register 'tasks', Dude::Commands::Tasks, aliases: ['t', '-t', '--tasks']
|
21
23
|
register 'move', Dude::Commands::Move, aliases: ['m', '-m', '--move']
|
22
24
|
register 'checkout', Dude::Commands::Checkout, aliases: ['co']
|
25
|
+
register 'commit', Dude::Commands::Commit
|
23
26
|
register 'track', Dude::Commands::Track, aliases: ['tr']
|
24
27
|
register 'stop', Dude::Commands::Stop
|
25
28
|
register 'start', Dude::Commands::Start, aliases: ['st']
|
29
|
+
register 'healthcheck', Dude::Commands::HealthCheck
|
26
30
|
|
27
31
|
register 'pr' do |prefix|
|
28
32
|
prefix.register 'create', Dude::Commands::PR::Create
|