abt-cli 0.0.27 → 0.0.28
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/lib/abt.rb +0 -4
- data/lib/abt/cli.rb +5 -1
- data/lib/abt/directory_config.rb +28 -10
- data/lib/abt/providers/asana/commands/finalize.rb +2 -4
- data/lib/abt/providers/asana/commands/write_config.rb +73 -0
- data/lib/abt/providers/asana/configuration.rb +1 -1
- data/lib/abt/providers/asana/path.rb +1 -1
- data/lib/abt/providers/devops/commands/write_config.rb +47 -0
- data/lib/abt/providers/devops/configuration.rb +1 -1
- data/lib/abt/providers/devops/path.rb +1 -1
- data/lib/abt/providers/devops/services/project_picker.rb +6 -12
- data/lib/abt/providers/harvest/commands/projects.rb +2 -4
- data/lib/abt/providers/harvest/commands/tasks.rb +1 -3
- data/lib/abt/providers/harvest/commands/write_config.rb +41 -0
- data/lib/abt/providers/harvest/configuration.rb +1 -1
- data/lib/abt/providers/harvest/path.rb +1 -1
- data/lib/abt/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dd7a6d58fed695f167581c8c7b16578b1e0f29664319c1b3594235e07bfc179
|
4
|
+
data.tar.gz: 48e88420bd4e7b7dd2c99ac82cfcc7ada1120637f9f7b08c39fa9abf128ebefe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8e7534007c20d2f16099e453d8d7fdaae042f4f658ef111c4a7d2ec25dee13d9e6c7ed511de57ba14e249c1043129cb540742a5746ee32c6ed51c419470e756
|
7
|
+
data.tar.gz: 28173fc0ea536fdfd3c787e18abf4ed27818f9a47d4e69bfa2c25c6f5a00ef12e586378dec0be4e21b61cb198e24ab8ba36c1289ccc0b90f0f009d88000ba5e3
|
data/lib/abt.rb
CHANGED
data/lib/abt/cli.rb
CHANGED
@@ -62,6 +62,10 @@ module Abt
|
|
62
62
|
@aris ||= ArgumentsParser.new(sanitized_piped_args + remaining_args).parse
|
63
63
|
end
|
64
64
|
|
65
|
+
def directory_config
|
66
|
+
@directory_config ||= Abt::DirectoryConfig.new
|
67
|
+
end
|
68
|
+
|
65
69
|
private
|
66
70
|
|
67
71
|
def alias?
|
@@ -69,7 +73,7 @@ module Abt
|
|
69
73
|
end
|
70
74
|
|
71
75
|
def process_alias
|
72
|
-
matching_alias =
|
76
|
+
matching_alias = directory_config.dig("aliases", command[1..-1])
|
73
77
|
|
74
78
|
abort("No such alias #{command}") if matching_alias.nil?
|
75
79
|
|
data/lib/abt/directory_config.rb
CHANGED
@@ -2,24 +2,42 @@
|
|
2
2
|
|
3
3
|
module Abt
|
4
4
|
class DirectoryConfig < Hash
|
5
|
+
FILE_NAME = ".abt.yml"
|
6
|
+
|
5
7
|
def initialize
|
6
8
|
super
|
7
|
-
|
9
|
+
load! if config_file_path && File.exist?(config_file_path)
|
8
10
|
end
|
9
11
|
|
10
|
-
|
12
|
+
def available?
|
13
|
+
!config_file_path.nil?
|
14
|
+
end
|
11
15
|
|
12
|
-
def
|
13
|
-
|
16
|
+
def load!
|
17
|
+
merge!(YAML.load_file(config_file_path))
|
18
|
+
end
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
return if next_dir == dir
|
20
|
+
def save!
|
21
|
+
raise Abt::Cli::Abort("Configuration files are not available outside of git repositories") unless available?
|
18
22
|
|
19
|
-
|
20
|
-
|
23
|
+
config_file = File.open(config_file_path, "w")
|
24
|
+
YAML.dump(to_h, config_file)
|
25
|
+
config_file.close
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
21
29
|
|
22
|
-
|
30
|
+
def config_file_path
|
31
|
+
@config_file_path ||= begin
|
32
|
+
path = nil
|
33
|
+
Open3.popen3("git rev-parse --show-toplevel") do |_i, output, _e, thread|
|
34
|
+
if thread.value.success?
|
35
|
+
repo_root = output.read.chomp
|
36
|
+
path = File.join(repo_root, FILE_NAME)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
path
|
40
|
+
end
|
23
41
|
end
|
24
42
|
end
|
25
43
|
end
|
@@ -58,10 +58,8 @@ module Abt
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def task
|
61
|
-
@task ||=
|
62
|
-
|
63
|
-
opt_fields: "name,memberships.section.name,permalink_url")
|
64
|
-
end
|
61
|
+
@task ||= api.get("tasks/#{task_gid}",
|
62
|
+
opt_fields: "name,memberships.section.name,permalink_url")
|
65
63
|
end
|
66
64
|
end
|
67
65
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Abt
|
4
|
+
module Providers
|
5
|
+
module Asana
|
6
|
+
module Commands
|
7
|
+
class WriteConfig < BaseCommand
|
8
|
+
def self.usage
|
9
|
+
"abt write-config asana[:<project-gid>]"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Write Asana settings to .abt.yml"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.flags
|
17
|
+
[
|
18
|
+
["-c", "--clean", "Don't reuse project configuration"]
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
def perform
|
23
|
+
cli.directory_config["asana"] = config_data
|
24
|
+
cli.directory_config.save!
|
25
|
+
|
26
|
+
warn("Asana configuration written to #{Abt::DirectoryConfig::FILE_NAME}")
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def config_data
|
32
|
+
{
|
33
|
+
"path" => project_gid,
|
34
|
+
"wip_section_gid" => wip_section_gid,
|
35
|
+
"finalized_section_gid" => finalized_section_gid
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def project_gid
|
40
|
+
@project_gid ||= begin
|
41
|
+
prompt_project! if super.nil? || flags[:clean]
|
42
|
+
|
43
|
+
super
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def wip_section_gid
|
48
|
+
return config.wip_section_gid if use_previous_config?
|
49
|
+
|
50
|
+
cli.prompt.choice("Select WIP (Work In Progress) section", sections)["gid"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def finalized_section_gid
|
54
|
+
return config.finalized_section_gid if use_previous_config?
|
55
|
+
|
56
|
+
cli.prompt.choice('Select section for finalized tasks (E.g. "Merged")', sections)["gid"]
|
57
|
+
end
|
58
|
+
|
59
|
+
def use_previous_config?
|
60
|
+
project_gid == config.path.project_gid
|
61
|
+
end
|
62
|
+
|
63
|
+
def sections
|
64
|
+
@sections ||= begin
|
65
|
+
warn("Fetching sections...")
|
66
|
+
api.get_paged("projects/#{project_gid}/sections", opt_fields: "name")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Abt
|
4
|
+
module Providers
|
5
|
+
module Devops
|
6
|
+
module Commands
|
7
|
+
class WriteConfig < BaseCommand
|
8
|
+
def self.usage
|
9
|
+
"abt write-config devops[:<organization-name>/<project-name>/<board-id>]"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Write DevOps settings to .abt.yml"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.flags
|
17
|
+
[
|
18
|
+
["-c", "--clean", "Don't reuse configuration"]
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
def perform
|
23
|
+
prompt_project! if project_name.nil? || flags[:clean]
|
24
|
+
prompt_board! if board_id.nil? || flags[:clean]
|
25
|
+
|
26
|
+
update_directory_config!
|
27
|
+
|
28
|
+
warn("DevOps configuration written to #{Abt::DirectoryConfig::FILE_NAME}")
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def update_directory_config!
|
34
|
+
cli.directory_config["devops"] = {
|
35
|
+
"path" => Path.from_ids(
|
36
|
+
organization_name: organization_name,
|
37
|
+
project_name: project_name,
|
38
|
+
board_id: board_id
|
39
|
+
).to_s
|
40
|
+
}
|
41
|
+
cli.directory_config.save!
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -37,15 +37,11 @@ module Abt
|
|
37
37
|
private
|
38
38
|
|
39
39
|
def project_name
|
40
|
-
@project_name ||=
|
41
|
-
project_url_match && project_url_match[:project]
|
42
|
-
end
|
40
|
+
@project_name ||= project_url_match && project_url_match[:project]
|
43
41
|
end
|
44
42
|
|
45
43
|
def organization_name
|
46
|
-
@organization_name ||=
|
47
|
-
project_url_match && project_url_match[:organization]
|
48
|
-
end
|
44
|
+
@organization_name ||= project_url_match && project_url_match[:organization]
|
49
45
|
end
|
50
46
|
|
51
47
|
def project_url_match
|
@@ -53,14 +49,12 @@ module Abt
|
|
53
49
|
end
|
54
50
|
|
55
51
|
def project_url
|
56
|
-
@project_url ||=
|
57
|
-
|
58
|
-
url = prompt_url
|
52
|
+
@project_url ||= loop do
|
53
|
+
url = prompt_url
|
59
54
|
|
60
|
-
|
55
|
+
break url if AZURE_DEV_URL_REGEX =~ url || VS_URL_REGEX =~ url
|
61
56
|
|
62
|
-
|
63
|
-
end
|
57
|
+
cli.warn("Invalid URL")
|
64
58
|
end
|
65
59
|
end
|
66
60
|
|
@@ -22,10 +22,8 @@ module Abt
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def projects
|
25
|
-
@projects ||=
|
26
|
-
|
27
|
-
project_assignment["project"].merge("client" => project_assignment["client"])
|
28
|
-
end
|
25
|
+
@projects ||= project_assignments.map do |project_assignment|
|
26
|
+
project_assignment["project"].merge("client" => project_assignment["client"])
|
29
27
|
end
|
30
28
|
end
|
31
29
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Abt
|
4
|
+
module Providers
|
5
|
+
module Harvest
|
6
|
+
module Commands
|
7
|
+
class WriteConfig < BaseCommand
|
8
|
+
def self.usage
|
9
|
+
"abt write-config harvest[:<project-id>[/<task-id>]]"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"Write Harvest settings to .abt.yml"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.flags
|
17
|
+
[
|
18
|
+
["-c", "--clean", "Don't reuse configuration"]
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
def perform
|
23
|
+
prompt_project! if project_id.nil? || flags[:clean]
|
24
|
+
prompt_task! if task_id.nil? || flags[:clean]
|
25
|
+
|
26
|
+
update_directory_config!
|
27
|
+
|
28
|
+
warn("Harvest configuration written to #{Abt::DirectoryConfig::FILE_NAME}")
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def update_directory_config!
|
34
|
+
cli.directory_config["harvest"] = { "path" => path.to_s }
|
35
|
+
cli.directory_config.save!
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -15,7 +15,7 @@ module Abt
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def path
|
18
|
-
Path.new(local_available? && git["path"] ||
|
18
|
+
Path.new(local_available? && git["path"] || cli.directory_config.dig("harvest", "path") || "")
|
19
19
|
end
|
20
20
|
|
21
21
|
def path=(new_path)
|
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.28
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-inflector
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- "./lib/abt/providers/asana/commands/share.rb"
|
111
111
|
- "./lib/abt/providers/asana/commands/start.rb"
|
112
112
|
- "./lib/abt/providers/asana/commands/tasks.rb"
|
113
|
+
- "./lib/abt/providers/asana/commands/write_config.rb"
|
113
114
|
- "./lib/abt/providers/asana/configuration.rb"
|
114
115
|
- "./lib/abt/providers/asana/path.rb"
|
115
116
|
- "./lib/abt/providers/asana/services/project_picker.rb"
|
@@ -125,6 +126,7 @@ files:
|
|
125
126
|
- "./lib/abt/providers/devops/commands/pick.rb"
|
126
127
|
- "./lib/abt/providers/devops/commands/share.rb"
|
127
128
|
- "./lib/abt/providers/devops/commands/work_items.rb"
|
129
|
+
- "./lib/abt/providers/devops/commands/write_config.rb"
|
128
130
|
- "./lib/abt/providers/devops/configuration.rb"
|
129
131
|
- "./lib/abt/providers/devops/path.rb"
|
130
132
|
- "./lib/abt/providers/devops/services/board_picker.rb"
|
@@ -144,6 +146,7 @@ files:
|
|
144
146
|
- "./lib/abt/providers/harvest/commands/stop.rb"
|
145
147
|
- "./lib/abt/providers/harvest/commands/tasks.rb"
|
146
148
|
- "./lib/abt/providers/harvest/commands/track.rb"
|
149
|
+
- "./lib/abt/providers/harvest/commands/write_config.rb"
|
147
150
|
- "./lib/abt/providers/harvest/configuration.rb"
|
148
151
|
- "./lib/abt/providers/harvest/path.rb"
|
149
152
|
- "./lib/abt/providers/harvest/services/project_picker.rb"
|