Sha256: 7d2b8cd5df4787c1c772b5c9ba9f38144364e30e1547c8b8c7aec4c0ec717ba9

Contents?: true

Size: 1.36 KB

Versions: 21

Compression:

Stored size: 1.36 KB

Contents

require "burp/engine"
require "mayi"
require "burp/version"

##
# All paths to directories are expected to end with a slash.
#
# Like this  +/home/darwin/+
#
module Burp
  
  @@content_directory = nil
  
  
  def self.find_page(path)
    page_model = Burp::PageModel.find(path)
    if page_model 
      Page.new(:snippets => page_model.snippets, :title => page_model.title)
    end
  end
  
  
  
  def self.access
    @@access ||= MayI::Access.new("Burp::Access")
  end
  
  

  ##
  # Returns the content directory to use.
  #
  def self.content_directory
    Thread.current[:thread_local_content_directory] || @@content_directory || Rails.root.join('app/cms/').to_s
  end
    
  ##
  # Runs the block with the content directory temporarly set to the supplied path
  #
  def self.with_content_directory(path,&block)
    self.thread_local_content_directory = path
    block.call
  ensure  
    self.thread_local_content_directory = nil
  end
  
  ##
  # Sets the content directory
  #
  def self.global_content_directory=(path)
    raise "#{path} does not end with '/'" unless path.end_with?('/')
    @@content_directory = path
  end
  
  ##
  # Sets the content directory for the current thread
  #
  def self.thread_local_content_directory=(path)
    raise "#{path} does not end with '/'" unless path.end_with?('/')
    Thread.current[:thread_local_content_directory] = path
  end
  
  
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
burp_cms-1.3.20 lib/burp_cms.rb
burp_cms-1.3.19 lib/burp_cms.rb
burp_cms-1.3.18 lib/burp_cms.rb
burp_cms-1.3.17 lib/burp_cms.rb
burp_cms-1.3.16 lib/burp_cms.rb
burp_cms-1.3.15 lib/burp_cms.rb
burp_cms-1.3.14 lib/burp_cms.rb
burp_cms-1.3.13 lib/burp_cms.rb
burp_cms-1.3.12 lib/burp_cms.rb
burp_cms-1.3.11 lib/burp_cms.rb
burp_cms-1.3.10 lib/burp_cms.rb
burp_cms-1.3.9 lib/burp_cms.rb
burp_cms-1.3.8 lib/burp_cms.rb
burp_cms-1.3.7 lib/burp_cms.rb
burp_cms-1.3.6 lib/burp_cms.rb
burp_cms-1.3.5 lib/burp_cms.rb
burp_cms-1.3.4 lib/burp_cms.rb
burp_cms-1.3.3 lib/burp_cms.rb
burp_cms-1.3.2 lib/burp_cms.rb
burp_cms-1.3.1 lib/burp_cms.rb