Class: KeepUp::VersionControl

Inherits:
Object
  • Object
show all
Defined in:
lib/keep_up/version_control.rb

Overview

Interface to the version control system (only Git is supported).

Instance Method Summary collapse

Constructor Details

#initialize(runner:) ⇒ VersionControl

Returns a new instance of VersionControl.



6
7
8
# File 'lib/keep_up/version_control.rb', line 6

def initialize(runner:)
  @runner = runner
end

Instance Method Details

#clean?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/keep_up/version_control.rb', line 18

def clean?
  @runner.run("git status -s") == ""
end

#commit_changes(dependency) ⇒ Object



10
11
12
# File 'lib/keep_up/version_control.rb', line 10

def commit_changes(dependency)
  @runner.run "git commit -am 'Auto-update #{dependency.name} to #{dependency.version}'"
end

#revert_changesObject



14
15
16
# File 'lib/keep_up/version_control.rb', line 14

def revert_changes
  @runner.run "git reset --hard"
end