Sha256: 9dbdae6d2da8dc5761879568ef6bd9e6d98bb006dd77be6457d74fbc0987f096

Contents?: true

Size: 687 Bytes

Versions: 3

Compression:

Stored size: 687 Bytes

Contents

module GitReflow
  module Config
    extend self

    def get(key)
      if cached_key_value = instance_variable_get(:"@#{key.tr('.-', '_')}")
        cached_key_value
      else
        new_value = GitReflow::Sandbox.run "git config --get #{key}", loud: false
        instance_variable_set(:"@#{key.tr('.-', '_')}", new_value)
      end
    end

    def set(key, value, options = { local: false })
      value = value.strip
      if options.delete(:local)
        GitReflow::Sandbox.run "git config --replace-all #{key} \"#{value}\"", loud: false
      else
        GitReflow::Sandbox.run "git config --global --replace-all #{key} \"#{value}\"", loud: false
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
git_reflow-0.4.2 lib/git_reflow/config.rb
git_reflow-0.4.1 lib/git_reflow/config.rb
git_reflow-0.4.0 lib/git_reflow/config.rb