class NixRPGBuild::Header

Attributes

macros[RW]

An array of macros to write to the configuration header file.

Public Class Methods

new(config_yml) click to toggle source
Calls superclass method NixRPGBuild::Build::new
# File lib/header.rb, line 5
def initialize(config_yml)
  super(config_yml)
  @macros = []
end

Public Instance Methods

write() click to toggle source

Writes a configuration header file.

@return [Nil]

# File lib/header.rb, line 13
def write
  @header = File.new(@config_header, 'w')

  @bins.each_index do |i|
    @header.puts "/* Name of package */"
    @header.puts "#define " + @macros[i] + "\s" + "\"#{@bins[i]}\"\n\n"
  end

  @versions.each_index do |i|
    @header.puts "/* Version number of package */"
    @header.puts "#define " + @macros[i] + "_VERSION" + "\s" + "\"#{@versions[i]}\"\n\n"
  end

  @package_urls.each_index do |i|
    @header.puts "/* The home page for this package. */"
    @header.puts "#define " + @macros[i] + "_PKG_URL" + "\s" + "\"#{@package_urls[i]}\"\n\n"
  end

  @issues_urls.each_index do |i|
    @header.puts "/* The address where bug reports for this package should be sent. */"
    @header.puts "#define " + @macros[i] + "_ISSUES_URL" + "\s" + "\"#{@issues_urls[i]}\"\n\n"
  end

  @header.close
end