Sha256: 430936df021e4fa8f4adcbf335ce7f9f5df60c53af43ce18405f1f055127104a

Contents?: true

Size: 917 Bytes

Versions: 9

Compression:

Stored size: 917 Bytes

Contents

module RGitFlow
  class Config
    class << self
      attr_accessor :options
    end

    CONFIG_DIR = Dir.pwd

    CONFIG_FILE = File.expand_path(CONFIG_DIR, '.rgitflow')

    DEFAULT_OPTIONS = {
        :master => 'master',
        :develop => 'develop',
        :feature => 'feature',
        :hotfix => 'hotfix',
        :release => 'release',
        :tag => 'v%s'
    }

    def self.load
      self.options = SymbolHash.new false
      options.update DEFAULT_OPTIONS
      options.update read_config_file
    end

    def self.save
      require 'yaml'
      Dir.mkdir(CONFIG_DIR) unless File.directory?(CONFIG_DIR)
      File.open(CONFIG_FILE, 'w') {|f| f.write(YAML.dump(options)) }
    end

    def self.read_config_file
      if File.file?(CONFIG_FILE)
        require 'yaml'
        YAML.load_file(CONFIG_FILE)
      else
        {}
      end
    end
  end

  Config.options = Config::DEFAULT_OPTIONS
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rgitflow-0.2.2 lib/rgitflow/config.rb
rgitflow-0.2.1.pre.alpha.pre.32 lib/rgitflow/config.rb
rgitflow-0.2.1.pre.alpha.pre.28 lib/rgitflow/config.rb
rgitflow-0.2.0.pre.alpha.pre.27 lib/rgitflow/config.rb
rgitflow-0.2.0.pre.alpha.pre.26 lib/rgitflow/config.rb
rgitflow-0.2.0.pre.alpha.pre.25 lib/rgitflow/config.rb
rgitflow-0.2.0 lib/rgitflow/config.rb
rgitflow-0.2.0.pre.alpha.pre.23 lib/rgitflow/config.rb
rgitflow-0.2.0.pre.alpha.pre.22 lib/rgitflow/config.rb