Sha256: c026f2e85a0ea0f7289014927fe8673906bcd4296f04e7e16916d75fec17c4ec

Contents?: true

Size: 954 Bytes

Versions: 2

Compression:

Stored size: 954 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 google'"
  end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lionel_richie-0.1.4 bin/lionel
lionel_richie-0.1.3 bin/lionel