Class: CreateGithubRelease::Assertions::NoUncommittedChanges
- Inherits:
-
CreateGithubRelease::AssertionBase
- Object
- CreateGithubRelease::AssertionBase
- CreateGithubRelease::Assertions::NoUncommittedChanges
- Defined in:
- lib/create_github_release/assertions/no_uncommitted_changes.rb
Overview
Assert that there are no uncommitted changes in the local working copy
Checks both the local repository and the remote repository.
Instance Attribute Summary
Attributes inherited from CreateGithubRelease::AssertionBase
Instance Method Summary collapse
-
#assert
Assert that there are no uncommitted changes in the local working copy.
Methods inherited from CreateGithubRelease::AssertionBase
#backtick_debug?, #error, #initialize, #print, #puts
Methods included from BacktickDebug
Constructor Details
This class inherits a constructor from CreateGithubRelease::AssertionBase
Instance Method Details
#assert
This method returns an undefined value.
Assert that there are no uncommitted changes in the local working copy
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/create_github_release/assertions/no_uncommitted_changes.rb', line 34 def assert print 'Checking that there are no uncommitted changes...' change_count = `git status --porcelain | wc -l`.to_i error "git status command failed: #{$CHILD_STATUS.exitstatus}" unless $CHILD_STATUS.success? if change_count.zero? puts 'OK' else error 'There are uncommitted changes' end end |