Sha256: d1f818d7884b630fccec0caba5f6dd53d437c62aaaeca2c0f285250a933b0f09

Contents?: true

Size: 894 Bytes

Versions: 7

Compression:

Stored size: 894 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'
    }

    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

7 entries across 7 versions & 1 rubygems

Version Path
rgitflow-0.2.0.pre.alpha.pre.21 lib/rgitflow/config.rb
rgitflow-0.2.0.pre.alpha.pre.20 lib/rgitflow/config.rb
rgitflow-0.1.0 lib/rgitflow/config.rb
rgitflow-0.1.0.pre.alpha.pre.18 lib/rgitflow/config.rb
rgitflow-0.1.0.pre.alpha.pre.17 lib/rgitflow/config.rb
rgitflow-0.1.0.pre.alpha.pre.16 lib/rgitflow/config.rb
rgitflow-0.1.0.pre.alpha.pre.15 lib/rgitflow/config.rb