Sha256: 1684f8d34e8dea2c9582791b25e526e41e90e0f987c9955d91fa9cf704e392b2

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

#!/usr/bin/env ruby

require 'totrello'
TRELLO_DEVELOPER_PUBLIC_KEY = ENV['TRELLO_DEVELOPER_PUBLIC_KEY']
TRELLO_MEMBER_TOKEN = ENV['TRELLO_MEMBER_TOKEN']

def main

  if TRELLO_DEVELOPER_PUBLIC_KEY.nil? || TRELLO_MEMBER_TOKEN.nil?
    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"


    exit(-1)
  else

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


    puts "You've specified to work in: #{dir}"
    trel = Totrello::Trelloize.new(dir)
    puts 'Generating your board'
    board = trel.create_or_gen_board
    return -1 if board.nil?
    puts "Created or found a board with the ID: #{board.name}"
    puts 'Finding your todo items... '
    todos = trel.get_todos
    puts "Woot! We've got'em"
    trel.create_cards(board, todos)
    puts "And you're ready to go!"


  end

end


main

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
totrello-0.3.04 bin/ToTrello