Sha256: dfe7ba3d1dea57b7275b0ce8cb3e2f02311a3adfb5308570bb1acf7d6f118607

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

require 'merb-helpers'

# Make sure we're running inside Merb.
if defined?(Merb::Plugins)
  kin = File.expand_path(File.join(File.dirname(__FILE__), 'kin'))

  require File.join(kin, 'core_ext', 'date')
  require File.join(kin, 'core_ext', 'string')
  require File.join(kin, 'core_ext', 'time')

  require File.join(kin, 'configurable')
  require File.join(kin, 'form_builder')
  require File.join(kin, 'masthead')
  require File.join(kin, 'nav')

  Merb::Plugins.add_rakefiles(File.join(kin, 'tasks', 'sync_assets'))
  Merb::Plugins.add_rakefiles(File.join(kin, 'tasks', 'sprites'))

  # Default nav formatter. Can be overridden in an after_app_loads block, or
  # on a case-by-case basis in +display_navigation+.
  Merb::Plugins.config[:kin] = {
    :nav_formatter => Kin::Nav::Formatters::Basic
  }

  Merb::BootLoader.after_app_loads do
    # Add default time formats.
    unless Time.formats.include?(:full)
      Time.add_format(:full, '%A %d %B, %H:%M')
    end

    unless Time.formats.include?(:date_only)
      Time.add_format(:date_only, '%A %d %B')
    end

    unless Time.formats.include?(:date_with_year)
      Time.add_format(:date_with_year, '%d %B %Y')
    end

    # After the application loads, see if there is a config/navigation.rb file
    # to initialize the nav instances.
    nav_rb = File.join(Merb.dir_for(:config), 'navigation.rb')
    load(nav_rb) if File.exists?(nav_rb)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
antw-kin-0.3.3 lib/kin.rb
antw-kin-0.4.0 lib/kin.rb
antw-kin-0.4.1 lib/kin.rb