Sha256: 23026257018db079a1df6cdaa55ecfa59c06d0c5d9d72e3ddebfa617c3a06492

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'active_support/configurable'
require 'yaml'

module UnderConstruction
  def self.configure(&block)
    yield @config ||= UnderConstruction::Configuration.new
  end

  def self.config
    @config
  end

  def self.config_file
    config_path = File.join(Rails.root, 'config','under_construction.yml')
    if File.exist? File.join(Rails.root, 'config','under_construction.yml')
      YAML.load_file(config_path)
    else
      false
    end
  end

  class Configuration
    include ActiveSupport::Configurable

    config_accessor :theme
    config_accessor :launch_time
    config_accessor :time_zone
    config_accessor :host_name
    config_accessor :progress
    config_accessor :progress_label
    config_accessor :info
    config_accessor :site_developer
    config_accessor :socials_title
    config_accessor :socials
    config_accessor :notify_mail
    config_accessor :website_address
  end

  if config_file
    configure do |configuration|
      config_file.each_pair do |key, value|
        configuration.config[key.to_sym] = value
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
under_construction-0.2.2 lib/under_construction/config.rb
under_construction-0.2.1 lib/under_construction/config.rb
under_construction-0.1.4 lib/under_construction/config.rb