Module: RQR::HookScriptAPI

Included in:
Installer
Defined in:
lib/rqr.rb

Overview

This module requires: #srcdir_root, #objdir_root, #relpath

Instance Method Summary collapse

Instance Method Details

#curr_objdirObject



712
713
714
# File 'lib/rqr.rb', line 712

def curr_objdir
  "#{objdir_root()}/#{relpath()}"
end

#curr_srcdirObject

srcdir/objdir (works only in the package directory)



708
709
710
# File 'lib/rqr.rb', line 708

def curr_srcdir
  "#{srcdir_root()}/#{relpath()}"
end

#get_config(key) ⇒ Object Also known as: config



693
694
695
# File 'lib/rqr.rb', line 693

def get_config(key)
  @config[key]
end

#set_config(key, val) ⇒ Object

obsolete: use metaconfig to change configuration



700
701
702
# File 'lib/rqr.rb', line 700

def set_config(key, val)
  @config[key] = val
end

#srcdirectories(path = '.') ⇒ Object



744
745
746
747
748
# File 'lib/rqr.rb', line 744

def srcdirectories(path = '.')
  srcentries(path).select {|fname|
    File.dir?(File.join(curr_srcdir(), path, fname))
  }
end

#srcdirectory?(path) ⇒ Boolean

Returns:

  • (Boolean)


724
725
726
# File 'lib/rqr.rb', line 724

def srcdirectory?(path)
  File.dir?(srcfile(path))
end

#srcentries(path = '.') ⇒ Object



732
733
734
735
736
# File 'lib/rqr.rb', line 732

def srcentries(path = '.')
  Dir.open("#{curr_srcdir()}/#{path}") {|d|
    return d.to_a - %w(. ..)
  }
end

#srcexist?(path) ⇒ Boolean

Returns:

  • (Boolean)


720
721
722
# File 'lib/rqr.rb', line 720

def srcexist?(path)
  File.exist?(srcfile(path))
end

#srcfile(path) ⇒ Object



716
717
718
# File 'lib/rqr.rb', line 716

def srcfile(path)
  "#{curr_srcdir()}/#{path}"
end

#srcfile?(path) ⇒ Boolean

Returns:

  • (Boolean)


728
729
730
# File 'lib/rqr.rb', line 728

def srcfile?(path)
  File.file?(srcfile(path))
end

#srcfiles(path = '.') ⇒ Object



738
739
740
741
742
# File 'lib/rqr.rb', line 738

def srcfiles(path = '.')
  srcentries(path).select {|fname|
    File.file?(File.join(curr_srcdir(), path, fname))
  }
end