Class: Shutter::Files
Constant Summary
Constants included
from Content
Content::BASE_IPT, Content::CONFIG_FILES, Content::IFACE_DMZ, Content::IFACE_DMZ_MOCK, Content::IFACE_FORWARD, Content::IFACE_FORWARD_MOCK, Content::IP_ALLOW, Content::IP_ALLOW_MOCK, Content::IP_DENY, Content::IP_DENY_MOCK, Content::PORTS_PRIVATE, Content::PORTS_PRIVATE_MOCK, Content::PORTS_PUBLIC, Content::PORTS_PUBLIC_MOCK
Class Method Summary
collapse
Class Method Details
.create(dir, overwrite = false, except = []) ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/shutter/files.rb', line 7
def create(dir, overwrite=false, except=[])
CONFIG_FILES.each do |name|
file = "#{dir}/#{name}"
if !File.exists?(file) || overwrite || except.include?(name)
File.open(file, 'w') do |f|
f.write(const_get(name.upcase.gsub(/\./, "_")))
end
end
end
end
|
.create_config_dir(config_path) ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/shutter/files.rb', line 18
def create_config_dir(config_path)
unless File.directory?(config_path)
begin
Dir.mkdir(config_path)
rescue Errno::ENOENT
raise "Could not create the configuration directory. Check to see if the parent directory exists."
end
end
end
|