Sha256: 2f2bcd93ec4b8938c60e176c55cc0fd22f8470a75eb84c64331d107fe80642ae

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

module Crystal
  module HTTP
    class << self
      inject :environment => :environment, :config => :config
      
      def ensure_public_symlink symlink_name, plugin_public_folder        
        plugin_public_folder = File.expand_path(plugin_public_folder)
        File.must.exist(plugin_public_folder)
                
        environment.must_be.defined                
        if environment.config.static? and !environment.config.test?        
          symlink_path = "#{config.root!}/public/#{symlink_name}"
          unless File.symlink?(symlink_path) and File.exist?(symlink_path)
            File.delete(symlink_path) if File.symlink?(symlink_path)
            File.symlink(plugin_public_folder, symlink_path)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crystal-0.0.13 lib/crystal/http/http.rb
crystal-0.0.12 lib/crystal/http/http.rb