class RepoMate::Repository

Class for creating the repository structure

Attributes

categories[R]

Public Class Methods

new() click to toggle source

Init

# File lib/repomate/repository.rb, line 10
def initialize
  @categories = ["dists", "pool", "stage"]
end

Public Instance Methods

create(suitename=nil, component=nil, architecture=nil) click to toggle source

Creates the base structure

# File lib/repomate/repository.rb, line 15
def create(suitename=nil, component=nil, architecture=nil)
  unless Suite.allowed.include?(suitename)
    STDERR.puts "Suitename (#{suitename}) is not configured"
    exit 1
  end

  unless Component.allowed.include?(component)
    STDERR.puts "Component (#{component}) is not configured"
    exit 1
  end

  unless architecture.nil?
    unless Architecture.allowed.include?(architecture)
      STDERR.puts "Architecture (#{architecture}) is not configured"
      exit 1
    end
  end

  @categories.each do |category|
    if category.eql?("stage")
      Component.new(component, suitename, category).create
    else
      if architecture && component && suitename
        Architecture.new(architecture, component, suitename, category).create
      elsif component && suitename
        Component.new(component, suitename, category).create
      elsif suitename.nil?
        Suite.new(suitename, category).create
      end
    end
  end
end