Sha256: f53134402b295d7c28293e39065731cd527b6d005be6781c6eb42706aaf64eef

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

require 'totrello/trello_builder'
require 'totrello/trelloize'
require 'totrello/trello_config'
require 'totrello/todos'

# Trelloize
class Trelloize
  attr_accessor :trello, :directory, :config

  def initialize(directory = Dir.pwd.to_s)
    @trello = TrelloBuilder.new
    @directory = directory
    @config = TrelloConfig.new(directory)
  end

  def description(todo, config)
    return '' if todo.nil?
    out =  'TODO item found by the '
    out += "[ToTrello](https://rubygems.org/gems/totrello) gem\n"
    out += "**Project name:** #{config.project_name}\n"
    out += "**Filename**: #{todo[:file]}\n"
    out += "**Action item**: #{todo[:todo]}\n"
    out + "**Location (at or near) line**: #{todo[:line_number]}\n"
  end

  def find_and_create_cards_from_todos(todos, board)
    todos.each do |todo|
      description = description(todo, @config)
      @trello.create_card(board, todo[:todo], description, @config.default_list)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
totrello-1.0.0 lib/totrello/trelloize.rb