class RBT::InstallGlibSchema

Constants

#

This constant may have one of two allowed values:

:symlink
:copy

When :symlink is used then we will symlink the .xml files into the main target directory at '/usr/share/glib-2.0/schemas/'.

When :copy is used, then we will simply copy the .xml files into that directory instead. The symlink-approach is probably cleaner, so this is why I prefer it, since you instantly recognize which files are just symlinks. If you'd copy it, you'd lose that information.

#
DEFAULT_PROGRAM_NAME
#

DEFAULT_PROGRAM_NAME

#
FHS_TARGET_DIRECTORY_FOR_GLIB
#

FHS_TARGET_DIRECTORY_FOR_GLIB

This should point to the main directory for where the glib-schema files are normally stored, on a FHS-conforming system.

This is usually a directory such as '/usr/share/glib-2.0/schemas/'.

#
NAMESPACE
#

NAMESPACE

#
RELATIVE_TARGET_TO_SCHEMA_FILES
#

RELATIVE_TARGET_TO_SCHEMA_FILES

This String here can be used to find the relatve target directory for schema files.

#

Public Class Methods

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

[]

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

initialize

#
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 78
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(i)
  if block_given?
    yielded = yield
    case yielded
    when :do_symlink
      @copy_the_schema_files_or_symlink_the_schema_files = :symlink
    when :do_copy
      @copy_the_schema_files_or_symlink_the_schema_files = :copy
    end
  end
  run if run_already
end

Public Instance Methods

appdir_schema_directory?() click to toggle source
#

appdir_schema_directory?

#
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 140
def appdir_schema_directory?
  "#{programs_dir?}#{upcased_program_name?}/Current/share/glib-2.0/schemas/"
end
input?() click to toggle source
#

input?

#
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 125
def input?
  @input
end
Also aliased as: upcased_program_name?
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 99
def reset
  super()
  @are_there_any_xml_files = false
  @copy_the_schema_files_or_symlink_the_schema_files = COPY_THE_SCHEMA_FILES_OR_SYMLINK_THE_SCHEMA_FILES
  @namespace = NAMESPACE
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 226
def run
  copy_or_symlink_the_schema_xml_files(:be_verbose)
  run_glib_compile_schemas_command if @are_there_any_xml_files
end
run_glib_compile_schemas_command() click to toggle source
#

run_glib_compile_schemas_command

#
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 132
def run_glib_compile_schemas_command
  _ = "glib-compile-schemas #{FHS_TARGET_DIRECTORY_FOR_GLIB}"
  esystem _
end
set_input( i = DEFAULT_PROGRAM_NAME ) click to toggle source
#

set_input

#
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 109
def set_input(
    i = DEFAULT_PROGRAM_NAME
  )
  i = i.first if i.is_a? Array
  i = DEFAULT_PROGRAM_NAME if i.nil?
  i = i.to_s.dup
  if i.include? '/'
    i = File.basename(i)
  end
  i.capitalize!
  @input = i
end
upcased_program_name?()
Alias for: input?