Module: Droxi

Defined in:
lib/droxi.rb

Overview

Command-line Dropbox client module.

Constant Summary collapse

VERSION =

Version number of the program.

'0.4.1'
HELP_TEXT =

Message to display when invoked with the –help option.

[
  'If invoked without arguments, run in interactive mode. If invoked with ' \
  'arguments, parse the arguments as a command invocation, execute the ' \
  'command, and exit.',
  "For a list of commands, run `droxi help` or use the 'help' command in " \
  'interactive mode.'
]

Class Method Summary collapse

Class Method Details

.runObject

Run the client.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/droxi.rb', line 32

def self.run
  reenter = ARGV[0] == 'REENTER'
  ARGV.delete_if { |arg| arg == 'REENTER' }
  original_argv = ARGV.dup
  options, args = handle_options
  Settings.init

  client = DropboxClient.new(access_token)
  state = State.new(client, args.empty?, original_argv)
  state.debug_enabled = options[:debug]

  if args.empty?
    run_interactive(client, state, reenter)
  else
    invoke(args, client, state)
  end
rescue DropboxAuthError => error
  warn error
  Settings.delete(:access_token)
ensure
  Settings.save
end