class RepoMate::Architecture
Class for the architecture layer of the directory structure
Public Class Methods
all()
click to toggle source
Returns all directories without @rootdir
# File lib/repomate/architecture.rb, line 85 def self.all components = Component.all dirs = [] rootdir = Cfg.rootdir components.each do |component| architectures = Dir.glob(File.join(rootdir, component, "*")) architectures.each do |architecture| dirs.push architecture.gsub(/#{rootdir}\//, '') if File.directory? architecture end end return dirs end
allowed()
click to toggle source
Gets all configured architectures
# File lib/repomate/architecture.rb, line 99 def self.allowed Cfg.architectures.uniq end
dataset(category=nil)
click to toggle source
Returns a dataset including the name of the architecture and the fullpath recursive through all lower layers
# File lib/repomate/architecture.rb, line 64 def self.dataset(category=nil) data = [] self.all.each do |entry| parts = entry.split(/\//) unless parts.length < 4 next unless parts[0].eql?(category) || category.eql?("all") architecture = parts[3].split(/-/) data << { :category => parts[0], :suitename => parts[1], :component => parts[2], :architecture_dir => parts[3], :architecture => architecture[1], :fullpath => File.join(Cfg.rootdir, entry) } end end data end
new(architecture, component, suitename, category)
click to toggle source
Init
# File lib/repomate/architecture.rb, line 8 def initialize(architecture, component, suitename, category) @architecture = architecture @component = component @suitename = suitename @category = category end
Public Instance Methods
create()
click to toggle source
Creates the directory strcuture of the architecture including all lower layers
# File lib/repomate/architecture.rb, line 49 def create FileUtils.mkdir_p(directory) unless exist? end
destroy()
click to toggle source
Deletes the architecture directory including all lower layers
# File lib/repomate/architecture.rb, line 54 def destroy FileUtils.rm_r(directory) if exist? end
directory()
click to toggle source
Returns the directory strcuture of the architecture including all lower layers
# File lib/repomate/architecture.rb, line 21 def directory File.join(Cfg.rootdir, @category, @suitename, @component, "binary-#{name}") end
exist?()
click to toggle source
Checks if the architecture directory exists
# File lib/repomate/architecture.rb, line 26 def exist? Dir.exist?(directory) end
files()
click to toggle source
Returns a list of all debian files in the architecture directory
# File lib/repomate/architecture.rb, line 59 def files Dir.glob(File.join(directory, "*.deb")) end
is_allowed?()
click to toggle source
Checks if the architecture is allowed (See: configurationfile)
# File lib/repomate/architecture.rb, line 31 def is_allowed? self.allowed.include?(@architecture) end
is_unused?(dir)
click to toggle source
Checks if directory is unused
# File lib/repomate/architecture.rb, line 36 def is_unused?(dir) status = true path = Dir.glob(File.join(dir, "*")) path.each do |dirorfile| status = false if File.directory?(dirorfile) status = false if File.basename(dirorfile) =~ /\.deb$/ end status end
name()
click to toggle source
Returns the given architecture name (eg. all, amd64)
# File lib/repomate/architecture.rb, line 16 def name @architecture end