Sha256: 355af78c9b6595c1b611eaf8a19a4b55cf067c5fb298a218aef963efb71f7c19

Contents?: true

Size: 940 Bytes

Versions: 3

Compression:

Stored size: 940 Bytes

Contents

#! /usr/bin/env ruby

# Trap interrupts to quit cleanly. See
# https://twitter.com/mitchellh/status/283014103189053442
Signal.trap("INT") { exit 1 }

require 'lionel_richie'

# Output message to $stderr, prefixed with the program name
def pute(*args)
  first = args.shift.dup
  first.insert(0, "#{$0}: ")
  args.unshift(first)
  $stderr.puts(*args)
end

begin
  Lionel::CLI.start(ARGV)

rescue GoogleDrive::Error, GoogleDrive::AuthenticationError => e
  @attempts ||= 0
  @attempts += 1
  Lionel::GoogleAuthentication.new.refresh
  if @attempts < 2
    retry
  else
    puts e.class
    puts "-" * e.class.name.size
    pute e.message
    puts "Unable to access Google Drive"
    puts "run 'lionel authorize'"
  end

rescue Trello::Error, Trello::InvalidAccessToken => e
  puts "Unable to access Trello"
  puts "run 'lionel authorize'"

rescue StandardError => e
  puts e.class
  puts "-" * e.class.name.size
  pute e.message
  raise e
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lionel_richie-0.1.2 bin/lionel
lionel_richie-0.1.1 bin/lionel
lionel_richie-0.1.0 bin/lionel