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)


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

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

#commit_changes(dependency) ⇒ Object



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

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

#revert_changesObject



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

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