Module: StateMate::Adapters::SCUtil
- Defined in:
- lib/state_mate/adapters/scutil.rb
Overview
adapter to set global git config options
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.
Class Method Details
.read(key, options = {}) ⇒ String?
adapter API call that reads a value from scutil.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/state_mate/adapters/scutil.rb', line 29 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.
53 54 55 56 57 58 |
# File 'lib/state_mate/adapters/scutil.rb', line 53 def self.write key, value, = {} Cmds! "sudo scutil --set %{key} %{value}", key: key, value: value nil end |