lib/atlassian/stash/pullrequest.rb in atlassian-stash-0.1.4 vs lib/atlassian/stash/pullrequest.rb in atlassian-stash-0.1.5
- old
+ new
@@ -67,14 +67,20 @@
title = generate_pull_request_title source, target
description = ''
resource = CreatePullRequestResource.new(repoInfo.projectKey, repoInfo.slug, title, description, reviewers, source, target).resource
+ username = @config["username"]
+ password = @config["password"]
+
+ username = ask("Username: ") unless @config["username"]
+ password = ask("Password: ") { |q| q.echo = '*' } unless @config["password"]
+
uri = URI.parse(@config["stash_url"].downcase)
prPath = uri.path + '/projects/' + repoInfo.projectKey + '/repos/' + repoInfo.slug + '/pull-requests'
req = Net::HTTP::Post.new(prPath, initheader = {'Content-Type' => 'application/json', 'Accept' => 'application/json'})
- req.basic_auth @config["username"], @config["password"]
+ req.basic_auth username, password
req.body = resource.to_json
http = Net::HTTP.new(uri.host, uri.port)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.use_ssl = uri.scheme.eql?("https")