Class: Vigil::Revision

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, project) ⇒ Revision

Returns a new instance of Revision.



6
7
8
9
10
11
# File 'lib/vigil/revision.rb', line 6

def initialize(id, project)
  @id = id
  @project = project
  @run_dir_boxes = File.join(@project.working_dir, 'boxes')
  @os = Vigil.os
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/vigil/revision.rb', line 4

def id
  @id
end

Instance Method Details

#_box_path(box) ⇒ Object



67
68
69
# File 'lib/vigil/revision.rb', line 67

def _box_path(box)
  File.join(@run_dir_boxes, box)
end

#base_box_nameObject



43
44
45
# File 'lib/vigil/revision.rb', line 43

def base_box_name
  "#{@project.name}-#@id"
end

#base_box_pathObject



47
48
49
# File 'lib/vigil/revision.rb', line 47

def base_box_path
  _box_path(base_box_name + '.box')
end

#branchObject



35
36
37
# File 'lib/vigil/revision.rb', line 35

def branch
  @project.branch
end

#complete_box_nameObject



59
60
61
# File 'lib/vigil/revision.rb', line 59

def complete_box_name
  base_box_name + '_complete'
end

#complete_box_pathObject



63
64
65
# File 'lib/vigil/revision.rb', line 63

def complete_box_path
  _box_path(complete_box_name + '.pkg')
end

#git_urlObject



27
28
29
# File 'lib/vigil/revision.rb', line 27

def git_url
  @project.git_url
end

#no_gems_box_nameObject



51
52
53
# File 'lib/vigil/revision.rb', line 51

def no_gems_box_name
  base_box_name + '_no_gems'
end

#no_gems_box_pathObject



55
56
57
# File 'lib/vigil/revision.rb', line 55

def no_gems_box_path
  _box_path(no_gems_box_name + '.pkg')
end

#previousObject



19
20
21
# File 'lib/vigil/revision.rb', line 19

def previous
  Revision.new(@id-1, @project)
end

#project_nameObject



39
40
41
# File 'lib/vigil/revision.rb', line 39

def project_name
  @project.name
end

#run_pipelineObject



13
14
15
16
17
# File 'lib/vigil/revision.rb', line 13

def run_pipeline
  @os.mkdir_p working_dir
  @os.mkdir_p @run_dir_boxes
  Pipeline.new(self).run
end

#shaObject



31
32
33
# File 'lib/vigil/revision.rb', line 31

def sha
  `bash -c 'GIT_DIR=#{File.join(working_dir, '.git')} git rev-parse HEAD'` #FIXME
end

#working_dirObject



23
24
25
# File 'lib/vigil/revision.rb', line 23

def working_dir
  File.join(@project.working_dir, @id.to_s)
end