Class: Git::Dropbox::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/git/dropbox/cli.rb

Instance Method Summary collapse

Instance Method Details

#initObject



23
24
25
26
# File 'lib/git/dropbox/cli.rb', line 23

def init
  folder = "#{ENV['HOME']}/Dropbox/git"
  Git::Dropbox::Config.init!(folder)
end

#listObject



30
31
32
33
# File 'lib/git/dropbox/cli.rb', line 30

def list
  config = load_config
  config['repositories'].each { |r| puts r }
end

#syncObject



12
13
14
15
16
17
18
19
# File 'lib/git/dropbox/cli.rb', line 12

def sync
  config = load_config
  repositories = options[:all] ? config['repositories'] : [Dir.pwd]
  repositories.each do |repo|
    say "Synchronizing repository #{repo}"
    Repository.new(config).sync(repo)
  end
end