class RBT::InstallGlibSchema
Constants
- COPY_THE_SCHEMA_FILES_OR_SYMLINK_THE_SCHEMA_FILES
#¶ ↑
COPY_THE_SCHEMA_FILES_OR_SYMLINK_THE_SCHEMA_FILES
¶ ↑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
#¶ ↑
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
#¶ ↑
copy_or_symlink_the_schema_xml_files
¶ ↑
This method will copy the relative .gschema.xml files. We will also symlink enums.xml files though, because that is required e. g. for the program “epiphany”.
The optional argument is, as the name implies, optional. If it is given and of the Symbol :be_verbose, then we will also notify the user about what we will be doing next.
#¶ ↑
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 181 def copy_or_symlink_the_schema_xml_files( optional_argument = nil ) target_dir = appdir_schema_directory? all_xml_files = Dir["#{target_dir}*.xml"] gscheme_file = target_dir+'gschema.dtd' # ======================================================================= # # The next line is, sort of, an exception for glib itself. # ======================================================================= # if File.exist? gscheme_file all_xml_files << gscheme_file end # ======================================================================= # # We only copy .xml files if they actually do happen to exist. # ======================================================================= # unless all_xml_files.empty? @are_there_any_xml_files = true if optional_argument case optional_argument when :be_verbose opnn; e "We will next #{sfancy(copy_or_symlink)} all .xml "\ "files from `#{sdir(target_dir)}`." opnn; e 'into `'+sdir(FHS_TARGET_DIRECTORY_FOR_GLIB)+'`.' end end # ===================================================================== # # Obtain all .xml files next. # ===================================================================== # all_xml_files.each {|this_schema_file| new_target_file = FHS_TARGET_DIRECTORY_FOR_GLIB+File.basename(this_schema_file) # =================================================================== # # Delete the target file if we are in "symlink mode". # =================================================================== # delete(new_target_file) if symlink_mode? copy_or_symlink_this_file( this_schema_file, new_target_file ) } end end
#¶ ↑
input?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/install_glib_schema.rb, line 125 def input? @input end
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
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