Class: CreateGithubRelease::Assertions::InRepoRootDirectory
- Inherits:
-
CreateGithubRelease::AssertionBase
- Object
- CreateGithubRelease::AssertionBase
- CreateGithubRelease::Assertions::InRepoRootDirectory
- Defined in:
- lib/create_github_release/assertions/in_repo_root_directory.rb
Overview
Assert that the current directory is the root of the repository
Checks both the local repository and the remote repository.
Instance Attribute Summary
Attributes inherited from CreateGithubRelease::AssertionBase
Instance Method Summary collapse
-
#assert
Make sure that the current directory is the root of the repository.
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.
Make sure that the current directory is the root of the repository
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/create_github_release/assertions/in_repo_root_directory.rb', line 35 def assert print "Checking that you are in the repo's root directory..." toplevel_directory = `git rev-parse --show-toplevel`.chomp error "git rev-parse failed: #{$CHILD_STATUS.exitstatus}" unless $CHILD_STATUS.success? if toplevel_directory == FileUtils.pwd puts 'OK' else error "You are not in the repo's root directory" end end |