Sha256: 0c1714963456bce30a5044cf06eb4008aa09d7601fd5afd78648399c818c008d

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

require "coffee-rails"
require "sass-rails"
require "jquery-rails"
require 'haml'
require 'bcrypt'
require 'dynamic_form'
require 'kaminari'
require 'ransack'

require 'nifty/utils'
require 'nifty/key_value_store'
require 'nifty/attachments'
require 'nifty/dialog'

module Shoppe
  
  class Error < StandardError
    # The Shoppe::Error is the base class for all errors raised by Shoppe.
  end
  
  class << self
    
    # The path to the root of the Shoppe applicatinio
    #
    # @return [String]
    def root
      File.expand_path('../../', __FILE__)
    end
    
    # Shoppe settings as configured in the database
    #
    # @return [Shoppe::Settings]
    def settings
      Thread.current[:shoppe_settings] ||= Shoppe::Settings.new(Shoppe::Setting.to_hash)
    end
    
    # Clears the settings from the thread cache so they will be taken
    # from the database on next access
    # 
    # @return [NilClass]
    def reset_settings
      Thread.current[:shoppe_settings] = nil
    end
    
    # Defines a new set of settings which should be configrable from the settings page 
    # in the Shoppe UI.
    def add_settings_group(group, fields = [])
      settings_groups[group]  ||= []
      settings_groups[group]    = settings_groups[group] | fields
    end
    
    # All settings groups which are available for configuration on the settings page.
    #
    # @return [Hash]
    def settings_groups
      @settings_groups ||= {}
    end
    
  end
  
end

# Start your engines.
require "shoppe/engine"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoppe-0.0.18 lib/shoppe.rb
shoppe-0.0.17 lib/shoppe.rb