module OptionalOptions
this are the optional options
Public Instance Methods
branch_opt(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 56 def branch_opt(opt) desc = 'run tests only if the pr target the upstream branch specified' opt.on('-b', "--branch 'GITHUB BRANCH'", desc) do |b| @options[:branch] = b end end
changed_since(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 101 def changed_since(opt) changed_since_desc = 'If present, will only check PRs with a ' \ 'change in the last X seconds' opt.on("--changed_since 'SECONDS'", changed_since_desc) do |changed_since| @options[:changed_since] = Integer(changed_since) end end
check_opt(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 35 def check_opt(opt) desc = 'Check if there is any PR requiring a test, but do not run it.' opt.on('-C', '--check', desc) { |check| @options[:check] = check } end
desc_opt(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 50 def desc_opt(opt) opt.on('-d', "--description 'DESCRIPTION'", 'Test decription') do |d| @options[:description] = d end end
file_opt(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 80 def file_opt(opt) file_description = 'pr_file type to run the test against: .py, .rb' opt.on('-f', "--file \'.py\'", file_description) do |file_type| @options[:file_type] = file_type end end
force_test_opt(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 40 def force_test_opt(opt) desc = 'Force to run a test, even if is not marked to be re-triggered.' opt.on('-F', '--force_test', desc) { |force_test| @options[:force_test] = force_test } end
git_opt(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 63 def git_opt(opt) desc = 'Specify a location where gitarro will clone the GitHub project. '\ 'If the dir does not exists, gitarro will create one. '\ 'by default is the /tmp' opt.on('-g', "--git_dir 'GIT_LOCAL_DIR'", desc) do |git_dir| @options[:git_dir] = git_dir end end
https_opt(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 87 def https_opt(opt) https_desc = 'If present, use https instead of ssh for git operations' opt.on('--https', https_desc) { |https| @options[:https] = https } end
no_shallow(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 45 def no_shallow(opt) desc = 'If enabled, gitarro will not use git shallow clone' opt.on('--noshallow', desc) { |noshallow| @options[:noshallow] = noshallow } end
optional_options(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 110 def optional_options(opt) opt.separator "\n Optional options:" desc_opt(opt) check_opt(opt) force_test_opt(opt) branch_opt(opt) no_shallow(opt) file_opt(opt) url_opt(opt) pr_number(opt) https_opt(opt) changed_since(opt) git_opt(opt) end
pr_number(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 92 def pr_number(opt) desc = 'Specify the PR number instead of checking all of them. ' \ 'Force to rerun against a specific PR number,' \ 'even if it is not needed.' opt.on('-P', "--PR 'NUMBER'", desc) do |pr_number| @options[:pr_number] = pr_number.to_i end end
url_opt(opt)
click to toggle source
# File lib/gitarro/opt_parser.rb, line 72 def url_opt(opt) desc = 'Specify the URL to append to add to the GitHub review. ' \ 'Usually you will use an URL to the Jenkins build log.' opt.on('-u', "--url 'TARGET_URL'", desc) do |target_url| @options[:target_url] = target_url end end