Class: Babar::Manifest

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

Instance Method Summary collapse

Constructor Details

#initialize(files) ⇒ Manifest

Returns a new instance of Manifest.



3
4
5
6
7
# File 'lib/babar/manifest.rb', line 3

def initialize files
  @files = files
  @actions = []
  instance_eval File.read Babar.hookfile
end

Instance Method Details

#notifyObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/babar/manifest.rb', line 13

def notify
  return unless applicable.any?
  puts "\n\e[0;33mThis merge altered your environment!"

  taken, pending = applicable.partition &:auto?

  if taken.any?
    puts "\e[0;33mThe following actions were automatically taken:"
    taken.each &:notify
  end

  if pending.any?
    puts "\e[0;33mYou should probably:"
    pending.each &:notify
  end

  puts "\e[0m"
end

#performObject



9
10
11
# File 'lib/babar/manifest.rb', line 9

def perform
  applicable.select { |a| a.auto? }.map &:perform
end