Class: VimPK::Job

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

Instance Method Summary collapse

Constructor Details

#initialize(dir, logs) ⇒ Job

Returns a new instance of Job.



3
4
5
6
7
8
# File 'lib/vimpk/job.rb', line 3

def initialize(dir, logs)
  @dir = dir
  @basename = File.basename(dir)
  @logs = logs
  @git = Git
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vimpk/job.rb', line 10

def call
  branch = Git.branch(dir: @dir)
  Git.fetch(branch, dir: @dir)
  log = Git.log(branch, dir: @dir)

  unless log.empty?
    @logs << {basename: @basename, log: log}

    Git.pull(dir: @dir)
  end
end