refactor pull request rake task
This commit is contained in:
		
							
								
								
									
										13
									
								
								Rakefile
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Rakefile
									
									
									
									
									
								
							| @@ -120,11 +120,9 @@ namespace :test do | |||||||
|  |  | ||||||
|   desc 'checkout and test a pull request, publish the results' |   desc 'checkout and test a pull request, publish the results' | ||||||
|   task 'pull_request', [:project_name, :number] do |t, args| |   task 'pull_request', [:project_name, :number] do |t, args| | ||||||
|     require 'vagrant' |     log_dir = File.join(base_dir, 'logs') | ||||||
|     require 'github_api' |     log_file = File.join(log_dir, "#{Time.now.to_i.to_s}.log") | ||||||
|     $stdout.reopen("my.log", "w") |     FileUtils.mkdir(log_dir) unless File.exists?(log_dir) | ||||||
|     $stdout.sync = true |  | ||||||
|     $stderr.reopen($stdout) |  | ||||||
|     refresh_modules |     refresh_modules | ||||||
|     checkout_pr( |     checkout_pr( | ||||||
|       args.project_name, |       args.project_name, | ||||||
| @@ -136,11 +134,12 @@ namespace :test do | |||||||
|         :password => github_password |         :password => github_password | ||||||
|       } |       } | ||||||
|     ) |     ) | ||||||
|     test_two_node(['redhat', 'ubuntu']) |     system "bash -c 'rspec spec/test_two_node.rb;echo $?' 2>&1 | tee #{log_file}" | ||||||
|     results = File.read('my.log') |     results = File.read(log_file) | ||||||
|     publish_results( |     publish_results( | ||||||
|       args.project_name, |       args.project_name, | ||||||
|       args.number, |       args.number, | ||||||
|  |       results.split("\n").last == '0' ? 'passed' : 'failed', | ||||||
|       results, |       results, | ||||||
|       { |       { | ||||||
|         :login    => github_login, |         :login    => github_login, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dan Bode
					Dan Bode