Sha256: c2cb84374642d88aa941a9f1f825984c45319930cefac1b89d798fe37c4c137a

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

LIBDIR = File.dirname(__FILE__)

local_helpers = File.join(Dir.pwd, 'helpers.rb')
require local_helpers[0..-4] if File.exists? local_helpers

module Frank
  class TemplateError < StandardError; end
  class ConfigError < StandardError; end
end

require 'rubygems'
require 'yaml'
require 'fileutils'
require 'rack'
require 'frank/version'
require 'frank/settings'
require 'frank/base'
require 'frank/compile'
require 'frank/publish'
require 'frank/cli'

# relay
module Frank

  # Quickly configure Frank settings. Best used by passing a block.
  #
  # Example:
  #
  #   Frank.configure do |settings|
  #     settings.server.handler = "mongrel"
  #     settings.server.hostname = "0.0.0.0"
  #     settings.server.port = "3601"
  #
  #     settings.static_folder = "static"
  #     settings.dynamic_folder = "dynamic"
  #     settings.layouts_folder = "layouts"
  #   end
  #
  # Returns:
  #
  # The Frank +Settings+ singleton instance.
  class << self
    def configure
      settings = Frank::Settings.instance
      block_given? ? yield(settings) : settings
    end
  end

  # Take all the public instance methods from the Settings singleton and allow
  # them to be accessed through the Frank module directly.
  #
  # Examples:
  #
  # <tt>Frank.server.hander #=> "mongrel"</tt>
  # <tt>Frank.static_folder #=> "static"</tt>
  Frank::Settings.public_instance_methods(false).each do |name|
    (class << self; self; end).class_eval <<-EOT
      def #{name}(*args)
        configure.send("#{name}", *args)
      end
    EOT
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frank-1.0.12 lib/frank.rb
frank-1.0.11 lib/frank.rb