Sha256: aaef809d17a9aa568af0f6603b32d8bf3b7fbc1774e490e60810ab54725580b6

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 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 Tienda
  class << self

    # The path to the root of the Tienda applicatinio
    #
    # @return [String]
    def root
      File.expand_path('../../', __FILE__)
    end

    # Tienda settings as configured in the database
    #
    # @return [Tienda::Settings]
    def settings
      Thread.current[:tienda_settings] ||= Tienda::Settings.new(Tienda::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[:tienda_settings] = nil
    end

    # Defines a new set of settings which should be configrable from the settings page
    # in the Tienda 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 'tienda/engine'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tienda-1.1.2 lib/tienda.rb
tienda-1.1.1 lib/tienda.rb
tienda-1.1.0 lib/tienda.rb