abt-cli 0.0.19 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/abt +3 -3
- data/lib/abt.rb +6 -6
- data/lib/abt/ari.rb +2 -2
- data/lib/abt/ari_list.rb +1 -1
- data/lib/abt/base_command.rb +7 -7
- data/lib/abt/cli.rb +49 -47
- data/lib/abt/cli/arguments_parser.rb +6 -3
- data/lib/abt/cli/global_commands.rb +23 -0
- data/lib/abt/cli/global_commands/commands.rb +23 -0
- data/lib/abt/cli/global_commands/examples.rb +23 -0
- data/lib/abt/cli/global_commands/help.rb +23 -0
- data/lib/abt/cli/global_commands/readme.rb +23 -0
- data/lib/abt/cli/global_commands/share.rb +36 -0
- data/lib/abt/cli/global_commands/version.rb +23 -0
- data/lib/abt/cli/prompt.rb +64 -52
- data/lib/abt/docs.rb +48 -26
- data/lib/abt/docs/cli.rb +3 -3
- data/lib/abt/docs/markdown.rb +10 -7
- data/lib/abt/git_config.rb +4 -6
- data/lib/abt/helpers.rb +26 -8
- data/lib/abt/providers/asana/api.rb +9 -9
- data/lib/abt/providers/asana/base_command.rb +12 -10
- data/lib/abt/providers/asana/commands/add.rb +13 -12
- data/lib/abt/providers/asana/commands/branch_name.rb +8 -8
- data/lib/abt/providers/asana/commands/clear.rb +7 -8
- data/lib/abt/providers/asana/commands/current.rb +14 -15
- data/lib/abt/providers/asana/commands/finalize.rb +17 -18
- data/lib/abt/providers/asana/commands/harvest_time_entry_data.rb +18 -16
- data/lib/abt/providers/asana/commands/init.rb +8 -41
- data/lib/abt/providers/asana/commands/pick.rb +22 -26
- data/lib/abt/providers/asana/commands/projects.rb +5 -5
- data/lib/abt/providers/asana/commands/share.rb +7 -5
- data/lib/abt/providers/asana/commands/start.rb +28 -21
- data/lib/abt/providers/asana/commands/tasks.rb +6 -6
- data/lib/abt/providers/asana/configuration.rb +37 -29
- data/lib/abt/providers/asana/path.rb +6 -6
- data/lib/abt/providers/devops/api.rb +12 -12
- data/lib/abt/providers/devops/base_command.rb +14 -10
- data/lib/abt/providers/devops/commands/boards.rb +5 -7
- data/lib/abt/providers/devops/commands/branch_name.rb +9 -9
- data/lib/abt/providers/devops/commands/clear.rb +7 -8
- data/lib/abt/providers/devops/commands/current.rb +17 -18
- data/lib/abt/providers/devops/commands/harvest_time_entry_data.rb +21 -19
- data/lib/abt/providers/devops/commands/init.rb +21 -14
- data/lib/abt/providers/devops/commands/pick.rb +25 -19
- data/lib/abt/providers/devops/commands/share.rb +7 -5
- data/lib/abt/providers/devops/commands/{work-items.rb → work_items.rb} +3 -3
- data/lib/abt/providers/devops/configuration.rb +15 -15
- data/lib/abt/providers/devops/path.rb +7 -6
- data/lib/abt/providers/git/commands/branch.rb +23 -21
- data/lib/abt/providers/harvest/api.rb +8 -8
- data/lib/abt/providers/harvest/base_command.rb +10 -8
- data/lib/abt/providers/harvest/commands/clear.rb +7 -8
- data/lib/abt/providers/harvest/commands/current.rb +13 -14
- data/lib/abt/providers/harvest/commands/init.rb +10 -39
- data/lib/abt/providers/harvest/commands/pick.rb +15 -11
- data/lib/abt/providers/harvest/commands/projects.rb +5 -5
- data/lib/abt/providers/harvest/commands/share.rb +7 -5
- data/lib/abt/providers/harvest/commands/start.rb +5 -3
- data/lib/abt/providers/harvest/commands/stop.rb +12 -12
- data/lib/abt/providers/harvest/commands/tasks.rb +7 -7
- data/lib/abt/providers/harvest/commands/track.rb +52 -37
- data/lib/abt/providers/harvest/configuration.rb +18 -18
- data/lib/abt/providers/harvest/path.rb +6 -6
- data/lib/abt/version.rb +1 -1
- metadata +12 -5
@@ -15,11 +15,11 @@ module Abt
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def path
|
18
|
-
Path.new(local_available? && git[
|
18
|
+
Path.new(local_available? && git["path"] || "")
|
19
19
|
end
|
20
20
|
|
21
21
|
def path=(new_path)
|
22
|
-
git[
|
22
|
+
git["path"] = new_path
|
23
23
|
end
|
24
24
|
|
25
25
|
def clear_local(verbose: true)
|
@@ -31,41 +31,41 @@ module Abt
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def access_token
|
34
|
-
return git_global[
|
34
|
+
return git_global["accessToken"] unless git_global["accessToken"].nil?
|
35
35
|
|
36
|
-
git_global[
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
git_global["accessToken"] = cli.prompt.text([
|
37
|
+
"Please provide your personal access token for Harvest.",
|
38
|
+
"If you don't have one, create one here: https://id.getharvest.com/developers",
|
39
|
+
"",
|
40
|
+
"Enter access token"
|
41
41
|
].join("\n"))
|
42
42
|
end
|
43
43
|
|
44
44
|
def account_id
|
45
|
-
return git_global[
|
45
|
+
return git_global["accountId"] unless git_global["accountId"].nil?
|
46
46
|
|
47
|
-
git_global[
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
git_global["accountId"] = cli.prompt.text([
|
48
|
+
"Please provide harvest account id.",
|
49
|
+
"This information is shown next to your generated access token",
|
50
|
+
"",
|
51
|
+
"Enter account id"
|
52
52
|
].join("\n"))
|
53
53
|
end
|
54
54
|
|
55
55
|
def user_id
|
56
|
-
return git_global[
|
56
|
+
return git_global["userId"] unless git_global["userId"].nil?
|
57
57
|
|
58
|
-
git_global[
|
58
|
+
git_global["userId"] = api.get("users/me")["id"].to_s
|
59
59
|
end
|
60
60
|
|
61
61
|
private
|
62
62
|
|
63
63
|
def git
|
64
|
-
@git ||= GitConfig.new(
|
64
|
+
@git ||= GitConfig.new("local", "abt.harvest")
|
65
65
|
end
|
66
66
|
|
67
67
|
def git_global
|
68
|
-
@git_global ||= GitConfig.new(
|
68
|
+
@git_global ||= GitConfig.new("global", "abt.harvest")
|
69
69
|
end
|
70
70
|
|
71
71
|
def api
|
@@ -4,15 +4,15 @@ module Abt
|
|
4
4
|
module Providers
|
5
5
|
module Harvest
|
6
6
|
class Path < String
|
7
|
-
PATH_REGEX = %r{^(?<project_id>\d+)
|
7
|
+
PATH_REGEX = %r{^(?<project_id>\d+)?/?(?<task_id>\d+)?$}.freeze
|
8
8
|
|
9
|
-
def self.from_ids(project_id
|
10
|
-
path = project_id ? [project_id, *task_id].join(
|
11
|
-
new
|
9
|
+
def self.from_ids(project_id: nil, task_id: nil)
|
10
|
+
path = project_id ? [project_id, *task_id].join("/") : ""
|
11
|
+
new(path)
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(path =
|
15
|
-
raise Abt::Cli::Abort, "Invalid path: #{path}" unless path
|
14
|
+
def initialize(path = "")
|
15
|
+
raise Abt::Cli::Abort, "Invalid path: #{path}" unless PATH_REGEX.match?(path)
|
16
16
|
|
17
17
|
super
|
18
18
|
end
|
data/lib/abt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abt-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesper Sørensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|
@@ -80,6 +80,13 @@ files:
|
|
80
80
|
- "./lib/abt/base_command.rb"
|
81
81
|
- "./lib/abt/cli.rb"
|
82
82
|
- "./lib/abt/cli/arguments_parser.rb"
|
83
|
+
- "./lib/abt/cli/global_commands.rb"
|
84
|
+
- "./lib/abt/cli/global_commands/commands.rb"
|
85
|
+
- "./lib/abt/cli/global_commands/examples.rb"
|
86
|
+
- "./lib/abt/cli/global_commands/help.rb"
|
87
|
+
- "./lib/abt/cli/global_commands/readme.rb"
|
88
|
+
- "./lib/abt/cli/global_commands/share.rb"
|
89
|
+
- "./lib/abt/cli/global_commands/version.rb"
|
83
90
|
- "./lib/abt/cli/prompt.rb"
|
84
91
|
- "./lib/abt/docs.rb"
|
85
92
|
- "./lib/abt/docs/cli.rb"
|
@@ -116,7 +123,7 @@ files:
|
|
116
123
|
- "./lib/abt/providers/devops/commands/init.rb"
|
117
124
|
- "./lib/abt/providers/devops/commands/pick.rb"
|
118
125
|
- "./lib/abt/providers/devops/commands/share.rb"
|
119
|
-
- "./lib/abt/providers/devops/commands/
|
126
|
+
- "./lib/abt/providers/devops/commands/work_items.rb"
|
120
127
|
- "./lib/abt/providers/devops/configuration.rb"
|
121
128
|
- "./lib/abt/providers/devops/path.rb"
|
122
129
|
- "./lib/abt/providers/git.rb"
|
@@ -152,14 +159,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
159
|
requirements:
|
153
160
|
- - ">="
|
154
161
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
162
|
+
version: 2.5.0
|
156
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
164
|
requirements:
|
158
165
|
- - ">="
|
159
166
|
- !ruby/object:Gem::Version
|
160
167
|
version: '0'
|
161
168
|
requirements: []
|
162
|
-
rubygems_version: 3.
|
169
|
+
rubygems_version: 3.1.4
|
163
170
|
signing_key:
|
164
171
|
specification_version: 4
|
165
172
|
summary: Versatile scripts
|