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



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

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



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

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



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

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



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

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

#setup_dir(path) ⇒ Object



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

def setup_dir(path)
  FileUtils.mkdir_p path
end