Module: Peridot::FileAccess

Includes:
FileUtils
Defined in:
lib/peridot/file_access.rb

Instance Method Summary collapse

Instance Method Details

#generate_file(source, target) ⇒ Object



7
8
9
10
11
12
# File 'lib/peridot/file_access.rb', line 7

def generate_file source, target
  puts "Generating #{target}"
  template = ERB.new File.read source
  template.filename = target
  File.open(target, 'w') { |f| f.write template.result(binding) }
end

#home_file(file) ⇒ Object



14
15
16
# File 'lib/peridot/file_access.rb', line 14

def home_file file
  File.join Dir.home, file
end


22
23
24
25
# File 'lib/peridot/file_access.rb', line 22

def link_file source, target
  rm_f target
  ln_s source, target
end

#repo_file(file) ⇒ Object



18
19
20
# File 'lib/peridot/file_access.rb', line 18

def repo_file file
  File.join Dir.pwd, file
end