Sha256: f291e0e1c261f1ffe73145fde7d23e7bc23e1d7f8fdb7aeeef275e0732f16751

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 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 :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

5 entries across 5 versions & 1 rubygems

Version Path
under_construction-0.1.3 lib/under_construction/config.rb
under_construction-0.1.2 lib/under_construction/config.rb
under_construction-0.1.1 lib/under_construction/config.rb
under_construction-0.1.0 lib/under_construction/config.rb
under_construction-0.0.1 lib/under_construction/config.rb