Skip to content

Commit 0d27311

Browse files
committed
Add --skip-check flag for deploy CLI command to allow skip repo checks
1 parent add57c5 commit 0d27311

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/kimurai/cli.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ def setup(user_host)
4343
option "ssh-key-path", type: :string, banner: "Auth using ssh key"
4444
option "repo-url", type: :string, banner: "Repo url"
4545
option "repo-key-path", type: :string, banner: "SSH key for a git repo"
46+
option "skip-check", type: :boolean, default: false, banner: "Skip git repository checks"
4647
def deploy(user_host)
47-
if !`git status --short`.empty?
48-
raise "Deploy: Please commit your changes first"
49-
elsif `git remote`.empty?
50-
raise "Deploy: Please add remote origin repository to your repo first"
51-
elsif !`git rev-list master...origin/master`.empty?
52-
raise "Deploy: Please push your commits to the remote origin repo first"
48+
unless options["skip-check"]
49+
if !`git status --short`.empty?
50+
raise "Deploy: Please commit your changes first"
51+
elsif `git remote`.empty?
52+
raise "Deploy: Please add remote origin repository to your repo first"
53+
elsif !`git rev-list master...origin/master`.empty?
54+
raise "Deploy: Please push your commits to the remote origin repo first"
55+
end
5356
end
5457

5558
repo_url = options["repo-url"] ? options["repo-url"] : `git remote get-url origin`.strip

0 commit comments

Comments
 (0)