dude-cli 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -2
- data/.travis.yml +4 -3
- data/CHANGELOG.md +25 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +55 -54
- data/README.md +41 -25
- data/bin/dude +3 -2
- data/dude.gemspec +16 -16
- data/lib/dude.rb +14 -0
- data/lib/dude/commands.rb +24 -0
- data/lib/dude/commands/checkout.rb +21 -0
- data/lib/dude/commands/install.rb +57 -0
- data/lib/dude/commands/move.rb +15 -0
- data/lib/dude/commands/start.rb +29 -0
- data/lib/dude/commands/stop.rb +15 -0
- data/lib/dude/commands/tasks.rb +31 -0
- data/lib/dude/commands/track.rb +28 -0
- data/lib/dude/commands/version.rb +11 -0
- data/lib/dude/git.rb +5 -0
- data/lib/dude/git/checkout.rb +2 -16
- data/lib/dude/git/current_branch_name.rb +1 -2
- data/lib/dude/project_management/client.rb +25 -0
- data/lib/dude/project_management/entities/board.rb +9 -0
- data/lib/dude/project_management/entities/issue.rb +37 -0
- data/lib/dude/project_management/jira.rb +9 -0
- data/lib/dude/project_management/jira/client.rb +49 -0
- data/lib/dude/project_management/jira/get_current_tasks.rb +40 -0
- data/lib/dude/project_management/jira/get_task_name_by_id.rb +24 -0
- data/lib/dude/project_management/jira/move_task_to_list.rb +47 -0
- data/lib/dude/project_management/trello.rb +6 -0
- data/lib/dude/project_management/trello/checkout.rb +4 -0
- data/lib/dude/project_management/trello/client.rb +33 -0
- data/lib/dude/project_management/trello/get_current_tasks.rb +24 -0
- data/lib/dude/project_management/trello/get_lists.rb +15 -0
- data/lib/dude/project_management/trello/move_tasks_to_list.rb +14 -0
- data/lib/dude/settings.rb +6 -2
- data/lib/dude/time_trackers/toggl.rb +5 -0
- data/lib/dude/time_trackers/toggl/base.rb +18 -0
- data/lib/dude/{toggl → time_trackers/toggl}/start_time_entry.rb +14 -8
- data/lib/dude/{toggl → time_trackers/toggl}/stop_time_entry.rb +4 -2
- data/lib/dude/version.rb +1 -1
- metadata +56 -103
- data/.ruby-version +0 -1
- data/LICENSE.txt +0 -21
- data/lib/dude/cli.rb +0 -156
- data/lib/dude/gitlab/add_spend_time.rb +0 -36
- data/lib/dude/gitlab/base.rb +0 -38
- data/lib/dude/gitlab/count_spend_time.rb +0 -13
- data/lib/dude/gitlab/estimate.rb +0 -20
- data/lib/dude/gitlab/get_issue_info.rb +0 -9
- data/lib/dude/gitlab/get_issue_time_spent.rb +0 -9
- data/lib/dude/gitlab/get_issue_title.rb +0 -14
- data/lib/dude/gitlab/get_my_issues.rb +0 -31
- data/lib/dude/gitlab/move_issue.rb +0 -37
- data/lib/dude/interface.rb +0 -98
- data/lib/dude/report.rb +0 -38
- data/lib/dude/service.rb +0 -18
- data/lib/dude/toggl.rb +0 -40
- data/lib/dude/toggl/base.rb +0 -36
- data/lib/dude/toggl/issue_spend_time.rb +0 -56
- data/lib/dude/toggl/report.rb +0 -25
@@ -0,0 +1,33 @@
|
|
1
|
+
# TODO
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Dude
|
7
|
+
module Trello
|
8
|
+
class Client
|
9
|
+
private
|
10
|
+
|
11
|
+
def faraday_client
|
12
|
+
@faraday_client ||= Faraday.new('https://api.trello.com/', {
|
13
|
+
params: {
|
14
|
+
key: "62b20e9eeab2d6e06145c69178521225",
|
15
|
+
token: "6285fc2d2ff6100a5c341838d0e4acfed3601ae503beb973ddccf1cfab088537"
|
16
|
+
}
|
17
|
+
})
|
18
|
+
end
|
19
|
+
|
20
|
+
def method_missing(method, *args, &block)
|
21
|
+
faraday_client.send(method, *args, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_current_tasks
|
25
|
+
GetCurrentTasks.new(client).call
|
26
|
+
end
|
27
|
+
|
28
|
+
def move_task_to_list(id, list)
|
29
|
+
MoveTasksToList.new(client, id: id, list_name: list).call
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# TODO
|
2
|
+
module Dude
|
3
|
+
module Trello
|
4
|
+
class GetLists < Dry::CLI::Command
|
5
|
+
desc "Get board lists"
|
6
|
+
|
7
|
+
def call
|
8
|
+
client = Trello::Client.new
|
9
|
+
response = client.get "/1/boards/#{BOARD_ID}/lists"
|
10
|
+
body = JSON.parse(response.body)
|
11
|
+
puts body
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# TODO
|
2
|
+
module Dude
|
3
|
+
module Trello
|
4
|
+
class MoveTasksToList < Dry::CLI::Command
|
5
|
+
desc "Get board lists"
|
6
|
+
|
7
|
+
def call
|
8
|
+
# response = client.get("/1/boards/#{BOARD_ID}/cards/#{id}", { fields: 'id' })
|
9
|
+
# card_id = JSON.parse(response.body).dig('id')
|
10
|
+
# client.put("/1/cards/#{card_id}", { idList: selected_list(list) })
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/dude/settings.rb
CHANGED
@@ -3,10 +3,14 @@ module Dude
|
|
3
3
|
CONFIG_FILE = '.duderc'
|
4
4
|
|
5
5
|
def settings
|
6
|
-
@settings ||= read(file).strip.split("\n").
|
7
|
-
|
6
|
+
@settings ||= read(file).strip.split("\n").map do |line|
|
7
|
+
next if line =~ /^#/ || line.empty?
|
8
|
+
line.split('=').map(&:strip)
|
9
|
+
end.compact.to_h
|
8
10
|
end
|
9
11
|
|
12
|
+
private
|
13
|
+
|
10
14
|
def file
|
11
15
|
@file = File.join(Dir.home, CONFIG_FILE)
|
12
16
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Dude
|
2
|
+
module Toggl
|
3
|
+
class Base
|
4
|
+
include Settings
|
5
|
+
|
6
|
+
def toggl_api
|
7
|
+
Faraday.new('https://api.track.toggl.com') do |conn|
|
8
|
+
conn.basic_auth settings['TOGGL_TOKEN'], 'api_token'
|
9
|
+
conn.headers['Content-Type'] = 'application/json'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def projects_response
|
14
|
+
toggl_api.get("/api/v8/workspaces/#{settings['TOGGL_WORKSPACE_ID']}/projects")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,17 +1,23 @@
|
|
1
|
+
require 'dude/time_trackers/toggl/base'
|
2
|
+
|
1
3
|
module Dude
|
2
4
|
module Toggl
|
3
5
|
class StartTimeEntry < Dude::Toggl::Base
|
4
6
|
|
5
|
-
def call
|
7
|
+
def call(task_title:, project:)
|
8
|
+
@task_title = task_title
|
9
|
+
@project = project
|
10
|
+
|
6
11
|
start_time_entry
|
7
12
|
print_message
|
8
13
|
end
|
9
14
|
|
15
|
+
private
|
16
|
+
|
17
|
+
attr_reader :task_title, :project
|
18
|
+
|
10
19
|
def start_time_entry
|
11
|
-
toggl_api
|
12
|
-
time_entry_params(options[:title]),
|
13
|
-
content_type: :json
|
14
|
-
)
|
20
|
+
toggl_api.post('/api/v8/time_entries/start', time_entry_params(task_title))
|
15
21
|
end
|
16
22
|
|
17
23
|
def time_entry_params(title)
|
@@ -26,7 +32,7 @@ module Dude
|
|
26
32
|
|
27
33
|
def project_id
|
28
34
|
projects_array.each do |arr|
|
29
|
-
return arr.last if arr.first.eql?(
|
35
|
+
return arr.last if arr.first.eql?(project.downcase)
|
30
36
|
end
|
31
37
|
nil
|
32
38
|
end
|
@@ -36,11 +42,11 @@ module Dude
|
|
36
42
|
end
|
37
43
|
|
38
44
|
def parsed_response
|
39
|
-
JSON.parse(projects_response)
|
45
|
+
JSON.parse(projects_response.body)
|
40
46
|
end
|
41
47
|
|
42
48
|
def print_message
|
43
|
-
puts "Toggl task '#{
|
49
|
+
puts "Toggl task '#{task_title}' is started".colorize(:green)
|
44
50
|
end
|
45
51
|
end
|
46
52
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'dude/time_trackers/toggl/base'
|
2
|
+
|
1
3
|
module Dude
|
2
4
|
module Toggl
|
3
5
|
class StopTimeEntry < Dude::Toggl::Base
|
@@ -9,11 +11,11 @@ module Dude
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def stop_current_time_entry
|
12
|
-
toggl_api
|
14
|
+
toggl_api.put("api/v8/time_entries/#{current_time_entry['id']}/stop", '')
|
13
15
|
end
|
14
16
|
|
15
17
|
def current_time_entry
|
16
|
-
JSON.parse(toggl_api
|
18
|
+
JSON.parse(toggl_api.get('api/v8/time_entries/current').body)['data']
|
17
19
|
end
|
18
20
|
|
19
21
|
def print_success_message
|
data/lib/dude/version.rb
CHANGED
metadata
CHANGED
@@ -1,141 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dude-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikita Pupko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: dry-cli
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.16'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.16'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pry
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.11.3
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.11.3
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: thor
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
17
|
+
- - ">="
|
74
18
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
19
|
+
version: '0.6'
|
76
20
|
type: :runtime
|
77
21
|
prerelease: false
|
78
22
|
version_requirements: !ruby/object:Gem::Requirement
|
79
23
|
requirements:
|
80
|
-
- - "
|
24
|
+
- - ">="
|
81
25
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
26
|
+
version: '0.6'
|
83
27
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
28
|
+
name: faraday
|
85
29
|
requirement: !ruby/object:Gem::Requirement
|
86
30
|
requirements:
|
87
31
|
- - "~>"
|
88
32
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
33
|
+
version: '1.1'
|
90
34
|
type: :runtime
|
91
35
|
prerelease: false
|
92
36
|
version_requirements: !ruby/object:Gem::Requirement
|
93
37
|
requirements:
|
94
38
|
- - "~>"
|
95
39
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
40
|
+
version: '1.1'
|
97
41
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
42
|
+
name: colorize
|
99
43
|
requirement: !ruby/object:Gem::Requirement
|
100
44
|
requirements:
|
101
45
|
- - "~>"
|
102
46
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
47
|
+
version: 0.8.1
|
104
48
|
type: :runtime
|
105
49
|
prerelease: false
|
106
50
|
version_requirements: !ruby/object:Gem::Requirement
|
107
51
|
requirements:
|
108
52
|
- - "~>"
|
109
53
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
54
|
+
version: 0.8.1
|
111
55
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
56
|
+
name: jira-ruby
|
113
57
|
requirement: !ruby/object:Gem::Requirement
|
114
58
|
requirements:
|
115
59
|
- - "~>"
|
116
60
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1
|
61
|
+
version: '2.1'
|
118
62
|
type: :runtime
|
119
63
|
prerelease: false
|
120
64
|
version_requirements: !ruby/object:Gem::Requirement
|
121
65
|
requirements:
|
122
66
|
- - "~>"
|
123
67
|
- !ruby/object:Gem::Version
|
124
|
-
version: '1
|
68
|
+
version: '2.1'
|
125
69
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
70
|
+
name: pry
|
127
71
|
requirement: !ruby/object:Gem::Requirement
|
128
72
|
requirements:
|
129
73
|
- - "~>"
|
130
74
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
-
type: :
|
75
|
+
version: 0.13.1
|
76
|
+
type: :development
|
133
77
|
prerelease: false
|
134
78
|
version_requirements: !ruby/object:Gem::Requirement
|
135
79
|
requirements:
|
136
80
|
- - "~>"
|
137
81
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
82
|
+
version: 0.13.1
|
139
83
|
description: This program helps to combine such services as Gitlab, Toggl and git
|
140
84
|
and replace most routine activities with one simple CLI utility.
|
141
85
|
email:
|
@@ -147,11 +91,10 @@ extra_rdoc_files: []
|
|
147
91
|
files:
|
148
92
|
- ".gitignore"
|
149
93
|
- ".rspec"
|
150
|
-
- ".ruby-version"
|
151
94
|
- ".travis.yml"
|
95
|
+
- CHANGELOG.md
|
152
96
|
- Gemfile
|
153
97
|
- Gemfile.lock
|
154
|
-
- LICENSE.txt
|
155
98
|
- README.md
|
156
99
|
- Rakefile
|
157
100
|
- bin/console
|
@@ -159,33 +102,44 @@ files:
|
|
159
102
|
- bin/setup
|
160
103
|
- dude.gemspec
|
161
104
|
- lib/dude.rb
|
162
|
-
- lib/dude/
|
105
|
+
- lib/dude/commands.rb
|
106
|
+
- lib/dude/commands/checkout.rb
|
107
|
+
- lib/dude/commands/install.rb
|
108
|
+
- lib/dude/commands/move.rb
|
109
|
+
- lib/dude/commands/start.rb
|
110
|
+
- lib/dude/commands/stop.rb
|
111
|
+
- lib/dude/commands/tasks.rb
|
112
|
+
- lib/dude/commands/track.rb
|
113
|
+
- lib/dude/commands/version.rb
|
114
|
+
- lib/dude/git.rb
|
163
115
|
- lib/dude/git/checkout.rb
|
164
116
|
- lib/dude/git/current_branch_name.rb
|
165
|
-
- lib/dude/
|
166
|
-
- lib/dude/
|
167
|
-
- lib/dude/
|
168
|
-
- lib/dude/
|
169
|
-
- lib/dude/
|
170
|
-
- lib/dude/
|
171
|
-
- lib/dude/
|
172
|
-
- lib/dude/
|
173
|
-
- lib/dude/
|
174
|
-
- lib/dude/
|
175
|
-
- lib/dude/
|
176
|
-
- lib/dude/
|
117
|
+
- lib/dude/project_management/client.rb
|
118
|
+
- lib/dude/project_management/entities/board.rb
|
119
|
+
- lib/dude/project_management/entities/issue.rb
|
120
|
+
- lib/dude/project_management/jira.rb
|
121
|
+
- lib/dude/project_management/jira/client.rb
|
122
|
+
- lib/dude/project_management/jira/get_current_tasks.rb
|
123
|
+
- lib/dude/project_management/jira/get_task_name_by_id.rb
|
124
|
+
- lib/dude/project_management/jira/move_task_to_list.rb
|
125
|
+
- lib/dude/project_management/trello.rb
|
126
|
+
- lib/dude/project_management/trello/checkout.rb
|
127
|
+
- lib/dude/project_management/trello/client.rb
|
128
|
+
- lib/dude/project_management/trello/get_current_tasks.rb
|
129
|
+
- lib/dude/project_management/trello/get_lists.rb
|
130
|
+
- lib/dude/project_management/trello/move_tasks_to_list.rb
|
177
131
|
- lib/dude/settings.rb
|
178
|
-
- lib/dude/toggl.rb
|
179
|
-
- lib/dude/toggl/base.rb
|
180
|
-
- lib/dude/toggl/
|
181
|
-
- lib/dude/toggl/
|
182
|
-
- lib/dude/toggl/start_time_entry.rb
|
183
|
-
- lib/dude/toggl/stop_time_entry.rb
|
132
|
+
- lib/dude/time_trackers/toggl.rb
|
133
|
+
- lib/dude/time_trackers/toggl/base.rb
|
134
|
+
- lib/dude/time_trackers/toggl/start_time_entry.rb
|
135
|
+
- lib/dude/time_trackers/toggl/stop_time_entry.rb
|
184
136
|
- lib/dude/version.rb
|
185
137
|
homepage: https://github.com/npupko/dude
|
186
|
-
licenses:
|
187
|
-
|
188
|
-
|
138
|
+
licenses: []
|
139
|
+
metadata:
|
140
|
+
homepage_uri: https://github.com/npupko/dude
|
141
|
+
source_code_uri: https://github.com/npupko/dude
|
142
|
+
changelog_uri: https://github.com/npupko/dude/blob/master/CHANGELOG.md
|
189
143
|
post_install_message:
|
190
144
|
rdoc_options: []
|
191
145
|
require_paths:
|
@@ -194,15 +148,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
148
|
requirements:
|
195
149
|
- - ">="
|
196
150
|
- !ruby/object:Gem::Version
|
197
|
-
version: 2.
|
151
|
+
version: 2.3.0
|
198
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
153
|
requirements:
|
200
154
|
- - ">="
|
201
155
|
- !ruby/object:Gem::Version
|
202
156
|
version: '0'
|
203
157
|
requirements: []
|
204
|
-
|
205
|
-
rubygems_version: 2.7.3
|
158
|
+
rubygems_version: 3.1.4
|
206
159
|
signing_key:
|
207
160
|
specification_version: 4
|
208
161
|
summary: A daily assistant in the hard work of a programmer.
|