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



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

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



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

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



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

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



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

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

#setup_dir(path) ⇒ Object



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

def setup_dir(path)
  FileUtils.mkdir_p path
end