class RBT::CreatePkgconfigFile

Constants

NAMESPACE
#

NAMESPACE

#

Public Class Methods

[](i = '') click to toggle source
#

[]

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 211
def self.[](i = '')
  self.new(i)
end
new( i = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 37
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input_hash(i)
  run if run_already
end

Public Instance Methods

add(i = '') click to toggle source
#

add

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 114
def add(i = '')
  @store_this_string << i+N
end
build_up_the_main_string() click to toggle source
#

build_up_the_main_string

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 163
def build_up_the_main_string
  add 'prefix='+prefix?.to_s # Need .to_s here since we can also pass class Prefix.
  add 'exec_prefix=${prefix}'
  add 'libdir=${exec_prefix}/lib'
  add 'includedir=${prefix}/include'
  add
  add 'Name: '+program_name?.dup
  add "Description: #{description?}"
  add 'Requires:'
  add 'Version: '+program_version?
  add 'Libs: -L${libdir} -l'+program_name?
  add 'Cflags: -I${includedir}'
end
description?() click to toggle source
#

description?

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 69
def description?
  @description
end
ensure_that_the_pkgconfig_directory_exists_for(i) click to toggle source
#

ensure_that_the_pkgconfig_directory_exists_for

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 194
def ensure_that_the_pkgconfig_directory_exists_for(i)
  i = File.dirname(i)
  mkdir(i, :be_quiet) unless File.directory? i
end
input_hash?() click to toggle source
#

input_hash?

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 91
def input_hash?
  @input_hash
end
main_string?()
Alias for: store_this_string?
parse_input_hash() click to toggle source
#

parse_input_hash

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 128
def parse_input_hash
  _ = input_hash?
  if _.has_key? :pkgconfig_filename
    set_pkgconfig_filename(_.delete(:pkgconfig_filename))
  end
  if _.has_key? :prefix
    @prefix = _.delete(:prefix)
  end
  if _.has_key? :program_version
    set_program_version _.delete(:program_version)
  elsif _.has_key? :version
    set_program_version _.delete(:version)
  end
  if _.has_key? :description
    @description = _.delete(:description)
  end
end
pkgconfig_filename?() click to toggle source
#

pkgconfig_filename?

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 98
def pkgconfig_filename?
  @pkgconfig_filename
end
prefix?() click to toggle source
#

prefix?

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 76
def prefix?
  @prefix
end
program_name?() click to toggle source
#

program_name?

This method is guaranteed to return the name without the .pc name.

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 107
def program_name?
  File.basename(pkgconfig_filename?).sub(/\.pc$/,'').dup
end
program_version?() click to toggle source
#

program_version?

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 156
def program_version?
  @program_version
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 49
def reset
  super()
  @store_this_string  = ''.dup
  @prefix             = '/usr' # This is the default prefix.
  @program_version    = '1.0.0'
  @pkgconfig_filename = 'mad'
  @description        = ''
  @namespace = NAMESPACE
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 202
def run
  parse_input_hash # Must parse the Hash prior to String build-up.
  build_up_the_main_string
  store_pc_file
end
set_input_hash(i = {}) click to toggle source
#

set_input_hash

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 83
def set_input_hash(i = {})
  i = i.first if i.is_a? Array
  @input_hash = i
end
set_pkgconfig_filename(i) click to toggle source
#

set_pkgconfig_filename

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 121
def set_pkgconfig_filename(i)
  @pkgconfig_filename = rds(i.dup)
end
set_program_version(i) click to toggle source
#

set_program_version

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 149
def set_program_version(i)
  @program_version = i
end
store_pc_file() click to toggle source
#

store_pc_file

We must ensure that the pkgconfig/ directory also exists.

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 182
def store_pc_file
  what = main_string?
  into = pkgconfig_filename?.dup
  into << '.pc' unless into.end_with? '.pc'
  ensure_that_the_pkgconfig_directory_exists_for(into)
  opnn; e "Now storing into the file `#{sfile(into)}`."
  store_what_into(what, into)
end
store_this_string?() click to toggle source
#

store_this_string?

#
# File lib/rbt/utility_scripts/create_pkgconfig_file.rb, line 62
def store_this_string?
  @store_this_string
end
Also aliased as: main_string?