trello_flow 1.0.1 → 1.1.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 +2 -0
- data/lib/trello_flow/api/board.rb +12 -0
- data/lib/trello_flow/api/card.rb +1 -1
- data/lib/trello_flow/api/checklist.rb +10 -9
- data/lib/trello_flow/api/list.rb +11 -0
- data/lib/trello_flow/api/member.rb +2 -0
- data/lib/trello_flow/main.rb +22 -24
- data/lib/trello_flow/table.rb +4 -0
- data/lib/trello_flow/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9b61ff2672d0fa326c6dc1cbe6bd3c7c9b4038a
|
4
|
+
data.tar.gz: 17387dd7a408af04b868f598a37982707b27d8ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e25a710855067d8b89321fb580e93b88190d81dec096ca6f719f683ce0c736e938159adefc96333e3bff6811844eace52b19681aec43073bc50d3b495dc28f2d
|
7
|
+
data.tar.gz: d1ddf470c49c36ff2905706478daf619c9d1a5928732ce25b07b40f5f5fa951b1c38cfa8a3d374fbc9c00b8028cdc8c136dab8d95b8d7179cab481ce0e690113
|
data/lib/trello_flow/api/base.rb
CHANGED
@@ -4,8 +4,10 @@ require "trello_flow/api/json_parser"
|
|
4
4
|
module TrelloFlow
|
5
5
|
module Api
|
6
6
|
class Base < Spyke::Base
|
7
|
+
require "trello_flow/api/board"
|
7
8
|
require "trello_flow/api/card"
|
8
9
|
require "trello_flow/api/checklist"
|
10
|
+
require "trello_flow/api/list"
|
9
11
|
require "trello_flow/api/member"
|
10
12
|
require "trello_flow/api/item"
|
11
13
|
|
data/lib/trello_flow/api/card.rb
CHANGED
@@ -10,12 +10,11 @@ module TrelloFlow
|
|
10
10
|
[:name]
|
11
11
|
end
|
12
12
|
|
13
|
-
def select_or_create_item
|
14
|
-
if items.none?
|
15
|
-
|
16
|
-
add_item(item_name)
|
13
|
+
def select_or_create_item(item_name = nil)
|
14
|
+
if item_name.present? || items.none?
|
15
|
+
add_item (Cli.ask("Input to-do [#{card.name}]:").presence || card.name)
|
17
16
|
else
|
18
|
-
Table.
|
17
|
+
Table.pick(items, title: "#{card.name} (#{name})")
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
@@ -29,10 +28,12 @@ module TrelloFlow
|
|
29
28
|
attributes[:idCard]
|
30
29
|
end
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
private
|
32
|
+
|
33
|
+
def add_item(name)
|
34
|
+
Item.with("checklists/:checklist_id/checkItems").where(checklist_id: id).create(name: name)
|
35
|
+
# items.create(name: name)
|
36
|
+
end
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
data/lib/trello_flow/main.rb
CHANGED
@@ -4,14 +4,18 @@ module TrelloFlow
|
|
4
4
|
@config = config
|
5
5
|
end
|
6
6
|
|
7
|
-
def start(
|
8
|
-
if
|
9
|
-
|
10
|
-
|
11
|
-
start_new_item(input)
|
7
|
+
def start(name)
|
8
|
+
if name.to_s.start_with?("http")
|
9
|
+
card = Api::Card.find_by_url(name)
|
10
|
+
name = nil
|
12
11
|
else
|
13
|
-
|
12
|
+
card = find_or_create_card(name)
|
14
13
|
end
|
14
|
+
|
15
|
+
checklist = card.find_or_create_checklist
|
16
|
+
item = checklist.select_or_create_item(name)
|
17
|
+
item.assign(username)
|
18
|
+
Branch.from_item(item).checkout
|
15
19
|
end
|
16
20
|
|
17
21
|
def open
|
@@ -31,28 +35,22 @@ module TrelloFlow
|
|
31
35
|
|
32
36
|
private
|
33
37
|
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
def find_or_create_card(name)
|
39
|
+
if Cli.ask("(n)ew or (e)xisting card?") == "n"
|
40
|
+
create_new_card(name)
|
41
|
+
else
|
42
|
+
pick_existing_card
|
43
|
+
end
|
40
44
|
end
|
41
45
|
|
42
|
-
def
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
item.assign(username)
|
47
|
-
Branch.from_item(item).checkout
|
46
|
+
def create_new_card(name)
|
47
|
+
board = Table.pick(Api::Member.current.boards.active)
|
48
|
+
list = Table.pick(board.lists)
|
49
|
+
list.cards.create name: Cli.ask("Input card title [#{name}]:").presence || name
|
48
50
|
end
|
49
51
|
|
50
|
-
def
|
51
|
-
|
52
|
-
checklist = card.find_or_create_checklist
|
53
|
-
item = checklist.add_item(name)
|
54
|
-
item.assign(username)
|
55
|
-
Branch.from_item(item).checkout
|
52
|
+
def pick_existing_card
|
53
|
+
Table.pick Api::Card.for(username)
|
56
54
|
end
|
57
55
|
|
58
56
|
def username
|
data/lib/trello_flow/table.rb
CHANGED
data/lib/trello_flow/version.rb
CHANGED
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: 1.0
|
4
|
+
version: 1.1.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: 2016-
|
11
|
+
date: 2016-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -230,10 +230,12 @@ files:
|
|
230
230
|
- exe/git-start
|
231
231
|
- lib/trello_flow.rb
|
232
232
|
- lib/trello_flow/api/base.rb
|
233
|
+
- lib/trello_flow/api/board.rb
|
233
234
|
- lib/trello_flow/api/card.rb
|
234
235
|
- lib/trello_flow/api/checklist.rb
|
235
236
|
- lib/trello_flow/api/item.rb
|
236
237
|
- lib/trello_flow/api/json_parser.rb
|
238
|
+
- lib/trello_flow/api/list.rb
|
237
239
|
- lib/trello_flow/api/member.rb
|
238
240
|
- lib/trello_flow/branch.rb
|
239
241
|
- lib/trello_flow/cleanup.rb
|