Class: Vendorificator::Segment::Overlay

Inherits:
Vendorificator::Segment show all
Defined in:
lib/vendorificator/segment/overlay.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Vendorificator::Segment

#fast_forward, #head, #included_in_list?, #merged_notes, #merged_version, #pushable_refs, #run!, #status, #to_s, #updatable?, #work_dir

Constructor Details

#initialize(options) ⇒ Overlay

Returns a new instance of Overlay.



5
6
7
8
9
10
# File 'lib/vendorificator/segment/overlay.rb', line 5

def initialize(options)
  @overlay = ::Vendorificator::Overlay.new(options[:overlay_opts])
  @environment = options[:environment]
  @segments = []
  super
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



3
4
5
# File 'lib/vendorificator/segment/overlay.rb', line 3

def environment
  @environment
end

#overlayObject (readonly)

Returns the value of attribute overlay.



3
4
5
# File 'lib/vendorificator/segment/overlay.rb', line 3

def overlay
  @overlay
end

#segmentsObject (readonly)

Returns the value of attribute segments.



3
4
5
# File 'lib/vendorificator/segment/overlay.rb', line 3

def segments
  @segments
end

Instance Method Details

#base_branch_nameObject



16
17
18
# File 'lib/vendorificator/segment/overlay.rb', line 16

def base_branch_name
  _join config[:branch_prefix], 'overlay', (overlay.name || overlay.path)
end

#branch_nameObject



20
21
22
# File 'lib/vendorificator/segment/overlay.rb', line 20

def branch_name
  _join base_branch_name, 'layer'
end

#compute_dependencies!Object



28
29
30
# File 'lib/vendorificator/segment/overlay.rb', line 28

def compute_dependencies!
  each_segment { |seg| seg.compute_dependencies! }
end

#each_segment(*segments) ⇒ Object

Public: Goes through all the Vendor instances and runs the block

segments - An Array of vendor segments to yield the block for.

Returns nothing.



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/vendorificator/segment/overlay.rb', line 37

def each_segment(*segments)
  # We don't use @segments.each here, because Vendor#run! is
  # explicitly allowed to append to instantiate new dependencies, and #each
  # fails to catch up on some Ruby implementations.
  i = 0
  while true
    break if i >= @segments.length
    seg = @segments[i]
    yield seg if segments.empty? || seg.included_in_list?(segments)
    i += 1
  end
end

#groupObject



50
51
52
# File 'lib/vendorificator/segment/overlay.rb', line 50

def group
  nil
end

#merge_branch_nameObject



24
25
26
# File 'lib/vendorificator/segment/overlay.rb', line 24

def merge_branch_name
  _join base_branch_name, 'merged'
end

#nameObject



12
13
14
# File 'lib/vendorificator/segment/overlay.rb', line 12

def name
  "Overlay \"#{overlay.path}\""
end

#pathObject



58
59
60
# File 'lib/vendorificator/segment/overlay.rb', line 58

def path
  _join overlay.path
end

#versionObject



54
55
56
# File 'lib/vendorificator/segment/overlay.rb', line 54

def version
  nil
end