Sha256: 7ef9d3f3e9e532c982b44675949194ca0d324671240b8cc8b9227a705203c190

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8
require 'sinatra/base'
require 'fileutils'

module Sinatra
  module Hexacta
    GEM_FILE_DIR = "sinatra-hexacta"

    def symlink(original_path, link_path)
      #p "Symlinking #{original_path} #{link_path}"
      File.symlink "#{Gem.loaded_specs["sinatra-hexacta"].gem_dir}#{original_path}", "#{link_path}" unless Gem.loaded_specs["sinatra-hexacta"].nil? || File.exist?("#{link_path}")
    end

    def symlink_all(original_path, link_path)
      Dir.foreach("#{Gem.loaded_specs["sinatra-hexacta"].gem_dir}#{original_path}") do |child|
        symlink("#{original_path}/#{child}","#{link_path}/#{child}") unless child == '.' || child == '..'
      end
    end

    def setup_dir(path)
      FileUtils.mkdir_p path unless Dir.exist? path
    end

    def copy_dir_structure(original_path, destination_path)
      FileUtils.remove_dir destination_path if Dir.exist? destination_path
      FileUtils.copy_entry("#{Gem.loaded_specs["sinatra-hexacta"].gem_dir}#{original_path}", destination_path)
    end
  end
end

require_relative 'helpers/init'
require_relative 'handlers/init'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinatra-hexacta-0.0.2 lib/sinatra/hexacta.rb
sinatra-hexacta-0.0.1 lib/sinatra/hexacta.rb