abt-cli 0.0.21 → 0.0.26
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/bin/abt +3 -3
- data/lib/abt.rb +11 -6
- data/lib/abt/ari.rb +1 -1
- data/lib/abt/ari_list.rb +1 -1
- data/lib/abt/base_command.rb +7 -7
- data/lib/abt/cli.rb +55 -49
- data/lib/abt/cli/arguments_parser.rb +5 -9
- data/lib/abt/cli/global_commands.rb +23 -0
- data/lib/abt/cli/global_commands/commands.rb +2 -2
- data/lib/abt/cli/global_commands/examples.rb +2 -2
- data/lib/abt/cli/global_commands/help.rb +2 -2
- data/lib/abt/cli/global_commands/readme.rb +2 -2
- data/lib/abt/cli/global_commands/share.rb +6 -6
- data/lib/abt/cli/global_commands/version.rb +2 -2
- data/lib/abt/cli/prompt.rb +71 -56
- data/lib/abt/directory_config.rb +25 -0
- data/lib/abt/docs.rb +39 -33
- 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 -14
- 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 +5 -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 +45 -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 +37 -19
- data/lib/abt/providers/devops/commands/share.rb +5 -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 +5 -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 +7 -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"] || Abt.directory_config.dig("harvest", "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.26
|
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-03-
|
11
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|
@@ -80,6 +80,7 @@ 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"
|
83
84
|
- "./lib/abt/cli/global_commands/commands.rb"
|
84
85
|
- "./lib/abt/cli/global_commands/examples.rb"
|
85
86
|
- "./lib/abt/cli/global_commands/help.rb"
|
@@ -87,6 +88,7 @@ files:
|
|
87
88
|
- "./lib/abt/cli/global_commands/share.rb"
|
88
89
|
- "./lib/abt/cli/global_commands/version.rb"
|
89
90
|
- "./lib/abt/cli/prompt.rb"
|
91
|
+
- "./lib/abt/directory_config.rb"
|
90
92
|
- "./lib/abt/docs.rb"
|
91
93
|
- "./lib/abt/docs/cli.rb"
|
92
94
|
- "./lib/abt/docs/markdown.rb"
|
@@ -122,7 +124,7 @@ files:
|
|
122
124
|
- "./lib/abt/providers/devops/commands/init.rb"
|
123
125
|
- "./lib/abt/providers/devops/commands/pick.rb"
|
124
126
|
- "./lib/abt/providers/devops/commands/share.rb"
|
125
|
-
- "./lib/abt/providers/devops/commands/
|
127
|
+
- "./lib/abt/providers/devops/commands/work_items.rb"
|
126
128
|
- "./lib/abt/providers/devops/configuration.rb"
|
127
129
|
- "./lib/abt/providers/devops/path.rb"
|
128
130
|
- "./lib/abt/providers/git.rb"
|
@@ -158,14 +160,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
160
|
requirements:
|
159
161
|
- - ">="
|
160
162
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
163
|
+
version: 2.5.0
|
162
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
165
|
requirements:
|
164
166
|
- - ">="
|
165
167
|
- !ruby/object:Gem::Version
|
166
168
|
version: '0'
|
167
169
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
170
|
+
rubygems_version: 3.1.4
|
169
171
|
signing_key:
|
170
172
|
specification_version: 4
|
171
173
|
summary: Versatile scripts
|