Class: RepoMate::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/repomate/repository.rb

Overview

Class for creating the repository structure

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRepository

Init



10
11
12
# File 'lib/repomate/repository.rb', line 10

def initialize
  @categories = ["dists", "pool", "stage"]
end

Instance Attribute Details

#categoriesObject (readonly)

Returns the value of attribute categories.



7
8
9
# File 'lib/repomate/repository.rb', line 7

def categories
  @categories
end

Instance Method Details

#create(suitename = nil, component = nil, architecture = nil) ⇒ Object

Creates the base structure



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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