Module: Lhbackup

Defined in:
lib/lhbackup/cli.rb,
lib/lhbackup/backup.rb,
lib/lhbackup/version.rb

Defined Under Namespace

Classes: Backup

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.mainObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lhbackup/cli.rb', line 8

def self.main
  opts = Trollop::options do
    version "lhbackup #{VERSION} Copyright (c) 2012 Nathan Youngman"
    banner "Lighthouse Backup"
    opt :account, "Lighthouse account (eg. activereload)", :type => :string, :required => true
    opt :token, "Token to authenticate with", :type => :string, :required => true
    opt :output, "Output folder (defaults to account)", :type => :string
  end

  folder = opts[:output] || opts[:account]
  FileUtils.mkdir_p(folder)
  FileUtils.chdir(folder)

  Backup.new(opts[:account], opts[:token]).run
end