Class: Revamp::Model::PuppetModule

Inherits:
Object
  • Object
show all
Defined in:
lib/revamp/model/puppet-module.rb

Overview

This class describes a puppet module

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePuppetModule

Returns a new instance of PuppetModule.



51
52
53
54
55
# File 'lib/revamp/model/puppet-module.rb', line 51

def initialize
  @files = {}
  @metadata = nil
  @dependencies = []
end

Class Attribute Details

.attributesObject (readonly)

Returns the value of attribute attributes.



36
37
38
# File 'lib/revamp/model/puppet-module.rb', line 36

def attributes
  @attributes
end

Instance Attribute Details

#filesObject

Returns the value of attribute files.



39
40
41
# File 'lib/revamp/model/puppet-module.rb', line 39

def files
  @files
end

#metadataObject

Returns the value of attribute metadata.



40
41
42
# File 'lib/revamp/model/puppet-module.rb', line 40

def 
  @metadata
end

#nameObject

Returns the value of attribute name.



41
42
43
# File 'lib/revamp/model/puppet-module.rb', line 41

def name
  @name
end

Class Method Details

.puppet_accessor(*vars) ⇒ Object



29
30
31
32
33
# File 'lib/revamp/model/puppet-module.rb', line 29

def self.puppet_accessor(*vars)
  @attributes ||= []
  @attributes.concat vars
  attr_accessor(*vars)
end

Instance Method Details

#add_file(path, content) ⇒ Object



57
58
59
# File 'lib/revamp/model/puppet-module.rb', line 57

def add_file(path, content)
  @files[path] = content
end

#attributesObject



61
62
63
# File 'lib/revamp/model/puppet-module.rb', line 61

def attributes
  self.class.attributes
end

#dependencies=(deps) ⇒ Object



65
66
67
68
69
70
# File 'lib/revamp/model/puppet-module.rb', line 65

def dependencies=(deps)
  @dependencies = []
  deps.each do |dep|
    @dependencies << Revamp::Model::PuppetDependency.new(dep)
  end
end

#rawnameObject



76
77
78
# File 'lib/revamp/model/puppet-module.rb', line 76

def rawname
  name.split('/')[-1]
end

#slugnameObject



72
73
74
# File 'lib/revamp/model/puppet-module.rb', line 72

def slugname
  Revamp::Mapper::PuppetNameSlugger.new.map(name)
end