Class: BuildInfo::Build
- Inherits:
-
Object
- Object
- BuildInfo::Build
- Defined in:
- lib/build_info/build.rb
Class Method Summary collapse
- .build(release_info = {}) ⇒ Object
- .build_info_str ⇒ Object
- .info ⇒ Object
- .load ⇒ Object
- .print_build_info_color ⇒ Object
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_str ⇒ Object
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 |
.info ⇒ Object
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 |
.load ⇒ Object
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 |
.print_build_info_color ⇒ Object
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 |