Module: StateMate::Adapters::SCUtil
- Includes:
- StateMate::Adapters
- Defined in:
- lib/state_mate/adapters/scutil.rb
Overview
adapter to set global git config options
Constant Summary
Constants included from StateMate::Adapters
API_METHOD_NAMES, DEFAULT_KEY_SEP
Class Method Summary collapse
-
.read(key, options = {}) ⇒ String?
adapter API call that reads a value from scutil.
-
.write(key, value, options = {}) ⇒ Object
adapter API call that writes a value to the git global config.
Methods included from StateMate::Adapters
Class Method Details
.read(key, options = {}) ⇒ String?
adapter API call that reads a value from scutil.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/state_mate/adapters/scutil.rb', line 30 def self.read key, = {} result = Cmds "scutil --get %{key}", key: key if result.ok? result.out.chomp else if result.err.match /^#{ key }\:\ not set/ nil else result.assert end end end |
.write(key, value, options = {}) ⇒ Object
adapter API call that writes a value to the git global config.
54 55 56 57 58 59 |
# File 'lib/state_mate/adapters/scutil.rb', line 54 def self.write key, value, = {} Cmds! "sudo scutil --set %{key} %{value}", key: key, value: value nil end |