class Lionel::CLI
Public Instance Methods
export()
click to toggle source
# File lib/lionel/cli.rb, line 47 def export lionel_file = options['configuration'] || './Lionelfile' eval(File.read(lionel_file)) if File.exists?(lionel_file) export = Lionel::Export.new(options) if options['google-doc-id'] export.google_doc_id = options['google-doc-id'] elsif !export.google_doc_id export.google_doc_id = ask("Enter a google doc id to export to:") end if options['trello-board-id'] export.trello_board_id = options['trello-board-id'] elsif !export.trello_board_id export.trello_board_id = ask("Enter a trello board id to export from:") end export.save_configuration if options['save'] begin export.authenticate rescue GoogleDrive::Error, GoogleDrive::AuthenticationError @google_attempts ||= 0 @google_attempts += 1 Lionel::GoogleAuthentication.new.refresh if @google_attempts < 2 retry else invoke :authorize, ['google'], {} end rescue Trello::Error, Trello::InvalidAccessToken invoke :authorize, ['trello'], {} ensure export = Lionel::Export.new(options) export.authenticate end welcome = "Trello? Is it me you're looking for?" say welcome say '=' * welcome.size export.process end