Sha256: f8b1c1182510492bb470449faa2244532945822dfdbbceb11d6cf5dd2dee8eb3

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

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

module Sinatra

  module Hexacta
    GEM_FILE_DIR = "sinatra-hexacta"

    def symlink(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 unless Gem.loaded_specs["sinatra-hexacta"].nil?
    end

    def setup_dir(path)
      unless Gem.loaded_specs["sinatra-hexacta"].nil?
        FileUtils.remove_dir path if Dir.exist? path
        FileUtils.mkdir_p path
      end
    end

    def copy_dir_structure(original_path, destination_path)
      unless Gem.loaded_specs["sinatra-hexacta"].nil?
        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
end

unless Gem.loaded_specs["sinatra-hexacta"].nil?
  FileUtils.remove_dir "/app/views/sinatra-hexacta" if Dir.exist? "/app/views/sinatra-hexacta"
  FileUtils.remove_dir "/app/public/sinatra-hexacta" if Dir.exist? "/app/public/sinatra-hexacta"
end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra-hexacta-0.3.0 lib/sinatra/hexacta.rb