Class: Binpkgbot::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/binpkgbot/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc = {}) ⇒ Config

Returns a new instance of Config.



15
16
17
# File 'lib/binpkgbot/config.rb', line 15

def initialize(doc={})
  @doc = Utils.symbolize_keys(doc)
end

Class Method Details

.from_yaml(yaml) ⇒ Object



7
8
9
# File 'lib/binpkgbot/config.rb', line 7

def self.from_yaml(yaml)
  new(YAML.load(yaml))
end

.load_yaml(path) ⇒ Object



11
12
13
# File 'lib/binpkgbot/config.rb', line 11

def self.load_yaml(path)
  new(YAML.load_file(path))
end

Instance Method Details

#bindsObject



35
36
37
# File 'lib/binpkgbot/config.rb', line 35

def binds
  @doc[:binds]
end

#config_protect_maskObject



49
50
51
# File 'lib/binpkgbot/config.rb', line 49

def config_protect_mask
  @doc[:config_protect_mask]
end

#config_protect_mask?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/binpkgbot/config.rb', line 45

def config_protect_mask?
  @doc.key?(:config_protect_mask)
end

#emerge_optionsObject



31
32
33
# File 'lib/binpkgbot/config.rb', line 31

def emerge_options
  @doc[:emerge_options]
end

#etc_portageObject



23
24
25
# File 'lib/binpkgbot/config.rb', line 23

def etc_portage
  @doc[:etc_portage]
end

#portage_repoObject



27
28
29
# File 'lib/binpkgbot/config.rb', line 27

def portage_repo
  @doc[:portage_repo]
end

#stageObject



19
20
21
# File 'lib/binpkgbot/config.rb', line 19

def stage
  @doc[:stage]
end

#tasksObject



39
40
41
42
43
# File 'lib/binpkgbot/config.rb', line 39

def tasks
  (@doc[:tasks] || []).map do |defi|
    Tasks.from_definition(defi, config: self)
  end
end

#use_sudo_for_nspawn?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/binpkgbot/config.rb', line 53

def use_sudo_for_nspawn?
  @doc.fetch(:use_sudo_for_nspawn, false)
end