Sha256: 896178bfe20acfc1d6cf42899fb88ad879462ae4de6dd16934bbe1838b81934e

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

#!/usr/bin/env ruby

require 'totrello/trelloize'

TRELLO_DEVELOPER_PUBLIC_KEY = ENV['TRELLO_DEVELOPER_PUBLIC_KEY']
TRELLO_MEMBER_TOKEN = ENV['TRELLO_MEMBER_TOKEN']

def main
  return trello unless TRELLO_DEVELOPER_PUBLIC_KEY.nil? || TRELLO_MEMBER_TOKEN.nil?
  error_message
  exit(-1)
end

def error_message
  puts "ERROR:\n"
  puts "Your Trello developer PK is: #{TRELLO_DEVELOPER_PUBLIC_KEY}\n"
  puts "Your Trello member token is: #{TRELLO_MEMBER_TOKEN}\n\n"
  puts "It looks like you haven't set either a TRELLO_DEVELOPER_PUBLIC_KEY or TRELLO_MEMBER_TOKEN.\n\n"
  puts "You can generate a TRELLO_DEVELOPER_PUBLIC_KEY at:\n"
  puts "https://trello.com/1/appKey/generate\n"
  puts "You can generate a TRELLO_MEMBER_TOKEN at:\n"
  puts " https://trello.com/1/authorize?key=[TRELLO_DEVELOPER_PUBLIC_KEY]&name=ToTrelloGem&expiration=never&response_type=token&scope=read,write\n\n"
  puts "Then run:\n"
  puts "    $ export TRELLO_DEVELOPER_PUBLIC_KEY='[Your key here]'\n"
  puts "    $ export TRELLO_MEMBER_TOKEN='[Your key here]'\n"
  puts "\nAnd try ToTrello again.\n"
end

def trello
  dir = ARGV[0].to_s
  if dir == ''
    dir = Dir.pwd
  end

  trel = Trelloize.new(dir)
  todo_finder = Todos.new

  board = trel.trello.find_or_create_board(trel.config)
  todos = todo_finder.all_todos(trel.directory, trel.config)
  trel.find_and_create_cards_from_todos(todos, board)
end


main

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
totrello-1.0.0 bin/ToTrello