jira_attachment_uploader-single.rb
#Utilizes the above methods to attach the specified file to the specified issue within the specified project.
Utilizes the above methods to attach the specified file to the specified issue within the specified project.
Utilizes the above methods to attach the specified file to the specified issue within the specified project .
def attach(project_name)
	log_file_creation()
	$log.unknown "---------------------------------------------SCRIPT STARTED---------------------------------------------"
	if test_connection()
		project_id = getProjectId(project_name)
		issue_id = ""
		issue = ""
		if project_id != ""
			issue_id = getIssueId(project_id)
			if issue_id != ""
				issue = findIssue(issue_id)
				addAttachmentToIssue(issue)
				if $upload_failed
					puts "----------------------------------------------------------------------------------------------------------"
					puts ""
					puts "Script completed with errors: Not all files were uploaded successfully, please check log file for more details --- #{$log_path}"
					puts ""
					puts "----------------------------------------------------------------------------------------------------------"
				else
					puts "----------------------------------------------------------------------------------------------------------"
					puts ""
					puts "                  Script completed without error: The file was uploaded successfully."
					puts ""
					puts "----------------------------------------------------------------------------------------------------------"
				end
			else
				puts "No issue with the name: #{$requested_issue_name} found in project: #{$requested_project_name}"
				write_to_file("No issue with the name: #{$requested_issue_name} found in project: #{$requested_project_name}", "error")
			end
		else
			projects = getAllProjects()
			puts "------------------------------------------------------------------------------------------"
			puts ""
			puts "Project Name [#{project_name}] was not found, below are a list of projects."
			puts ""
			for project in projects
				puts "#{project}"
			end
			puts ""
			puts "------------------------------------------------------------------------------------------"
			write_to_file("Project: #{project_name} was not found in subscription.", "error")
		end
	end
	$log.unknown "---------------------------------------------SCRIPT ENDED---------------------------------------------"
	$log.close()
end
def attach ( project_name ) log_file_creation ( ) $log . unknown "---------------------------------------------SCRIPT STARTED---------------------------------------------" if test_connection ( ) project_id = getProjectId ( project_name ) issue_id = "" issue = "" if project_id != "" issue_id = getIssueId ( project_id ) if issue_id != "" issue = findIssue ( issue_id ) addAttachmentToIssue ( issue ) if $upload_failed puts "----------------------------------------------------------------------------------------------------------" puts "" puts "Script completed with errors: Not all files were uploaded successfully, please check log file for more details --- #{$log_path}" puts "" puts "----------------------------------------------------------------------------------------------------------" else puts "----------------------------------------------------------------------------------------------------------" puts "" puts "                  Script completed without error: The file was uploaded successfully." puts "" puts "----------------------------------------------------------------------------------------------------------" end else puts "No issue with the name: #{$requested_issue_name} found in project: #{$requested_project_name}" write_to_file ( "No issue with the name: #{$requested_issue_name} found in project: #{$requested_project_name}" , "error" ) end else projects = getAllProjects ( ) puts "------------------------------------------------------------------------------------------" puts "" puts "Project Name [#{project_name}] was not found, below are a list of projects." puts "" for project in projects puts "#{project}" end puts "" puts "------------------------------------------------------------------------------------------" write_to_file ( "Project: #{project_name} was not found in subscription." , "error" ) end end $log . unknown "---------------------------------------------SCRIPT ENDED---------------------------------------------" $log . close ( ) end
Utilizes the above methods to attach the specified file to the specified issue within the specified project.
Utilizes the above methods to attach the specified file to the specified issue within the specified project .
# Get all issues assigned to the project id
project_name