Sha256: 20950ad409dbd3a2f21bc505608c2157e61245e589a18b64ed165d17e684d264

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

require_relative 'standup_md/version'
require_relative 'standup_md/file'
require_relative 'standup_md/entry'
require_relative 'standup_md/entry_list'
require_relative 'standup_md/cli'
require_relative 'standup_md/config'

##
# The main module for the gem. Provides access to configuration classes.
module StandupMD
  @config_file_loaded = false

  ##
  # Method for accessing the configuration.
  #
  # @return [StanupMD::Cli]
  def self.config
    @config || reset_config
  end

  ##
  # Reset all configuration values to their defaults.
  #
  # @return [StandupMD::Config]
  def self.reset_config
    @config = StandupMD::Config.new
  end

  ##
  # Allows for configuration via a block. Useful when making config files.
  #
  # @example
  #   StandupMD.configure { |s| s.cli.editor = 'mate' }
  def self.configure
    yield config
  end

  ##
  # Has a config file been loaded?
  #
  # @return [Boolean]
  def self.config_file_loaded?
    @config_file_loaded
  end

  ##
  # Loads a config file.
  #
  # @param [String] file
  #
  # @return [String] file
  def self.load_config_file(file)
    ::File.expand_path(file).tap do |file|
      raise "File #{file} does not exist." unless ::File.file?(file)

      @config_file_loaded = true
      load file
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
standup_md-0.3.14 lib/standup_md.rb
standup_md-0.3.13 lib/standup_md.rb
standup_md-0.3.12 lib/standup_md.rb
standup_md-0.3.11 lib/standup_md.rb
standup_md-0.3.10 lib/standup_md.rb
standup_md-0.3.9 lib/standup_md.rb