Class: VambooFile

Inherits:
Object
  • Object
show all
Defined in:
lib/vamboo/vamboofile.rb

Constant Summary collapse

Vamboofile =
"Vamboofile"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vamboo_home) ⇒ VambooFile

Returns a new instance of VambooFile.



13
14
15
# File 'lib/vamboo/vamboofile.rb', line 13

def initialize(vamboo_home)
	@vamboo_home = vamboo_home
end

Instance Attribute Details

#vamboo_homeObject (readonly)

Returns the value of attribute vamboo_home.



3
4
5
# File 'lib/vamboo/vamboofile.rb', line 3

def vamboo_home
  @vamboo_home
end

Class Method Details

.createAt(vamboo_home) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/vamboo/vamboofile.rb', line 5

def self.createAt(vamboo_home)
  	FileUtils.mkdir_p(vamboo_home)
  	if File.exist?("#{vamboo_home}/#{Vamboofile}")
  		return
  	end
  	FileUtils.copy("#{File.dirname(__FILE__)}/#{Vamboofile}.org", "#{vamboo_home}/#{Vamboofile}")
end

Instance Method Details

#loadDomainsObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vamboo/vamboofile.rb', line 17

def loadDomains
	domains = eval(File.read("#{@vamboo_home}/#{Vamboofile}"))
	domains.each do |domain|
		unless domain.isDefined?
			raise "#{domain.name} is not defined!!"
		end
		unless domain.vmhdIsExist?
			raise "#{domain.name}'s vmhd is not exist!!"
		end
	end
	domains
end