Class: ConsulKvBackup::Git
- Inherits:
-
Object
- Object
- ConsulKvBackup::Git
- Includes:
- FlazmRubyHelpers::Class
- Defined in:
- lib/consul_kv_backup/git.rb
Overview
Consul storage for previous watch data
Instance Method Summary collapse
-
#initialize(git_config) ⇒ Git
constructor
A new instance of Git.
- #process_data(data) ⇒ Object
Constructor Details
#initialize(git_config) ⇒ Git
12 13 14 15 |
# File 'lib/consul_kv_backup/git.rb', line 12 def initialize(git_config) initialize_variables(git_config) git_setup end |
Instance Method Details
#process_data(data) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/consul_kv_backup/git.rb', line 17 def process_data(data) path = data['key_path'] value = data['value'] dc = data['consul_dc'] git_set_branch(dc) if data['old_value'] and !data['new_value'] git_rm(path) else git_add(path, value) end git_push if @git_push end |