abt-cli 0.0.20 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/bin/abt +3 -3
  3. data/lib/abt.rb +6 -6
  4. data/lib/abt/ari.rb +2 -2
  5. data/lib/abt/ari_list.rb +1 -1
  6. data/lib/abt/base_command.rb +7 -7
  7. data/lib/abt/cli.rb +49 -47
  8. data/lib/abt/cli/arguments_parser.rb +6 -3
  9. data/lib/abt/cli/global_commands.rb +23 -0
  10. data/lib/abt/cli/global_commands/commands.rb +23 -0
  11. data/lib/abt/cli/global_commands/examples.rb +23 -0
  12. data/lib/abt/cli/global_commands/help.rb +23 -0
  13. data/lib/abt/cli/global_commands/readme.rb +23 -0
  14. data/lib/abt/cli/global_commands/share.rb +36 -0
  15. data/lib/abt/cli/global_commands/version.rb +23 -0
  16. data/lib/abt/cli/prompt.rb +71 -56
  17. data/lib/abt/docs.rb +48 -26
  18. data/lib/abt/docs/cli.rb +3 -3
  19. data/lib/abt/docs/markdown.rb +10 -7
  20. data/lib/abt/git_config.rb +4 -6
  21. data/lib/abt/helpers.rb +26 -8
  22. data/lib/abt/providers/asana/api.rb +9 -9
  23. data/lib/abt/providers/asana/base_command.rb +12 -10
  24. data/lib/abt/providers/asana/commands/add.rb +13 -12
  25. data/lib/abt/providers/asana/commands/branch_name.rb +8 -8
  26. data/lib/abt/providers/asana/commands/clear.rb +7 -8
  27. data/lib/abt/providers/asana/commands/current.rb +14 -15
  28. data/lib/abt/providers/asana/commands/finalize.rb +17 -14
  29. data/lib/abt/providers/asana/commands/harvest_time_entry_data.rb +18 -16
  30. data/lib/abt/providers/asana/commands/init.rb +8 -41
  31. data/lib/abt/providers/asana/commands/pick.rb +22 -26
  32. data/lib/abt/providers/asana/commands/projects.rb +5 -5
  33. data/lib/abt/providers/asana/commands/share.rb +7 -5
  34. data/lib/abt/providers/asana/commands/start.rb +28 -21
  35. data/lib/abt/providers/asana/commands/tasks.rb +6 -6
  36. data/lib/abt/providers/asana/configuration.rb +37 -29
  37. data/lib/abt/providers/asana/path.rb +6 -6
  38. data/lib/abt/providers/devops/api.rb +12 -12
  39. data/lib/abt/providers/devops/base_command.rb +14 -10
  40. data/lib/abt/providers/devops/commands/boards.rb +5 -7
  41. data/lib/abt/providers/devops/commands/branch_name.rb +9 -9
  42. data/lib/abt/providers/devops/commands/clear.rb +7 -8
  43. data/lib/abt/providers/devops/commands/current.rb +17 -18
  44. data/lib/abt/providers/devops/commands/harvest_time_entry_data.rb +21 -19
  45. data/lib/abt/providers/devops/commands/init.rb +21 -14
  46. data/lib/abt/providers/devops/commands/pick.rb +37 -19
  47. data/lib/abt/providers/devops/commands/share.rb +7 -5
  48. data/lib/abt/providers/devops/commands/{work-items.rb → work_items.rb} +3 -3
  49. data/lib/abt/providers/devops/configuration.rb +15 -15
  50. data/lib/abt/providers/devops/path.rb +7 -6
  51. data/lib/abt/providers/git/commands/branch.rb +23 -21
  52. data/lib/abt/providers/harvest/api.rb +8 -8
  53. data/lib/abt/providers/harvest/base_command.rb +10 -8
  54. data/lib/abt/providers/harvest/commands/clear.rb +7 -8
  55. data/lib/abt/providers/harvest/commands/current.rb +13 -14
  56. data/lib/abt/providers/harvest/commands/init.rb +10 -39
  57. data/lib/abt/providers/harvest/commands/pick.rb +15 -11
  58. data/lib/abt/providers/harvest/commands/projects.rb +5 -5
  59. data/lib/abt/providers/harvest/commands/share.rb +7 -5
  60. data/lib/abt/providers/harvest/commands/start.rb +5 -3
  61. data/lib/abt/providers/harvest/commands/stop.rb +12 -12
  62. data/lib/abt/providers/harvest/commands/tasks.rb +7 -7
  63. data/lib/abt/providers/harvest/commands/track.rb +52 -37
  64. data/lib/abt/providers/harvest/configuration.rb +18 -18
  65. data/lib/abt/providers/harvest/path.rb +6 -6
  66. data/lib/abt/version.rb +1 -1
  67. metadata +12 -5
@@ -15,11 +15,11 @@ 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"] || "")
19
19
  end
20
20
 
21
21
  def path=(new_path)
22
- git['path'] = new_path
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['accessToken'] unless git_global['accessToken'].nil?
34
+ return git_global["accessToken"] unless git_global["accessToken"].nil?
35
35
 
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'
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['accountId'] unless git_global['accountId'].nil?
45
+ return git_global["accountId"] unless git_global["accountId"].nil?
46
46
 
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'
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['userId'] unless git_global['userId'].nil?
56
+ return git_global["userId"] unless git_global["userId"].nil?
57
57
 
58
- git_global['userId'] = api.get('users/me')['id'].to_s
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('local', 'abt.harvest')
64
+ @git ||= GitConfig.new("local", "abt.harvest")
65
65
  end
66
66
 
67
67
  def git_global
68
- @git_global ||= GitConfig.new('global', 'abt.harvest')
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+)?(/(?<task_id>\d+))?$}.freeze
7
+ PATH_REGEX = %r{^(?<project_id>\d+)?/?(?<task_id>\d+)?$}.freeze
8
8
 
9
- def self.from_ids(project_id = nil, task_id = nil)
10
- path = project_id ? [project_id, *task_id].join('/') : ''
11
- new path
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 =~ PATH_REGEX
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Abt
4
- VERSION = '0.0.20'
4
+ VERSION = "0.0.25"
5
5
  end
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.20
4
+ version: 0.0.25
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-03 00:00:00.000000000 Z
11
+ date: 2021-03-18 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/work-items.rb"
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: '0'
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.0.3
169
+ rubygems_version: 3.1.4
163
170
  signing_key:
164
171
  specification_version: 4
165
172
  summary: Versatile scripts