Class: GitGrabber::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/git_grabber.rb

Instance Method Summary collapse

Instance Method Details

#config(path) ⇒ Object



8
9
10
11
# File 'lib/git_grabber.rb', line 8

def config(path)
  @config = GitGrabber::Config.new File.read path
  @api    = GitGrabber::Api.new @config.github_personal_token
end

#goObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/git_grabber.rb', line 13

def go
  puller = GitGrabber::Puller.new @config.backup_directory

  while true
    repos = @api.fetch_all

    repos.each do |details|
      puller.update("https://github.com/#{details.full_name}", "#{details.name}.git")
    end

    sleep(@config.interval)
  end
end