trello_flow 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trello_flow/api/base.rb +1 -0
- data/lib/trello_flow/api/board.rb +1 -0
- data/lib/trello_flow/api/card.rb +4 -0
- data/lib/trello_flow/api/label.rb +15 -0
- data/lib/trello_flow/main.rb +4 -1
- data/lib/trello_flow/table.rb +4 -5
- data/lib/trello_flow/table/row.rb +16 -7
- data/lib/trello_flow/version.rb +1 -1
- data/trello_flow.gemspec +2 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb65b09bb2642a2a35b11c83521afd71d52a5755
|
4
|
+
data.tar.gz: afc1e9fc26bb8b1fa171fcf16f48394fe952e5e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35c000110daaceb8c86cdcff809b7a8ca803a39aa17e113a136d5381269bd4ef7f3e8a85a7ecfc72f26742eb31113af115f1ad7691f2f3329329e3aa42964b13
|
7
|
+
data.tar.gz: e21de46cfc3d833186d03fd0c9c1a4cef7eba5336bf6f14e36373aa0f5058375531a07af9a3cccbd7b677c2c2553b144c1646ff568cc6f6674b2f9b1c18cb458
|
data/lib/trello_flow/api/base.rb
CHANGED
data/lib/trello_flow/api/card.rb
CHANGED
@@ -25,6 +25,10 @@ module TrelloFlow
|
|
25
25
|
self.class.with("cards/:id/members").where(id: id, value: user.id).post
|
26
26
|
end
|
27
27
|
|
28
|
+
def add_label(label)
|
29
|
+
self.class.with("cards/:id/idLabels").where(id: id, value: label.id).post
|
30
|
+
end
|
31
|
+
|
28
32
|
def url
|
29
33
|
attributes[:shortUrl]
|
30
34
|
end
|
data/lib/trello_flow/main.rb
CHANGED
@@ -49,7 +49,10 @@ module TrelloFlow
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def create_new_card(name)
|
52
|
-
board.lists.backlog.cards.create name: name
|
52
|
+
card = board.lists.backlog.cards.create name: name
|
53
|
+
label = Table.pick board.labels, caption: "Add label:"
|
54
|
+
card.add_label(label)
|
55
|
+
card
|
53
56
|
end
|
54
57
|
|
55
58
|
def pick_existing_card
|
data/lib/trello_flow/table.rb
CHANGED
@@ -2,19 +2,18 @@ require "trello_flow/table/row"
|
|
2
2
|
|
3
3
|
module TrelloFlow
|
4
4
|
class Table
|
5
|
-
def self.pick(records,
|
6
|
-
new(records).pick(
|
5
|
+
def self.pick(records, caption: "Pick one:")
|
6
|
+
new(records).pick(caption)
|
7
7
|
end
|
8
8
|
|
9
9
|
def initialize(records)
|
10
10
|
@records = records.to_a.sort_by(&:position)
|
11
11
|
end
|
12
12
|
|
13
|
-
def pick(
|
13
|
+
def pick(caption)
|
14
14
|
return if records.none?
|
15
|
-
Cli.title title if title
|
16
15
|
render_table
|
17
|
-
index = Cli.ask(
|
16
|
+
index = Cli.ask(caption, Integer)
|
18
17
|
records[index - 1]
|
19
18
|
end
|
20
19
|
|
@@ -3,33 +3,42 @@ module TrelloFlow
|
|
3
3
|
class Row
|
4
4
|
attr_reader :num
|
5
5
|
|
6
|
+
COLOR_TRANSLATIONS = {
|
7
|
+
"purple" => "magenta",
|
8
|
+
"orange" => "yellow",
|
9
|
+
"sky" => "cyan",
|
10
|
+
"pink" => "red",
|
11
|
+
"lime" => "green"
|
12
|
+
}
|
13
|
+
|
6
14
|
def initialize(record, index)
|
7
15
|
@record = record
|
8
16
|
@num = index + 1
|
9
17
|
end
|
10
18
|
|
11
19
|
def to_h
|
12
|
-
result = { "#":
|
20
|
+
result = { "#": num }
|
13
21
|
fields.each do |field|
|
14
|
-
result[field] = colorize
|
22
|
+
result[field] = colorize record.send(field)
|
15
23
|
end
|
16
24
|
result
|
17
25
|
end
|
18
26
|
|
19
27
|
private
|
20
28
|
|
29
|
+
attr_reader :num, :record
|
30
|
+
|
21
31
|
def colorize(str)
|
22
|
-
return str unless
|
23
|
-
|
32
|
+
return str unless record.respond_to?(:color)
|
33
|
+
"■".send(color) + " #{str}"
|
24
34
|
end
|
25
35
|
|
26
36
|
def color
|
27
|
-
|
28
|
-
custom_color || :white
|
37
|
+
COLOR_TRANSLATIONS[record.color] || record.color || :white
|
29
38
|
end
|
30
39
|
|
31
40
|
def fields
|
32
|
-
@
|
41
|
+
@_fields ||= record.class.fields
|
33
42
|
end
|
34
43
|
end
|
35
44
|
end
|
data/lib/trello_flow/version.rb
CHANGED
data/trello_flow.gemspec
CHANGED
@@ -23,9 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "minitest", "~> 5.0"
|
25
25
|
spec.add_development_dependency 'minitest-line'
|
26
|
+
spec.add_development_dependency 'minitest-reporters'
|
26
27
|
spec.add_development_dependency 'multi_json'
|
27
28
|
spec.add_development_dependency "pry"
|
28
29
|
spec.add_development_dependency 'webmock'
|
30
|
+
|
29
31
|
spec.add_dependency "colored"
|
30
32
|
spec.add_dependency "highline"
|
31
33
|
spec.add_dependency "hirb"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trello_flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Balvig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest-reporters
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: multi_json
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,6 +247,7 @@ files:
|
|
233
247
|
- lib/trello_flow/api/board.rb
|
234
248
|
- lib/trello_flow/api/card.rb
|
235
249
|
- lib/trello_flow/api/json_parser.rb
|
250
|
+
- lib/trello_flow/api/label.rb
|
236
251
|
- lib/trello_flow/api/list.rb
|
237
252
|
- lib/trello_flow/api/member.rb
|
238
253
|
- lib/trello_flow/branch.rb
|