atlassian-stash 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/bin/stash +5 -4
- data/lib/atlassian/stash/pullrequest.rb +7 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -10,7 +10,7 @@ This command line helper for Stash is written in Ruby and is deployed as a [Ruby
|
|
10
10
|
Once the gem is installed, the command `stash` will be in your `$PATH`
|
11
11
|
|
12
12
|
## Configuration and usage
|
13
|
-
Run `stash configure`. This will prompt for details about your Stash instance.
|
13
|
+
Run `stash configure`. This will prompt for details about your Stash instance. If no password is provided, then you will be prompted for a password when executing commands to Stash. Currently, the password is stored in plain text in a configuration file, `~/.stashconfig.yml` which is protected with a permission bit of `0600`.
|
14
14
|
|
15
15
|
### Creating a pull request
|
16
16
|
Use the `pull-request` command to create a pull request in Stash. E.g:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/bin/stash
CHANGED
@@ -18,7 +18,7 @@ $configFile = File.join(Etc.getpwuid.dir, ".stashconfig.yml")
|
|
18
18
|
def load_config
|
19
19
|
raise "No Stash configuration found; please run configure" unless File.exists? $configFile
|
20
20
|
config = YAML.load_file($configFile)
|
21
|
-
raise "Stash configuration file is incomplete, please re-run configure" unless config['username'] and config['
|
21
|
+
raise "Stash configuration file is incomplete, please re-run configure" unless config['username'] and config['stash_url']
|
22
22
|
config
|
23
23
|
end
|
24
24
|
|
@@ -31,15 +31,16 @@ command 'configure' do |c|
|
|
31
31
|
c.option '--stashUrl', String, 'Writes the Stash server url to the configuration file'
|
32
32
|
c.action do |args, options|
|
33
33
|
username = options.username ? options.username : ask("Stash Username: ")
|
34
|
-
password = options.password ? options.password : ask("Stash Password: ") { |q| q.echo = "*" }
|
34
|
+
password = options.password ? options.password : ask("Stash Password (optional): ") { |q| q.echo = "*" }
|
35
35
|
stashUrl = options.stashUrl ? options.stashUrl : ask("Stash URL: ")
|
36
36
|
|
37
37
|
c = {
|
38
|
-
'username' => username.to_s,
|
39
|
-
'password' => password.to_s,
|
40
38
|
'stash_url' => stashUrl.to_s
|
41
39
|
}
|
42
40
|
|
41
|
+
c['username'] = username.to_s unless username.empty?
|
42
|
+
c['password'] = password.to_s unless password.empty?
|
43
|
+
|
43
44
|
File.open($configFile, 'w') do |out|
|
44
45
|
YAML.dump(c, out)
|
45
46
|
end
|
@@ -69,11 +69,17 @@ module Atlassian
|
|
69
69
|
|
70
70
|
resource = CreatePullRequestResource.new(repoInfo.projectKey, repoInfo.slug, title, description, reviewers, source, target).resource
|
71
71
|
|
72
|
+
username = @config["username"]
|
73
|
+
password = @config["password"]
|
74
|
+
|
75
|
+
username = ask("Username: ") unless @config["username"]
|
76
|
+
password = ask("Password: ") { |q| q.echo = '*' } unless @config["password"]
|
77
|
+
|
72
78
|
uri = URI.parse(@config["stash_url"].downcase)
|
73
79
|
prPath = uri.path + '/projects/' + repoInfo.projectKey + '/repos/' + repoInfo.slug + '/pull-requests'
|
74
80
|
|
75
81
|
req = Net::HTTP::Post.new(prPath, initheader = {'Content-Type' => 'application/json', 'Accept' => 'application/json'})
|
76
|
-
req.basic_auth
|
82
|
+
req.basic_auth username, password
|
77
83
|
req.body = resource.to_json
|
78
84
|
http = Net::HTTP.new(uri.host, uri.port)
|
79
85
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 5
|
9
|
+
version: 0.1.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Seb Ruiz
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-
|
17
|
+
date: 2012-11-05 00:00:00 +11:00
|
18
18
|
default_executable: stash
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|