trello-fs 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/examples/boards/Labels/cats.md +5 -0
- data/examples/boards/Labels/images.md +6 -0
- data/examples/boards/Labels/puppies.md +5 -0
- data/examples/boards/Labels/readme.md +6 -0
- data/examples/boards/Labels/red_one.md +6 -0
- data/examples/boards/README.md +16 -0
- data/examples/boards/TrelloFs_Demo_Board/A_List_of_Cards/README.md +6 -0
- data/examples/{demo_board → boards/TrelloFs_Demo_Board}/A_List_of_Cards/TrelloFs_Features.md +1 -1
- data/examples/{demo_board → boards/TrelloFs_Demo_Board}/A_List_of_Cards/TrelloFs_Installation.md +1 -1
- data/examples/boards/TrelloFs_Demo_Board/A_Second_List_of_Cards/A_card_with_an_image.md +13 -0
- data/examples/{demo_board → boards/TrelloFs_Demo_Board}/A_Second_List_of_Cards/README.md +1 -1
- data/examples/boards/TrelloFs_Demo_Board/A_Second_List_of_Cards/This_one_has_a_puppy.md +13 -0
- data/examples/{demo_board → boards/TrelloFs_Demo_Board}/README.md +3 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Advanced/Get_the_apps_for_iOS_Android_and_Windows_8.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Advanced/Need_help.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Advanced/README.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Advanced/Use_as_many_boards_as_you_want.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Advanced/Want_tips_usage_examples_or_API_info.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Advanced/Want_to_use_keyboard_shortcuts_We_have_them.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Advanced/Want_updates_on_new_features.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Basics/Click_on_a_card_to_see_whats_behind_it.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Basics/README.md +1 -1
- data/examples/boards/Welcome_Board/Basics/This_is_a_card.md +8 -0
- data/examples/boards/Welcome_Board/Basics/Welcome_to_Trello.md +8 -0
- data/examples/{welcome_board → boards/Welcome_Board}/Basics/You_can_attach_pictures_and_files.md +2 -2
- data/examples/{welcome_board → boards/Welcome_Board}/Basics/any_kind_of_hyperlink_.md +1 -1
- data/examples/boards/Welcome_Board/Basics/or_checklists.md +8 -0
- data/examples/{welcome_board → boards/Welcome_Board}/Intermediate/Drag_people_onto_a_card_to_indicate_that_theyre_responsible_for_it.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Intermediate/Finished_with_a_card_Archive_it.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Intermediate/Invite_your_team_to_this_board_using_the_Add_Members_button.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Intermediate/Make_as_many_lists_as_you_need.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/Intermediate/README.md +2 -2
- data/examples/{welcome_board → boards/Welcome_Board}/Intermediate/Try_dragging_cards_anywhere.md +1 -1
- data/examples/boards/Welcome_Board/Intermediate/Use_color-coded_labels_for_organization.md +8 -0
- data/examples/{welcome_board → boards/Welcome_Board}/Intermediate/You_can_change_the_board_background.md +1 -1
- data/examples/{welcome_board → boards/Welcome_Board}/README.md +4 -2
- data/examples/{demo_board.rb → script.rb} +4 -2
- data/lib/trello-fs/attachment_builder.rb +9 -1
- data/lib/trello-fs/attachment_cleaner.rb +4 -10
- data/lib/trello-fs/board_builder.rb +14 -4
- data/lib/trello-fs/builder.rb +46 -7
- data/lib/trello-fs/card_builder.rb +19 -4
- data/lib/trello-fs/label_builder.rb +4 -11
- data/lib/trello-fs/labels_builder.rb +4 -5
- data/lib/trello-fs/list_builder.rb +19 -5
- data/lib/trello-fs/repository.rb +16 -3
- data/lib/trello-fs/trello_api.rb +28 -15
- data/lib/trello-fs/version.rb +1 -1
- data/spec/helpers/test_repository.rb +4 -1
- data/spec/trello-fs/attachment_cleaner_spec.rb +12 -15
- data/spec/trello-fs/board_builder_spec.rb +4 -6
- data/spec/trello-fs/card_builder_spec.rb +1 -1
- data/spec/trello-fs/label_builder_spec.rb +1 -3
- data/spec/trello-fs/list_builder_spec.rb +2 -2
- data/spec/trello-fs/trello_api_spec.rb +7 -3
- metadata +42 -46
- data/examples/demo_board/A_List_of_Cards/README.md +0 -6
- data/examples/demo_board/A_Second_List_of_Cards/A_card_with_an_image.md +0 -13
- data/examples/demo_board/A_Second_List_of_Cards/This_one_has_a_puppy.md +0 -13
- data/examples/demo_board/Home +0 -13
- data/examples/demo_board/Labels/cats.md +0 -5
- data/examples/demo_board/Labels/images.md +0 -6
- data/examples/demo_board/Labels/no_name.md +0 -4
- data/examples/demo_board/Labels/puppies.md +0 -5
- data/examples/demo_board/Labels/readme.md +0 -6
- data/examples/welcome_board/Basics/This_is_a_card.md +0 -8
- data/examples/welcome_board/Basics/Welcome_to_Trello.md +0 -8
- data/examples/welcome_board/Basics/or_checklists.md +0 -8
- data/examples/welcome_board/Home +0 -31
- data/examples/welcome_board/Intermediate/Use_color-coded_labels_for_organization.md +0 -8
- data/examples/welcome_board/Labels/no_name.md +0 -4
- data/examples/welcome_board/Labels/red_one.md +0 -6
- data/examples/welcome_board.rb +0 -8
- /data/examples/{demo_board/Attachments → boards/Attachments/TrelloFs_Demo_Board}/A_card_with_an_image/cats-cute-cat-animal-cute-grass-photo.jpg +0 -0
- /data/examples/{demo_board/Attachments → boards/Attachments/TrelloFs_Demo_Board}/This_one_has_a_puppy/Puppy_2.jpg +0 -0
- /data/examples/{welcome_board/Attachments → boards/Attachments/Welcome_Board}/You_can_attach_pictures_and_files/taco.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ebefc351370a8ba8f791877c159709ae3830489
|
4
|
+
data.tar.gz: 53d1be480618e93933bbeb6bc3b6fe08fa9f7ae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2347e25ce6218113bd073a5b46167295de01d930a7337fe20008738c96cc286e3b11d45d140459a7b7ee022c67d9d3d6f32c495e31724ba32e36ae12894d90d
|
7
|
+
data.tar.gz: 6e7571f9e8657b1cf491087af1a255bec52a5087b52c5ec759c57b43fe92bf8566abd346c360b4256d87c8fef7a3e7f11fbb2482ed1a8afc40e2d6f9afc5b2c1
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
TrelloFs
|
2
2
|
========
|
3
3
|
|
4
|
-
Dumps the contents of
|
4
|
+
Dumps the contents of Trello boards into a folder structure.
|
5
5
|
The generated files can be then pushed to Github or a Bitbucket Wiki.
|
6
6
|
|
7
7
|
# Example
|
@@ -36,7 +36,7 @@ from this Trello board:
|
|
36
36
|
path: 'PATH_TO_THE_TARGET_FOLDER',
|
37
37
|
developer_public_key: 'DEVELOPER_PUBLIC_KEY',
|
38
38
|
member_token: 'MEMBER_TOKEN',
|
39
|
-
|
39
|
+
board_ids: ['BOARD_ID']
|
40
40
|
})
|
41
41
|
```
|
42
42
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Examples
|
2
|
+
|
3
|
+
Sample boards exported from Trello.
|
4
|
+
|
5
|
+
[`cats`](Labels/cats.md) [`images`](Labels/images.md) [`puppies`](Labels/puppies.md) [`readme`](Labels/readme.md) [`red one`](Labels/red_one.md)
|
6
|
+
|
7
|
+
## [TrelloFs Demo Board](TrelloFs_Demo_Board/README.md)
|
8
|
+
|
9
|
+
- [A List of Cards](TrelloFs_Demo_Board/A_List_of_Cards/README.md)
|
10
|
+
- [A Second List of Cards](TrelloFs_Demo_Board/A_Second_List_of_Cards/README.md)
|
11
|
+
|
12
|
+
## [Welcome Board](Welcome_Board/README.md)
|
13
|
+
|
14
|
+
- [Basics](Welcome_Board/Basics/README.md)
|
15
|
+
- [Intermediate](Welcome_Board/Intermediate/README.md)
|
16
|
+
- [Advanced](Welcome_Board/Advanced/README.md)
|
data/examples/{demo_board → boards/TrelloFs_Demo_Board}/A_List_of_Cards/TrelloFs_Features.md
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
# [TrelloFs Features](https://trello.com/c/xKzJDi8l/2-trellofs-features)
|
2
2
|
|
3
|
-
[TrelloFs Demo Board](../README.md) > [A List of Cards](README.md)
|
3
|
+
[Examples](../../README.md) > [TrelloFs Demo Board](../README.md) > [A List of Cards](README.md)
|
4
4
|
|
5
5
|
[`readme`](../Labels/readme.md)
|
6
6
|
|
data/examples/{demo_board → boards/TrelloFs_Demo_Board}/A_List_of_Cards/TrelloFs_Installation.md
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
# [TrelloFs Installation](https://trello.com/c/Y2KkUY9R/1-trellofs-installation)
|
2
2
|
|
3
|
-
[TrelloFs Demo Board](../README.md) > [A List of Cards](README.md)
|
3
|
+
[Examples](../../README.md) > [TrelloFs Demo Board](../README.md) > [A List of Cards](README.md)
|
4
4
|
|
5
5
|
[`readme`](../Labels/readme.md)
|
6
6
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# [A card with an image](https://trello.com/c/0n9J8V4r/3-a-card-with-an-image)
|
2
|
+
|
3
|
+
[Examples](../../README.md) > [TrelloFs Demo Board](../README.md) > [A Second List of Cards](README.md)
|
4
|
+
|
5
|
+
[`cats`](../Labels/cats.md) [`images`](../Labels/images.md)
|
6
|
+
|
7
|
+
There should be an image below
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
## Attachments
|
12
|
+
|
13
|
+
![cats-cute-cat-animal-cute-grass-photo.jpg](../../Attachments/TrelloFs_Demo_Board/A_card_with_an_image/cats-cute-cat-animal-cute-grass-photo.jpg)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# A Second List of Cards
|
2
2
|
|
3
|
-
[TrelloFs Demo Board](../README.md)
|
3
|
+
[Examples](../../README.md) > [TrelloFs Demo Board](../README.md)
|
4
4
|
|
5
5
|
- [A card with an image](A_card_with_an_image.md) `cats` `images`
|
6
6
|
- [This one has a puppy](This_one_has_a_puppy.md) `images` `puppies`
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# [This one has a puppy](https://trello.com/c/a1qgcz1H/4-this-one-has-a-puppy)
|
2
|
+
|
3
|
+
[Examples](../../README.md) > [TrelloFs Demo Board](../README.md) > [A Second List of Cards](README.md)
|
4
|
+
|
5
|
+
[`images`](../Labels/images.md) [`puppies`](../Labels/puppies.md)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
## Attachments
|
12
|
+
|
13
|
+
![Puppy_2.jpg](../../Attachments/TrelloFs_Demo_Board/This_one_has_a_puppy/Puppy_2.jpg)
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# [TrelloFs Demo Board](https://trello.com/b/23HXX6Gr/trellofs-demo-board)
|
2
2
|
|
3
|
-
[`cats`](Labels/cats.md) [`images`](Labels/images.md) [`puppies`](Labels/puppies.md) [`readme`](Labels/readme.md)
|
3
|
+
[`cats`](../Labels/cats.md) [`images`](../Labels/images.md) [`puppies`](../Labels/puppies.md) [`readme`](../Labels/readme.md)
|
4
|
+
|
5
|
+
[Examples](../README.md)
|
4
6
|
|
5
7
|
## [A List of Cards](A_List_of_Cards/README.md)
|
6
8
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# [Get the apps for iOS, Android, and Windows 8!](https://trello.com/c/nrGRIe2t/18-get-the-apps-for-ios-android-and-windows-8)
|
2
2
|
|
3
|
-
[Welcome Board](../README.md) > [Advanced](README.md)
|
3
|
+
[Examples](../../README.md) > [Welcome Board](../README.md) > [Advanced](README.md)
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Advanced
|
2
2
|
|
3
|
-
[Welcome Board](../README.md)
|
3
|
+
[Examples](../../README.md) > [Welcome Board](../README.md)
|
4
4
|
|
5
5
|
- [Use as many boards as you want!](Use_as_many_boards_as_you_want.md)
|
6
6
|
- [Want tips, usage examples, or API info?](Want_tips_usage_examples_or_API_info.md)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# [Want to use keyboard shortcuts? We have them!](https://trello.com/c/bmKSjFcU/14-want-to-use-keyboard-shortcuts-we-have-them)
|
2
2
|
|
3
|
-
[Welcome Board](../README.md) > [Advanced](README.md)
|
3
|
+
[Examples](../../README.md) > [Welcome Board](../README.md) > [Advanced](README.md)
|
4
4
|
|
5
5
|
|
6
6
|
|
data/examples/{welcome_board → boards/Welcome_Board}/Basics/You_can_attach_pictures_and_files.md
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
# [You can attach pictures and files...](https://trello.com/c/kXPi0va2/4-you-can-attach-pictures-and-files)
|
2
2
|
|
3
|
-
[Welcome Board](../README.md) > [Basics](README.md)
|
3
|
+
[Examples](../../README.md) > [Welcome Board](../README.md) > [Basics](README.md)
|
4
4
|
|
5
5
|
[`red one`](../Labels/red_one.md)
|
6
6
|
|
@@ -10,4 +10,4 @@ This is Taco, the most famous Siberian Husky in New York City, and official spok
|
|
10
10
|
|
11
11
|
## Attachments
|
12
12
|
|
13
|
-
![taco.png](
|
13
|
+
![taco.png](../../Attachments/Welcome_Board/You_can_attach_pictures_and_files/taco.png)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# [Drag people onto a card to indicate that they're responsible for it.](https://trello.com/c/hdPn172M/8-drag-people-onto-a-card-to-indicate-that-they-re-responsible-for-it)
|
2
2
|
|
3
|
-
[Welcome Board](../README.md) > [Intermediate](README.md)
|
3
|
+
[Examples](../../README.md) > [Welcome Board](../README.md) > [Intermediate](README.md)
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# [Invite your team to this board using the Add Members button](https://trello.com/c/XJoGqr42/7-invite-your-team-to-this-board-using-the-add-members-button)
|
2
2
|
|
3
|
-
[Welcome Board](../README.md) > [Intermediate](README.md)
|
3
|
+
[Examples](../../README.md) > [Welcome Board](../README.md) > [Intermediate](README.md)
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# Intermediate
|
2
2
|
|
3
|
-
[Welcome Board](../README.md)
|
3
|
+
[Examples](../../README.md) > [Welcome Board](../README.md)
|
4
4
|
|
5
5
|
- [Invite your team to this board using the Add Members button](Invite_your_team_to_this_board_using_the_Add_Members_button.md)
|
6
6
|
- [Drag people onto a card to indicate that they're responsible for it.](Drag_people_onto_a_card_to_indicate_that_theyre_responsible_for_it.md)
|
7
|
-
- [Use color-coded labels for organization](Use_color-coded_labels_for_organization.md)
|
7
|
+
- [Use color-coded labels for organization](Use_color-coded_labels_for_organization.md) `red one`
|
8
8
|
- [You can change the board background.](You_can_change_the_board_background.md)
|
9
9
|
- [Make as many lists as you need!](Make_as_many_lists_as_you_need.md)
|
10
10
|
- [Try dragging cards anywhere.](Try_dragging_cards_anywhere.md)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# [You can change the board background.](https://trello.com/c/lxDp5eEi/19-you-can-change-the-board-background)
|
2
2
|
|
3
|
-
[Welcome Board](../README.md) > [Intermediate](README.md)
|
3
|
+
[Examples](../../README.md) > [Welcome Board](../README.md) > [Intermediate](README.md)
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# [Welcome Board](https://trello.com/b/bkskcUIO/welcome-board)
|
2
2
|
|
3
|
-
[`
|
3
|
+
[`red one`](../Labels/red_one.md)
|
4
|
+
|
5
|
+
[Examples](../README.md)
|
4
6
|
|
5
7
|
## [Basics](Basics/README.md)
|
6
8
|
|
@@ -15,7 +17,7 @@
|
|
15
17
|
|
16
18
|
- [Invite your team to this board using the Add Members button](Intermediate/Invite_your_team_to_this_board_using_the_Add_Members_button.md)
|
17
19
|
- [Drag people onto a card to indicate that they're responsible for it.](Intermediate/Drag_people_onto_a_card_to_indicate_that_theyre_responsible_for_it.md)
|
18
|
-
- [Use color-coded labels for organization](Intermediate/Use_color-coded_labels_for_organization.md)
|
20
|
+
- [Use color-coded labels for organization](Intermediate/Use_color-coded_labels_for_organization.md) `red one`
|
19
21
|
- [You can change the board background.](Intermediate/You_can_change_the_board_background.md)
|
20
22
|
- [Make as many lists as you need!](Intermediate/Make_as_many_lists_as_you_need.md)
|
21
23
|
- [Try dragging cards anywhere.](Intermediate/Try_dragging_cards_anywhere.md)
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require_relative '../lib/trello-fs'
|
2
2
|
|
3
3
|
TrelloFs.build({
|
4
|
-
path: '
|
4
|
+
path: 'boards',
|
5
|
+
title: 'Examples',
|
6
|
+
description: 'Sample boards exported from Trello.',
|
5
7
|
developer_public_key: 'f19ae1a07b4a7112b3227bb6fd99abec',
|
6
8
|
member_token: 'cf2db23395ea7d0507930218eaec1e4b2f1783b9e6798be92b601f429de517cd',
|
7
|
-
|
9
|
+
board_ids: ['54e8e79e3bebac45c537327c', '54e79539bda3e89c0bf454ec']
|
8
10
|
})
|
@@ -4,6 +4,10 @@ module TrelloFs
|
|
4
4
|
class AttachmentBuilder
|
5
5
|
attr_reader :card_builder, :attachment
|
6
6
|
|
7
|
+
def self.new_by_attachment(repository, attachment)
|
8
|
+
self.new(CardBuilder.new_by_card(repository, attachment.card), attachment)
|
9
|
+
end
|
10
|
+
|
7
11
|
def initialize(card_builder, attachment)
|
8
12
|
@card_builder = card_builder
|
9
13
|
@attachment = attachment
|
@@ -34,7 +38,7 @@ module TrelloFs
|
|
34
38
|
end
|
35
39
|
|
36
40
|
def folder_path
|
37
|
-
File.join('Attachments', StringToFileName.convert(@card_builder.card_name))
|
41
|
+
File.join('Attachments', board_builder.folder_name, StringToFileName.convert(@card_builder.card_name))
|
38
42
|
end
|
39
43
|
|
40
44
|
def full_folder_path
|
@@ -56,5 +60,9 @@ module TrelloFs
|
|
56
60
|
def repository
|
57
61
|
@card_builder.repository
|
58
62
|
end
|
63
|
+
|
64
|
+
def board_builder
|
65
|
+
@card_builder.board_builder
|
66
|
+
end
|
59
67
|
end
|
60
68
|
end
|
@@ -3,20 +3,13 @@ require 'set'
|
|
3
3
|
|
4
4
|
module TrelloFs
|
5
5
|
class AttachmentCleaner
|
6
|
-
def initialize(repository
|
6
|
+
def initialize(repository)
|
7
7
|
@repository = repository
|
8
|
-
@board = board
|
9
8
|
end
|
10
9
|
|
11
10
|
def set_of_attachment_paths
|
12
|
-
@
|
13
|
-
AttachmentBuilder.
|
14
|
-
CardBuilder.new(
|
15
|
-
ListBuilder.new(
|
16
|
-
BoardBuilder.new(@repository, @board),
|
17
|
-
attachment.card.list
|
18
|
-
), attachment.card
|
19
|
-
), attachment).path
|
11
|
+
@repository.attachments.map do |attachment|
|
12
|
+
AttachmentBuilder.new_by_attachment(@repository, attachment).path
|
20
13
|
end.to_set
|
21
14
|
end
|
22
15
|
|
@@ -28,6 +21,7 @@ module TrelloFs
|
|
28
21
|
reject {|fn| File.directory?(fn) }.
|
29
22
|
each do |file|
|
30
23
|
next if new_attachments.include? file
|
24
|
+
puts file
|
31
25
|
FileUtils.rm(file)
|
32
26
|
|
33
27
|
# remove parent dir if empty
|
@@ -11,7 +11,6 @@ module TrelloFs
|
|
11
11
|
board.lists.each do |list|
|
12
12
|
ListBuilder.new(self, list).build
|
13
13
|
end
|
14
|
-
LabelsBuilder.new(@repository, @board).build
|
15
14
|
|
16
15
|
build_readme
|
17
16
|
end
|
@@ -27,6 +26,7 @@ module TrelloFs
|
|
27
26
|
[
|
28
27
|
"# [#{board_name}](#{@board.url})",
|
29
28
|
labels_content,
|
29
|
+
"[#{repository_name}](../README.md)",
|
30
30
|
board.lists.map do |list|
|
31
31
|
list_builder = ListBuilder.new(self, list)
|
32
32
|
list_link = "[#{list_builder.list_name}](#{list_builder.file_name}/README.md)"
|
@@ -45,17 +45,27 @@ module TrelloFs
|
|
45
45
|
@board.labels.sort {|a, b| a.name <=> b.name }.
|
46
46
|
select {|lbl| lbl.cards.any? }.
|
47
47
|
map do |label|
|
48
|
-
label_builder = LabelBuilder.new(
|
49
|
-
"[`#{label_builder.label_name}`](
|
48
|
+
label_builder = LabelBuilder.new(@repository, label)
|
49
|
+
"[`#{label_builder.label_name}`](../#{label_builder.relative_path})"
|
50
50
|
end.join(' ')
|
51
51
|
end
|
52
52
|
|
53
53
|
def path
|
54
|
-
@repository.path
|
54
|
+
File.join(@repository.path, folder_name)
|
55
55
|
end
|
56
56
|
|
57
|
+
def folder_name
|
58
|
+
StringToFileName.convert(board_name)
|
59
|
+
end
|
60
|
+
|
61
|
+
alias_method :relative_path, :folder_name
|
62
|
+
|
57
63
|
def board_name
|
58
64
|
@board.name
|
59
65
|
end
|
66
|
+
|
67
|
+
def repository_name
|
68
|
+
@repository.title
|
69
|
+
end
|
60
70
|
end
|
61
71
|
end
|
data/lib/trello-fs/builder.rb
CHANGED
@@ -7,21 +7,60 @@ module TrelloFs
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def build
|
10
|
-
repository = Repository.new
|
11
|
-
board = TrelloApi.new(repository).board
|
10
|
+
repository = Repository.new(@config, self)
|
12
11
|
|
13
12
|
# remove old files from the repo
|
14
13
|
RepositoryCleaner.new(repository).clean
|
15
14
|
|
16
|
-
|
17
|
-
|
15
|
+
boards = TrelloApi.new(repository).boards
|
16
|
+
boards.each do |board|
|
17
|
+
BoardBuilder.new(repository, board).build
|
18
|
+
end
|
19
|
+
LabelsBuilder.new(repository).build
|
20
|
+
build_readme(repository, boards)
|
18
21
|
|
19
22
|
# remove old attachments
|
20
|
-
AttachmentCleaner.new(repository
|
23
|
+
AttachmentCleaner.new(repository).remove_old_attachments
|
21
24
|
end
|
22
25
|
|
23
|
-
def
|
24
|
-
|
26
|
+
def build_readme(repository, boards)
|
27
|
+
readme_path = File.join(repository.path, 'README.md')
|
28
|
+
File.open(readme_path, 'w') do |file|
|
29
|
+
file.write(readme_content(repository, boards))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def readme_content(repository, boards)
|
34
|
+
[
|
35
|
+
"# #{repository.title}",
|
36
|
+
repository.description,
|
37
|
+
labels_content(repository),
|
38
|
+
boards_content(repository, boards)
|
39
|
+
].join("\n\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
def labels_content(repository)
|
43
|
+
return '' unless repository.labels && repository.labels.any?
|
44
|
+
|
45
|
+
repository.labels.values.sort {|a, b| a.name <=> b.name }.
|
46
|
+
select {|lbl| lbl.cards.any? }.
|
47
|
+
map do |label|
|
48
|
+
label_builder = LabelBuilder.new(@repository, label)
|
49
|
+
"[`#{label_builder.label_name}`](#{label_builder.relative_path})"
|
50
|
+
end.join(' ')
|
51
|
+
end
|
52
|
+
|
53
|
+
def boards_content(repository, boards)
|
54
|
+
boards.map do |board|
|
55
|
+
board_builder = BoardBuilder.new(repository, board)
|
56
|
+
[
|
57
|
+
"## [#{board.name}](#{board_builder.relative_path}/README.md)",
|
58
|
+
board.lists.map do |list|
|
59
|
+
list_builder = ListBuilder.new(board_builder, list)
|
60
|
+
" - [#{list_builder.list_name}](#{list_builder.relative_path}/README.md)"
|
61
|
+
end.join("\n")
|
62
|
+
].join("\n\n")
|
63
|
+
end.join("\n\n")
|
25
64
|
end
|
26
65
|
|
27
66
|
def trello_api_board(repository)
|