Skip to content

Commit

Permalink
add option to suppress git_push after tests have completed
Browse files Browse the repository at this point in the history
  • Loading branch information
batasha committed Mar 18, 2015
1 parent 5681628 commit 666e1b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bin/test-drive
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class App


main do
@server_url = options['server'] ||= ask('Jenkins URL: ')
@user = options['user'] ||= ask('Jenkins User ID: ')
@api_key = options['password'] ||= ask('Jenkins Password/API Token: ')
@target_job = options['job'] ||= ask('Jenkins job to trigger: ')
@server_url = options[:server] ||= ask('Jenkins URL: ')
@user = options[:user] ||= ask('Jenkins User ID: ')
@api_key = options[:password] ||= ask('Jenkins Password/API Token: ')
@target_job = options[:job] ||= ask('Jenkins job to trigger: ')


config_file = File.expand_path('.test-drive.yml', ENV['HOME'])
Expand All @@ -43,7 +43,7 @@ class App
result = @client.wait_for_job_status(@target_job, build_number)

print_result(result)
git_push if result == 'SUCCESS' || result == 'UNSTABLE'
git_push if ['SUCCESS', 'UNSTABLE'].include? result && options[:push]

delete_patch @patch_file
end
Expand All @@ -54,6 +54,7 @@ class App
on '-u USER', '--user', 'Jenkins user ID'
on '-p API_KEY', '--password', 'Jenkins password or API token'
on '-j TARGET_JOB', '--job', 'Jenkins job to be triggered'
on '-n', '--[no-]push', 'Option to enable (or suppress) pushing to the remote repo'


description 'A simple command-line tool for running a Jenkins test job before pushing code to the remote repo'
Expand Down
1 change: 1 addition & 0 deletions features/test-drive.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Feature: My bootstrapped app kinda works
|--server |
|--user |
|--password |
|--[no-]push |

0 comments on commit 666e1b8

Please sign in to comment.