Class: BuildInfo::Build

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

Class Method Summary collapse

Class Method Details

.build(release_info = {}) ⇒ Object



6
7
8
9
10
11
# File 'lib/build_info/build.rb', line 6

def self.build(release_info={})
  f = File.new('.build_info', 'w')
  f.write(YAML::dump(release_info))
  f.close
  @build_info = nil
end

.build_info_strObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/build_info/build.rb', line 22

def self.build_info_str
  str = ''
  str += "\nBuild Information\n\n"
  
  items.each do |i|
    print (i[1].nil ? "NOT AVAILABLE" : i[1])
    print "\n"
  end
  print "\n"
end

.infoObject



44
45
46
47
48
49
50
# File 'lib/build_info/build.rb', line 44

def self.info
  if @build_info.nil?
    load
    return {} if @build_info.nil?
  end
  @build_info
end

.loadObject



13
14
15
16
17
18
19
20
# File 'lib/build_info/build.rb', line 13

def self.load
  begin
    f = File.new('.build_info', 'r')
    @build_info = YAML::load(f.read)
  rescue 
    
  end
end


33
34
35
36
37
38
39
40
41
42
# File 'lib/build_info/build.rb', line 33

def self.print_build_info_color
  print_color(:green, "\nBuild Information\n\n")

  items.each do |i|
    print_color(:yellow, "#{i[0]}: ")
    print (i[1].nil? ? "NOT AVAILABLE" : i[1])
    print "\n"
  end
  print "\n"
end