class RBT::SymlinkGlibSchema

Constants

GLIB_SCHEMA_DIRECTORY
#

GLIB_SCHEMA_DIRECTORY

#

Public Class Methods

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

RBT::SymlinkGlibSchema[]

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

initialize

#
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 35
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(i)
  if block_given?
    yielded = yield
    case yielded # case tag
    # ===================================================================== #
    # === :do_not_report_when_anything_is_missing
    # ===================================================================== #
    when :do_not_report_when_anything_is_missing
      @report_when_anything_is_missing = false
    end
  end
  run if run_already
end

Public Instance Methods

consider_symlinking_all_found_xml_files() click to toggle source
#

consider_symlinking_all_found_xml_files

#
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 103
def consider_symlinking_all_found_xml_files
  _ = @xml_files
  if _.empty?
    if @report_when_anything_is_missing
      opne "#{rev}No #{royalblue('.xml')} #{rev}file found under "\
           "#{sfancy(input?)}#{rev}."
    end
  else
    # ===================================================================== #
    # Ok, we found at the least one .xml file, so symlink these.
    # ===================================================================== #
    opne "#{rev}At the least one .xml file was found, which will next be"
    opne "symlinked into the #{sdir(target?)} #7rev}hierarchy."
    _.each {|this_xml_file|
      new_target = "#{target?}#{File.basename(this_xml_file)}"
      if File.exist?(new_target) and File.file?(new_target)
        delete_file(new_target)
      end
      symlink(this_xml_file, new_target)
    }
    glib_compile_schemas
  end
end
glib_compile_schemas() click to toggle source
#

glib_compile_schemas

#
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 130
def glib_compile_schemas
  this_command = "glib-compile-schemas #{glib_schema_directory?}"
  system this_command
end
glib_schema_directory?() click to toggle source
#

glib_schema_directory?

#
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 96
def glib_schema_directory?
  GLIB_SCHEMA_DIRECTORY
end
Also aliased as: target?
input?() click to toggle source
#

input?

#
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 82
def input?
  @input
end
obtain_all_xml_files() click to toggle source
#

obtain_all_xml_files

#
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 89
def obtain_all_xml_files
  @xml_files = Dir["#{input?}*.xml"]
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 57
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @xml_files
  # ======================================================================= #
  @xml_files = []
  # ======================================================================= #
  # === @report_when_anything_is_missing
  # ======================================================================= #
  @report_when_anything_is_missing = true
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 138
def run
  obtain_all_xml_files
  consider_symlinking_all_found_xml_files
end
set_input(i = '') click to toggle source
#

set_input

#
# File lib/rbt/utility_scripts/symlink_glib_schema.rb, line 73
def set_input(i = '')
  i = i.first if i.is_a? Array
  i = i.to_s.dup
  @input = i
end
target?()