Class: CreateGithubRelease::Assertions::OnDefaultBranch
- Inherits:
-
CreateGithubRelease::AssertionBase
- Object
- CreateGithubRelease::AssertionBase
- CreateGithubRelease::Assertions::OnDefaultBranch
- Defined in:
- lib/create_github_release/assertions/on_default_branch.rb
Overview
Assert that the default branch is checked out
Checks both the local repository and the remote repository.
Instance Attribute Summary
Attributes inherited from CreateGithubRelease::AssertionBase
Instance Method Summary collapse
-
#assert
Assert that the default branch is checked out.
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 the default branch is checked out
34 35 36 37 38 39 40 41 42 |
# File 'lib/create_github_release/assertions/on_default_branch.rb', line 34 def assert print 'Checking that you are on the default branch...' current_branch = `git branch --show-current`.chomp if current_branch == project.default_branch puts 'OK' else error "You are not on the default branch '#{project.default_branch}'" end end |