3llo 1.0.0.pre.rc.0 → 1.0.0
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/.github/workflows/ci.yml +4 -0
- data/.rubocop.yml +113 -0
- data/3llo.gemspec +9 -9
- data/CHANGELOG.md +2 -0
- data/Gemfile +3 -3
- data/Rakefile +2 -2
- data/bin/3llo +4 -4
- data/lib/3llo.rb +14 -14
- data/lib/3llo/api.rb +6 -6
- data/lib/3llo/api/board.rb +13 -29
- data/lib/3llo/api/card.rb +79 -102
- data/lib/3llo/api/checklist.rb +26 -48
- data/lib/3llo/api/list.rb +12 -23
- data/lib/3llo/api/token.rb +2 -2
- data/lib/3llo/api/user.rb +8 -32
- data/lib/3llo/application.rb +32 -22
- data/lib/3llo/command.rb +43 -14
- data/lib/3llo/command/board.rb +6 -6
- data/lib/3llo/command/card.rb +55 -53
- data/lib/3llo/command/card/assign.rb +3 -3
- data/lib/3llo/command/card/edit.rb +33 -0
- data/lib/3llo/command/card/move.rb +3 -3
- data/lib/3llo/command/card/self_assign.rb +2 -2
- data/lib/3llo/command/list.rb +9 -9
- data/lib/3llo/controller.rb +10 -11
- data/lib/3llo/entities.rb +1 -1
- data/lib/3llo/interface.rb +3 -2
- data/lib/3llo/registry.rb +3 -4
- data/lib/3llo/remote_server.rb +97 -0
- data/lib/3llo/utils.rb +10 -0
- data/lib/3llo/version.rb +1 -1
- data/lib/3llo/view.rb +11 -11
- data/lib/3llo/view/board/list.rb +2 -2
- data/lib/3llo/view/card/help.rb +1 -1
- metadata +21 -6
- data/lib/3llo/http/client.rb +0 -95
- data/lib/3llo/http/request_error.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e6ca4c800b73fb0a5514e1a87204547c243045b9e3a0b5842f327513b726073
|
4
|
+
data.tar.gz: c6bc2f0e09bd27a558c8914d34734863efce9d6b534d2bae38d5d1267d378eb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 035ff3a48dcfe77e558d5eec4e341dcfc78caf0b6d55fa60c91f8a9d56b32a8d8221634e78ec3f34e26fc13c9d10df130017483fd3b9bcfb5aa0c64ce3d19e0f
|
7
|
+
data.tar.gz: 152e793d22f7db0ab50d9504c3d2c2d36051dcfa74293931d368a5e58ec9b176fa34f77215498566947fc6851a33bc9eadc3f891fbe43fa0221be13407d1c9b7
|
data/.github/workflows/ci.yml
CHANGED
@@ -25,5 +25,9 @@ jobs:
|
|
25
25
|
run: |
|
26
26
|
gem install bundler
|
27
27
|
bundle install --jobs 4 --retry 3
|
28
|
+
- name: Start httpbin container
|
29
|
+
run: docker run -d -p 8080:80 kennethreitz/httpbin
|
30
|
+
- name: Run Rubocop
|
31
|
+
run: bundle exec rubocop
|
28
32
|
- name: Run test
|
29
33
|
run: bundle exec rspec
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# The behavior of RuboCop can be controlled via the .rubocop.yml
|
2
|
+
# configuration file. It makes it possible to enable/disable
|
3
|
+
# certain cops (checks) and to alter their behavior if they accept
|
4
|
+
# any parameters. The file can be placed either in your home
|
5
|
+
# directory or in some project directory.
|
6
|
+
#
|
7
|
+
# RuboCop will start looking for the configuration file in the directory
|
8
|
+
# where the inspected file is and continue its way up to the root directory.
|
9
|
+
#
|
10
|
+
# See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
|
11
|
+
|
12
|
+
AllCops:
|
13
|
+
TargetRubyVersion: 2.5
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 120
|
17
|
+
|
18
|
+
Layout/DotPosition:
|
19
|
+
EnforcedStyle: leading
|
20
|
+
|
21
|
+
Layout/EmptyLinesAroundBlockBody:
|
22
|
+
EnforcedStyle: no_empty_lines
|
23
|
+
|
24
|
+
Layout/FirstArrayElementIndentation:
|
25
|
+
EnforcedStyle: consistent
|
26
|
+
|
27
|
+
Layout/FirstHashElementIndentation:
|
28
|
+
EnforcedStyle: consistent
|
29
|
+
|
30
|
+
Layout/HeredocIndentation:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Layout/MultilineMethodCallIndentation:
|
34
|
+
EnforcedStyle: indented
|
35
|
+
|
36
|
+
Layout/SpaceInsideBlockBraces:
|
37
|
+
EnforcedStyle: space
|
38
|
+
|
39
|
+
Layout/SpaceInsideHashLiteralBraces:
|
40
|
+
EnforcedStyle: no_space
|
41
|
+
|
42
|
+
Layout/SpaceInsideParens:
|
43
|
+
EnforcedStyle: no_space
|
44
|
+
|
45
|
+
Lint/AssignmentInCondition:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Metrics:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Naming/RescuedExceptionsVariableName:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Security/JSONLoad:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/Alias:
|
58
|
+
EnforcedStyle: prefer_alias
|
59
|
+
|
60
|
+
Style/BracesAroundHashParameters:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/DefWithParentheses:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/Documentation:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Style/FrozenStringLiteralComment:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Style/GlobalVars:
|
73
|
+
AllowedVariables: ['$application']
|
74
|
+
|
75
|
+
Style/GuardClause:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
Style/HashSyntax:
|
79
|
+
EnforcedStyle: ruby19
|
80
|
+
|
81
|
+
Style/MethodCallWithoutArgsParentheses:
|
82
|
+
Enabled: false
|
83
|
+
|
84
|
+
Style/ModuleFunction:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
Style/MultilineBlockChain:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
Style/PreferredHashMethods:
|
91
|
+
EnforcedStyle: verbose
|
92
|
+
|
93
|
+
Style/TrailingCommaInArguments:
|
94
|
+
EnforcedStyleForMultiline: no_comma
|
95
|
+
|
96
|
+
Style/TrailingCommaInHashLiteral:
|
97
|
+
EnforcedStyleForMultiline: no_comma
|
98
|
+
|
99
|
+
Style/WordArray:
|
100
|
+
EnforcedStyle: percent
|
101
|
+
MinSize: 3
|
102
|
+
|
103
|
+
Style/SpecialGlobalVars:
|
104
|
+
EnforcedStyle: use_english_names
|
105
|
+
|
106
|
+
Style/StringLiterals:
|
107
|
+
EnforcedStyle: double_quotes
|
108
|
+
|
109
|
+
Style/StringLiteralsInInterpolation:
|
110
|
+
EnforcedStyle: double_quotes
|
111
|
+
|
112
|
+
Style/RaiseArgs:
|
113
|
+
EnforcedStyle: compact
|
data/3llo.gemspec
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require "3llo/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "3llo"
|
@@ -9,13 +8,13 @@ Gem::Specification.new do |spec|
|
|
9
8
|
spec.authors = ["Cẩm Huỳnh"]
|
10
9
|
spec.email = ["huynhquancam@gmail.com"]
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
11
|
+
spec.summary = "Trello CLI app"
|
12
|
+
spec.description = "Interactive CLI application for Trello"
|
14
13
|
spec.homepage = "https://github.com/qcam/3llo"
|
15
14
|
spec.license = "MIT"
|
16
15
|
|
17
16
|
if spec.respond_to?(:metadata)
|
18
|
-
spec.metadata[
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
19
18
|
else
|
20
19
|
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
21
20
|
end
|
@@ -25,9 +24,10 @@ Gem::Specification.new do |spec|
|
|
25
24
|
spec.executables = spec.files.grep(%r{^bin/}) { |filename| File.basename(filename) }
|
26
25
|
spec.require_paths = ["lib"]
|
27
26
|
|
28
|
-
spec.required_ruby_version =
|
27
|
+
spec.required_ruby_version = "~> 2.5"
|
29
28
|
|
30
|
-
spec.add_runtime_dependency
|
29
|
+
spec.add_runtime_dependency "tty-prompt", "~> 0.20"
|
31
30
|
|
32
|
-
spec.add_development_dependency
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
spec.add_development_dependency "rubocop", "~> 0.79"
|
33
33
|
end
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/bin/3llo
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
4
4
|
require "3llo"
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
5
|
+
require "container"
|
6
|
+
require "tty-prompt"
|
7
|
+
require "optparse"
|
8
8
|
|
9
9
|
Tr3llo::Application.start(ARGV)
|
data/lib/3llo.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
require "3llo/version"
|
2
|
-
require "3llo/
|
2
|
+
require "3llo/remote_server"
|
3
3
|
require "3llo/interface"
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
4
|
+
require "container"
|
5
|
+
require "json"
|
6
|
+
require "erb"
|
7
7
|
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
8
|
+
require "3llo/application"
|
9
|
+
require "3llo/configuration"
|
10
|
+
require "3llo/utils"
|
11
|
+
require "3llo/controller"
|
12
|
+
require "3llo/errors"
|
13
|
+
require "3llo/api"
|
14
|
+
require "3llo/view"
|
15
|
+
require "3llo/command"
|
16
|
+
require "3llo/registry"
|
17
|
+
require "3llo/entities"
|
data/lib/3llo/api.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
1
|
+
require "3llo/api/board"
|
2
|
+
require "3llo/api/card"
|
3
|
+
require "3llo/api/list"
|
4
|
+
require "3llo/api/user"
|
5
|
+
require "3llo/api/checklist"
|
6
|
+
require "3llo/api/token"
|
data/lib/3llo/api/board.rb
CHANGED
@@ -4,45 +4,29 @@ module Tr3llo
|
|
4
4
|
extend self
|
5
5
|
|
6
6
|
def find_all_by_user(user_id)
|
7
|
-
|
8
|
-
|
7
|
+
client = Application.fetch_client!()
|
8
|
+
req_path =
|
9
|
+
Utils.build_req_path(
|
9
10
|
"/members/#{user_id}/boards",
|
10
|
-
|
11
|
-
token: api_token,
|
12
|
-
filter: "open"
|
11
|
+
{"filter" => "open"}
|
13
12
|
)
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
|
14
|
+
client
|
15
|
+
.get(req_path, {})
|
16
|
+
.map do |board_payload|
|
17
|
+
make_struct(board_payload)
|
18
|
+
end
|
17
19
|
end
|
18
20
|
|
19
21
|
def find(board_id)
|
20
|
-
|
21
|
-
|
22
|
-
client.get(
|
23
|
-
"/boards/#{board_id}",
|
24
|
-
key: api_key,
|
25
|
-
token: api_token,
|
26
|
-
)
|
27
|
-
)
|
22
|
+
client = Application.fetch_client!()
|
23
|
+
req_path = Utils.build_req_path("/boards/#{board_id}")
|
28
24
|
|
29
|
-
make_struct(
|
25
|
+
make_struct(client.get(req_path, {}))
|
30
26
|
end
|
31
27
|
|
32
28
|
private
|
33
29
|
|
34
|
-
def client
|
35
|
-
Application.fetch_client!()
|
36
|
-
end
|
37
|
-
|
38
|
-
def api_key
|
39
|
-
Application.fetch_configuration!().api_key
|
40
|
-
end
|
41
|
-
|
42
|
-
def api_token
|
43
|
-
Application.fetch_configuration!().api_token
|
44
|
-
end
|
45
|
-
|
46
30
|
def make_struct(payload)
|
47
31
|
id, name = payload.fetch_values("id", "name")
|
48
32
|
shortcut = Entities.make_shortcut(:board, id)
|
data/lib/3llo/api/card.rb
CHANGED
@@ -4,131 +4,116 @@ module Tr3llo
|
|
4
4
|
extend self
|
5
5
|
|
6
6
|
def find_all_by_list(list_id)
|
7
|
-
|
8
|
-
|
7
|
+
req_path =
|
8
|
+
Utils.build_req_path(
|
9
9
|
"/lists/#{list_id}/cards",
|
10
|
-
|
11
|
-
token: api_token,
|
12
|
-
members: 'true',
|
13
|
-
member_fields: "id,username"
|
10
|
+
{"members" => "true", "member_fields" => "id,username"}
|
14
11
|
)
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
|
13
|
+
client
|
14
|
+
.get(req_path, {})
|
15
|
+
.map do |card_payload|
|
16
|
+
make_struct(card_payload)
|
17
|
+
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def find_all_by_user(board_id, user_id)
|
21
|
-
|
22
|
-
|
21
|
+
req_path =
|
22
|
+
Utils.build_req_path(
|
23
23
|
"/boards/#{board_id}/members/#{user_id}/cards",
|
24
|
-
list
|
25
|
-
key: api_key,
|
26
|
-
token: api_token
|
24
|
+
{"list" => "true"}
|
27
25
|
)
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
|
27
|
+
client
|
28
|
+
.get(req_path, {})
|
29
|
+
.map do |card_payload|
|
30
|
+
make_struct(card_payload)
|
31
|
+
end
|
31
32
|
end
|
32
33
|
|
33
34
|
def create(name, description, list_id)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
)
|
35
|
+
req_path = Utils.build_req_path("/cards", {})
|
36
|
+
payload = {
|
37
|
+
"name" => name,
|
38
|
+
"desc" => description,
|
39
|
+
"idList" => list_id
|
40
|
+
}
|
41
|
+
|
42
|
+
client.post(req_path, {}, payload)
|
43
|
+
end
|
44
|
+
|
45
|
+
def update(card_id, data)
|
46
|
+
req_path = Utils.build_req_path("/cards/#{card_id}")
|
47
|
+
|
48
|
+
client.put(req_path, {}, data)
|
42
49
|
end
|
43
50
|
|
44
51
|
def find(card_id)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
list: true,
|
50
|
-
members: true,
|
51
|
-
key: api_key,
|
52
|
-
token: api_token
|
53
|
-
)
|
52
|
+
req_path =
|
53
|
+
Utils.build_req_path(
|
54
|
+
"/cards/#{card_id}",
|
55
|
+
{"list" => "true", "members" => "true"}
|
54
56
|
)
|
55
57
|
|
58
|
+
card_payload = client.get(req_path, {})
|
59
|
+
|
56
60
|
make_struct(card_payload)
|
57
61
|
end
|
58
62
|
|
63
|
+
# TODO: Use ".update".
|
59
64
|
def move_to_list(card_id, list_id)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
url,
|
64
|
-
key: api_key,
|
65
|
-
token: api_token,
|
66
|
-
value: list_id
|
67
|
-
)
|
68
|
-
)
|
65
|
+
req_path = Utils.build_req_path("/cards/#{card_id}/idList")
|
66
|
+
|
67
|
+
client.put(req_path, {}, {"value" => list_id})
|
69
68
|
end
|
70
69
|
|
70
|
+
# TODO: Use ".update".
|
71
71
|
def assign_members(card_id, members)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
url,
|
76
|
-
key: api_key,
|
77
|
-
token: api_token,
|
78
|
-
value: members.join(',')
|
79
|
-
)
|
80
|
-
)
|
72
|
+
req_path = Utils.build_req_path("/cards/#{card_id}/idMembers")
|
73
|
+
|
74
|
+
client.put(req_path, {}, {"value" => members.join(",")})
|
81
75
|
end
|
82
76
|
|
83
77
|
def list_comments(card_id)
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
url,
|
89
|
-
key: api_key,
|
90
|
-
token: api_token,
|
91
|
-
filter: "commentCard",
|
78
|
+
req_path =
|
79
|
+
Utils.build_req_path(
|
80
|
+
"/cards/#{card_id}/actions",
|
81
|
+
{"filter" => "commentCard"}
|
92
82
|
)
|
93
|
-
).map do |comment_payload|
|
94
|
-
id, creator_payload, date = comment_payload.fetch_values("id", "memberCreator", "date")
|
95
|
-
text = comment_payload.dig("data", "text")
|
96
83
|
|
97
|
-
|
84
|
+
client
|
85
|
+
.get(req_path, {})
|
86
|
+
.map do |comment_payload|
|
87
|
+
id, creator_payload, date = comment_payload.fetch_values("id", "memberCreator", "date")
|
88
|
+
text = comment_payload.dig("data", "text")
|
98
89
|
|
99
|
-
|
100
|
-
creator = Entities::User.new(creator_id, _creator_shortcut = nil, creator_username)
|
90
|
+
created_at = DateTime.iso8601(date)
|
101
91
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
92
|
+
creator_id, creator_username = creator_payload.fetch_values("id", "username")
|
93
|
+
creator = Entities::User.new(creator_id, _creator_shortcut = nil, creator_username)
|
94
|
+
|
95
|
+
Entities::Comment.new(
|
96
|
+
id: id,
|
97
|
+
creator: creator,
|
98
|
+
created_at: created_at,
|
99
|
+
text: text
|
100
|
+
)
|
101
|
+
end
|
109
102
|
end
|
110
103
|
|
111
104
|
def comment(card_id, text)
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
key: api_key,
|
117
|
-
token: api_token,
|
118
|
-
text: text
|
119
|
-
)
|
120
|
-
)
|
105
|
+
req_path = Utils.build_req_path("/cards/#{card_id}/actions/comments")
|
106
|
+
payload = {"text" => text}
|
107
|
+
|
108
|
+
client.post(req_path, {}, payload)
|
121
109
|
end
|
122
110
|
|
111
|
+
# TODO: Use ".update".
|
123
112
|
def archive(card_id)
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
key: api_key,
|
129
|
-
token: api_token
|
130
|
-
)
|
131
|
-
)
|
113
|
+
req_path = Utils.build_req_path("/cards/#{card_id}")
|
114
|
+
payload = {"closed" => "true"}
|
115
|
+
|
116
|
+
client.put(req_path, {}, payload)
|
132
117
|
end
|
133
118
|
|
134
119
|
private
|
@@ -139,8 +124,8 @@ module Tr3llo
|
|
139
124
|
|
140
125
|
members =
|
141
126
|
payload
|
142
|
-
|
143
|
-
|
127
|
+
.fetch("members", [])
|
128
|
+
.map do |member_payload|
|
144
129
|
user_id, username = member_payload.fetch_values("id", "username")
|
145
130
|
|
146
131
|
Entities::User.new(user_id, _user_shortcut = nil, username)
|
@@ -148,8 +133,8 @@ module Tr3llo
|
|
148
133
|
|
149
134
|
labels =
|
150
135
|
payload
|
151
|
-
|
152
|
-
|
136
|
+
.fetch("labels", [])
|
137
|
+
.map do |label_payload|
|
153
138
|
label_name = label_payload.fetch("name")
|
154
139
|
label_color = label_payload["color"]
|
155
140
|
|
@@ -175,14 +160,6 @@ module Tr3llo
|
|
175
160
|
card
|
176
161
|
end
|
177
162
|
|
178
|
-
def api_key
|
179
|
-
Application.fetch_configuration!().api_key
|
180
|
-
end
|
181
|
-
|
182
|
-
def api_token
|
183
|
-
Application.fetch_configuration!().api_token
|
184
|
-
end
|
185
|
-
|
186
163
|
def client
|
187
164
|
Application.fetch_client!()
|
188
165
|
end
|