class TrelloFs::ListBuilder
Attributes
board_builder[R]
list[R]
Public Class Methods
new(board_builder, list)
click to toggle source
# File lib/trello-fs/list_builder.rb, line 9 def initialize(board_builder, list) @board_builder = board_builder @list = list end
new_by_list(repository, list)
click to toggle source
# File lib/trello-fs/list_builder.rb, line 5 def self.new_by_list(repository, list) self.new(BoardBuilder.new(repository, list.board), list) end
Public Instance Methods
board_name()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 83 def board_name @board_builder.board_name end
build()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 14 def build list.cards.each do |card| CardBuilder.new(self, card).build end build_readme end
build_path()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 75 def build_path FileUtils.mkpath(path) unless File.exist? path end
build_readme()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 22 def build_readme build_path readme_path = File.join(path, 'README.md') File.open(readme_path, 'w') do |file| file.write(readme_content) end end
card_labels(card)
click to toggle source
# File lib/trello-fs/list_builder.rb, line 51 def card_labels(card) labels = card.labels. sort {|a, b| a.name <=> b.name }. map {|label| "`#{label.name}`" } if labels.any? ' ' + labels.join(' ') else '' end end
content(full_path = false)
click to toggle source
# File lib/trello-fs/list_builder.rb, line 41 def content(full_path = false) @list.cards.map do |card| cb = CardBuilder.new(self, card) card_path = cb.file_name card_path = File.join(file_name, card_path) if full_path "- [#{cb.card_name}](#{card_path})#{card_labels(card)}" end.join("\n") end
file_name()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 71 def file_name StringToFileName.convert(@list.name) end
list_name()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 79 def list_name @list.name end
path()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 63 def path File.join(@board_builder.path, file_name) end
readme_content()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 30 def readme_content [ "# #{list_name}", [ "[#{repository_name}](../../README.md)", "[#{board_name}](../README.md)" ].join(' > '), content ].join("\n\n") end
relative_path()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 67 def relative_path File.join(@board_builder.relative_path, file_name) end
repository()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 87 def repository @board_builder.repository end
repository_name()
click to toggle source
# File lib/trello-fs/list_builder.rb, line 91 def repository_name repository.title end