-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
400 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
lib/create_github_release/assertions/local_and_remote_on_same_commit.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
lib/create_github_release/assertions/local_release_branch_does_not_exist.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'English' | ||
require 'create_github_release/assertion_base' | ||
|
||
module CreateGithubRelease | ||
module Assertions | ||
# Assert that the release branch does not exist in the local repository | ||
# | ||
# @api public | ||
# | ||
class LocalReleaseBranchDoesNotExist < AssertionBase | ||
# Assert that the release branch does not exist in the local repository | ||
# | ||
# @example | ||
# require 'create_github_release' | ||
# | ||
# options = CreateGithubRelease::Options.new { |o| o.release_type = 'major' } | ||
# assertion = CreateGithubRelease::Assertions::LocalReleaseBranchDoesNotExist.new(options) | ||
# begin | ||
# assertion.assert | ||
# puts 'Assertion passed' | ||
# rescue SystemExit | ||
# puts 'Assertion failed' | ||
# end | ||
# | ||
# @return [void] | ||
# | ||
# @raise [SystemExit] if the assertion fails | ||
# | ||
def assert | ||
print "Checking that local branch ' #{options.branch}' does not exist..." | ||
|
||
if `git branch --list '#{options.branch}' | wc -l`.to_i.zero? && $CHILD_STATUS.success? | ||
puts 'OK' | ||
else | ||
error 'Could not list branches' unless $CHILD_STATUS.success? | ||
error "'#{options.branch}' already exists." | ||
end | ||
end | ||
end | ||
end | ||
end |
45 changes: 45 additions & 0 deletions
45
lib/create_github_release/assertions/local_release_tag_does_not_exist.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'English' | ||
require 'create_github_release/assertion_base' | ||
|
||
module CreateGithubRelease | ||
module Assertions | ||
# Assert that the release tag does not exist in the local repository | ||
# | ||
# @api public | ||
# | ||
class LocalReleaseTagDoesNotExist < AssertionBase | ||
# Assert that the release tag does not exist in the local repository | ||
# | ||
# @example | ||
# require 'create_github_release' | ||
# | ||
# options = CreateGithubRelease::Options.new { |o| o.release_type = 'major' } | ||
# assertion = CreateGithubRelease::Assertions::LocalReleaseTagDoesNotExist.new(options) | ||
# begin | ||
# assertion.assert | ||
# puts 'Assertion passed' | ||
# rescue SystemExit | ||
# puts 'Assertion failed' | ||
# end | ||
# | ||
# @return [void] | ||
# | ||
# @raise [SystemExit] if the assertion fails | ||
# | ||
def assert | ||
print "Checking that local tag '#{options.tag}' does not exist..." | ||
|
||
tags = `git tag --list "#{options.tag}"`.chomp | ||
error 'Could not list tags' unless $CHILD_STATUS.success? | ||
|
||
if tags.split.empty? | ||
puts 'OK' | ||
else | ||
error "Local tag '#{options.tag}' already exists" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 0 additions & 70 deletions
70
lib/create_github_release/assertions/release_branch_does_not_exist.rb
This file was deleted.
Oops, something went wrong.
73 changes: 0 additions & 73 deletions
73
lib/create_github_release/assertions/release_tag_does_not_exist.rb
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
lib/create_github_release/assertions/remote_release_branch_does_not_exist.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'English' | ||
require 'create_github_release/assertion_base' | ||
|
||
module CreateGithubRelease | ||
module Assertions | ||
# Assert that the release branch does not exist in the remote repository | ||
# | ||
# @api public | ||
# | ||
class RemoteReleaseBranchDoesNotExist < AssertionBase | ||
# Assert that the release branch does not exist in the remote repository | ||
# | ||
# @example | ||
# require 'create_github_release' | ||
# | ||
# options = CreateGithubRelease::Options.new { |o| o.release_type = 'major' } | ||
# assertion = CreateGithubRelease::Assertions::RemoteReleaseBranchDoesNotExist.new(options) | ||
# begin | ||
# assertion.assert | ||
# puts 'Assertion passed' | ||
# rescue SystemExit | ||
# puts 'Assertion failed' | ||
# end | ||
# | ||
# @return [void] | ||
# | ||
# @raise [SystemExit] if the assertion fails | ||
# | ||
def assert | ||
print "Checking that the remote branch '#{options.branch}' does not exist..." | ||
`git ls-remote --heads --exit-code '#{options.remote}' '#{options.branch}' >/dev/null 2>&1` | ||
if $CHILD_STATUS.exitstatus == 2 | ||
puts 'OK' | ||
else | ||
error 'Could not list branches' unless $CHILD_STATUS.success? | ||
error "'#{options.branch}' already exists" | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.