class RepoMate::Suite
Class for the suite layer of the directory structure
Public Class Methods
all()
click to toggle source
Returns all directories without @rootdir
# File lib/repomate/suite.rb, line 76 def self.all categories = Category.all dirs = [] rootdir = Cfg.rootdir categories.each do |category| suites = Dir.glob(File.join(rootdir, category, "*")) suites.each do |suite| dirs.push suite.gsub(/#{rootdir}\//, '') if File.directory? suite end end return dirs end
allowed()
click to toggle source
Gets all configured architectures
# File lib/repomate/suite.rb, line 90 def self.allowed Cfg.suites.uniq end
dataset(category=nil)
click to toggle source
Returns a dataset including the name of the suite, the fullpath recursive through all lower layers
# File lib/repomate/suite.rb, line 57 def self.dataset(category=nil) data = [] self.all.each do |entry| # p entry parts = entry.split(/\//) unless parts.length < 2 next unless parts[0].eql?(category) || category.eql?("all") data << { :category => parts[0], :suitename => parts[1], :fullpath => File.join(Cfg.rootdir, entry), } end end data end
new(suitename, category)
click to toggle source
Init
# File lib/repomate/suite.rb, line 8 def initialize(suitename, category) @suitename = suitename @category = category end
Public Instance Methods
create()
click to toggle source
Creates the directory strcuture of the suite including all lower layers
# File lib/repomate/suite.rb, line 47 def create FileUtils.mkdir_p(directory) unless exist? end
destroy()
click to toggle source
Deletes the suites directory including all lower layers
# File lib/repomate/suite.rb, line 52 def destroy FileUtils.rm_r(directory) if exist? end
directory()
click to toggle source
Returns the directory strcuture of the suite including all lower layers
# File lib/repomate/suite.rb, line 19 def directory File.join(Cfg.rootdir, @category, @suitename) end
exist?()
click to toggle source
Checks if the suite directory exists
# File lib/repomate/suite.rb, line 24 def exist? Dir.exist?(directory) end
is_allowed?()
click to toggle source
Checks if the suite is allowed (See: configurationfile)
# File lib/repomate/suite.rb, line 29 def is_allowed? self.allowed.include?(@suitename) end
is_unused?(dir)
click to toggle source
Checks if directory is unused
# File lib/repomate/suite.rb, line 34 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 suite name (eg. lenny, squeeze)
# File lib/repomate/suite.rb, line 14 def name @suitename end