Module: Sinatra::Hexacta

Constant Summary collapse

GEM_FILE_DIR =
"sinatra-hexacta"

Instance Method Summary collapse

Instance Method Details

#copy_all_files(original_path, link_path) ⇒ Object



20
21
22
23
24
# File 'lib/sinatra/hexacta.rb', line 20

def copy_all_files(original_path, link_path)
  Dir.foreach("#{gem_path}#{original_path}") do |child|
    copy_file("#{original_path}/#{child}","#{link_path}/#{child}") unless child == '.' || child == '..'
  end
end

#copy_dir_structure(original_path, destination_path) ⇒ Object



30
31
32
# File 'lib/sinatra/hexacta.rb', line 30

def copy_dir_structure(original_path, destination_path)
  FileUtils.copy_entry("#{gem_path}#{original_path}", destination_path)
end

#copy_file(original_path, link_path) ⇒ Object



16
17
18
# File 'lib/sinatra/hexacta.rb', line 16

def copy_file(original_path, link_path)
  IO.copy_stream("#{gem_path}#{original_path}",link_path) unless File.exist?(link_path) && FileUtils.compare_file("#{gem_path}#{original_path}",link_path)
end

#gem_pathObject



12
13
14
# File 'lib/sinatra/hexacta.rb', line 12

def gem_path
  File.expand_path("../..",__dir__)
end

#setup_dir(path) ⇒ Object



26
27
28
# File 'lib/sinatra/hexacta.rb', line 26

def setup_dir(path)
  FileUtils.mkdir_p path
end