class RBT::CreatePkgconfigFile
Public Class Methods
[](i = '')
click to toggle source
Public Instance Methods
add(i = '')
click to toggle source
build_up_the_main_string()
click to toggle source
#¶ ↑
build_up_the_main_string
(main string, main tag)¶ ↑
This method depends on information made available prior to calling it, e. g. the method description? or prefix? and so forth.
#¶ ↑
# File lib/rbt/generate_files/create_pkgconfig_file.rb, line 295 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: #{word_wrapped_description?}" add 'Requires:' add 'Version: '+program_version? add ( 'Libs: -L${libdir} -l'+program_name?+' '+extra_libs?.to_s ).rstrip add 'Cflags: -I${includedir}' end
description?()
click to toggle source
ensure_that_the_pkgconfig_directory_exists_for(i)
click to toggle source
extra_libs?()
click to toggle source
handle_special_programs()
click to toggle source
input_hash?()
click to toggle source
parse_input_hash()
click to toggle source
#¶ ↑
parse_input_hash
¶ ↑
This method can be used to decompose the given input at hand. It is the first method that is called from within run() itself.
#¶ ↑
# File lib/rbt/generate_files/create_pkgconfig_file.rb, line 189 def parse_input_hash _ = input_hash? # ======================================================================= # # === :pkgconfig_filename # ======================================================================= # if _.has_key? :pkgconfig_filename set_pkgconfig_filename(_.delete(:pkgconfig_filename)) end # ======================================================================= # # === :prefix # ======================================================================= # if _.has_key? :prefix @prefix = _.delete(:prefix) end # ======================================================================= # # === :program_version # ======================================================================= # if _.has_key? :program_version set_program_version _.delete(:program_version) # ======================================================================= # # === :version # ======================================================================= # elsif _.has_key? :version set_program_version _.delete(:version) end # ======================================================================= # # === :description # ======================================================================= # if _.has_key? :description @description = _.delete(:description) end end
pkgconfig_filename?()
click to toggle source
prefix?()
click to toggle source
program_name?()
click to toggle source
program_version?()
click to toggle source
raw_name_of_the_program?()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/generate_files/create_pkgconfig_file.rb, line 46 def reset super() infer_the_namespace # ======================================================================= # # === @store_this_string # ======================================================================= # @store_this_string = ''.dup # ======================================================================= # # === @prefix # ======================================================================= # @prefix = '/usr' # This is the default prefix. # ======================================================================= # # === @program_version # ======================================================================= # @program_version = '1.0.0' # ======================================================================= # # === @pkgconfig_filename # ======================================================================= # @pkgconfig_filename = 'mad' # ======================================================================= # # === @description # ======================================================================= # @description = '' # ======================================================================= # # === @extra_libs # ======================================================================= # @extra_libs = ''.dup end
run()
click to toggle source
sanitize_the_input_hash( i = @input_hash )
click to toggle source
#¶ ↑
sanitize_the_input_hash
¶ ↑
The main idea for this method is to turn symbol input such as :htop, or pseudo-symbols such as ‘:htop’, into the real dataset.
#¶ ↑
# File lib/rbt/generate_files/create_pkgconfig_file.rb, line 126 def sanitize_the_input_hash( i = @input_hash ) if i.is_a?(Symbol) or (i.is_a?(String) and i.start_with?(':')) require 'rbt/requires/require_the_installer_class.rb' @input_hash = action(:installer, i, :do_not_run_yet) # ======================================================================= # # We will also generate another filename when RBT::Action::Installer # is used. # ======================================================================= # set_pkgconfig_filename(i) end end
set_input_hash( i = {} )
click to toggle source
#¶ ↑
set_input_hash
¶ ↑
#¶ ↑
# File lib/rbt/generate_files/create_pkgconfig_file.rb, line 99 def set_input_hash( i = {} ) i = i.first if i.is_a? Array if i.is_a?(String) and i.start_with?(':') cookbook_dataset = action(:sanitize_cookbook, i.delete(':')) # ===================================================================== # # Build up the most important Hash next: # ===================================================================== # i = { prefix: cookbook_dataset.prefix_to_use?, pkgconfig_filename: cookbook_dataset.prefix_to_use?+ '/lib/pkgconfig/'+cookbook_dataset.real_short_name?.to_s+'.pc', version: cookbook_dataset.program_version?, description: cookbook_dataset.short_description? } end @input_hash = i sanitize_the_input_hash end
set_pkgconfig_filename(i)
click to toggle source
set_program_version(i)
click to toggle source
short_description?()
click to toggle source
store_pc_file()
click to toggle source
#¶ ↑
store_pc_file
¶ ↑
We must ensure that the pkgconfig/ directory also exists.
#¶ ↑
# File lib/rbt/generate_files/create_pkgconfig_file.rb, line 263 def store_pc_file what = main_string? into = File.basename(pkgconfig_filename?.dup) into << '.pc' unless into.end_with? '.pc' ensure_that_the_pkgconfig_directory_exists_for(into) opne "Now storing into the file `#{sfile(into)}`." opne 'This .pc file could be moved onto' opne sdir(pkgconfig_filename?) store_what_into(what, into) end
store_this_string?()
click to toggle source
#¶ ↑
store_this_string?¶ ↑
#¶ ↑
# File lib/rbt/generate_files/create_pkgconfig_file.rb, line 78 def store_this_string? @store_this_string end
Also aliased as: main_string?
word_wrapped_description?()
click to toggle source