atlassian-stash 0.1.5 → 0.1.6

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/Gemfile CHANGED
@@ -3,6 +3,7 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
+ gem "git"
6
7
  gem "json"
7
8
  gem "commander"
8
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
data/bin/stash CHANGED
@@ -13,7 +13,7 @@ program :description, "Provides convenient functions for interacting with Atlass
13
13
  include Atlassian::Stash
14
14
  include Atlassian::Stash::Git
15
15
 
16
- $configFile = File.join(Etc.getpwuid.dir, ".stashconfig.yml")
16
+ $configFile = File.join(ENV['HOME'], ".stashconfig.yml")
17
17
 
18
18
  def load_config
19
19
  raise "No Stash configuration found; please run configure" unless File.exists? $configFile
@@ -11,8 +11,13 @@ module Atlassian
11
11
  system('git rev-parse')
12
12
  end
13
13
 
14
+ def get_remotes
15
+ %x(git remote -v)
16
+ end
17
+
14
18
  def get_remote_url
15
- URI.extract(%x(git remote -v)).first
19
+ origin = get_remotes.split("\n").collect { |r| r.strip }.grep(/^origin.*\(push\)$/).first
20
+ URI.extract(origin).first
16
21
  end
17
22
 
18
23
  def ensure_within_git!
@@ -0,0 +1,57 @@
1
+ require 'helper'
2
+
3
+ include Atlassian::Stash
4
+ include Atlassian::Stash::Git
5
+
6
+ class TestGit < Test::Unit::TestCase
7
+
8
+ should "extract remote with ssh remote" do
9
+ Atlassian::Stash::Git.instance_eval do
10
+ def get_remotes
11
+ "origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (fetch)
12
+ origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (push)"
13
+ end
14
+ end
15
+ assert_equal 'ssh://git@stash.atlassian.com:7999/STASH/stash.git', Atlassian::Stash::Git.get_remote_url
16
+ end
17
+
18
+ should "extract push remote with different fetch and push urls" do
19
+ Atlassian::Stash::Git.instance_eval do
20
+ def get_remotes
21
+ "origin ssh://git@github.com/~sebr/stash.git (fetch)
22
+ origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (push)"
23
+ end
24
+ end
25
+ assert_equal 'ssh://git@stash.atlassian.com:7999/STASH/stash.git', Atlassian::Stash::Git.get_remote_url
26
+ end
27
+
28
+ should "extract remote with http remote" do
29
+ Atlassian::Stash::Git.instance_eval do
30
+ def get_remotes
31
+ "origin http://adam@sonoma:7990/stash/scm/QA/stash.git (fetch)
32
+ origin http://adam@sonoma:7990/stash/scm/QA/stash.git (push)"
33
+ end
34
+ end
35
+ assert_equal 'http://adam@sonoma:7990/stash/scm/QA/stash.git', Atlassian::Stash::Git.get_remote_url
36
+ end
37
+
38
+ should "extract remote with multiple remote urls" do
39
+ Atlassian::Stash::Git.instance_eval do
40
+ def get_remotes
41
+ "bitbucket git@bitbucket.org:atlassian/stash-command-line-tools.git (fetch)
42
+ bitbucket git@bitbucket.org:atlassian/stash-command-line-tools.git (push)
43
+ kostya http://admin@kostya:7990/scm/CA/cylon.git (fetch)
44
+ kostya http://admin@kostya:7990/scm/CA/cylon.git (push)
45
+ local http://delirium:7990/git/STASH/stash.git (fetch)
46
+ local http://delirium:7990/git/STASH/stash.git (push)
47
+ origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (fetch)
48
+ origin ssh://git@stash.atlassian.com:7999/STASH/stash.git (push)
49
+ seb http://adam@sonoma:7990/stash/scm/QA/stash.git (fetch)
50
+ seb http://adam@sonoma:7990/stash/scm/QA/stash.git (push)
51
+ upstream http://github-enterprise-11-10/stash/stash.git (fetch)
52
+ upstream http://github-enterprise-11-10/stash/stash.git (push)"
53
+ end
54
+ end
55
+ assert_equal 'ssh://git@stash.atlassian.com:7999/STASH/stash.git', Atlassian::Stash::Git.get_remote_url
56
+ end
57
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Seb Ruiz
@@ -14,13 +14,13 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-11-05 00:00:00 +11:00
17
+ date: 2012-11-07 00:00:00 +11:00
18
18
  default_executable: stash
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  prerelease: false
22
22
  type: :runtime
23
- name: json
23
+ name: git
24
24
  version_requirements: &id001 !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
@@ -32,7 +32,7 @@ dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  prerelease: false
34
34
  type: :runtime
35
- name: commander
35
+ name: json
36
36
  version_requirements: &id002 !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
@@ -43,8 +43,8 @@ dependencies:
43
43
  requirement: *id002
44
44
  - !ruby/object:Gem::Dependency
45
45
  prerelease: false
46
- type: :development
47
- name: shoulda
46
+ type: :runtime
47
+ name: commander
48
48
  version_requirements: &id003 !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - ">="
@@ -56,8 +56,20 @@ dependencies:
56
56
  - !ruby/object:Gem::Dependency
57
57
  prerelease: false
58
58
  type: :development
59
- name: rdoc
59
+ name: shoulda
60
60
  version_requirements: &id004 !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirement: *id004
68
+ - !ruby/object:Gem::Dependency
69
+ prerelease: false
70
+ type: :development
71
+ name: rdoc
72
+ version_requirements: &id005 !ruby/object:Gem::Requirement
61
73
  requirements:
62
74
  - - ~>
63
75
  - !ruby/object:Gem::Version
@@ -65,12 +77,12 @@ dependencies:
65
77
  - 3
66
78
  - 12
67
79
  version: "3.12"
68
- requirement: *id004
80
+ requirement: *id005
69
81
  - !ruby/object:Gem::Dependency
70
82
  prerelease: false
71
83
  type: :development
72
84
  name: bundler
73
- version_requirements: &id005 !ruby/object:Gem::Requirement
85
+ version_requirements: &id006 !ruby/object:Gem::Requirement
74
86
  requirements:
75
87
  - - ">="
76
88
  - !ruby/object:Gem::Version
@@ -79,12 +91,12 @@ dependencies:
79
91
  - 2
80
92
  - 0
81
93
  version: 1.2.0
82
- requirement: *id005
94
+ requirement: *id006
83
95
  - !ruby/object:Gem::Dependency
84
96
  prerelease: false
85
97
  type: :development
86
98
  name: jeweler
87
- version_requirements: &id006 !ruby/object:Gem::Requirement
99
+ version_requirements: &id007 !ruby/object:Gem::Requirement
88
100
  requirements:
89
101
  - - ~>
90
102
  - !ruby/object:Gem::Version
@@ -93,19 +105,19 @@ dependencies:
93
105
  - 8
94
106
  - 4
95
107
  version: 1.8.4
96
- requirement: *id006
108
+ requirement: *id007
97
109
  - !ruby/object:Gem::Dependency
98
110
  prerelease: false
99
111
  type: :development
100
112
  name: rcov
101
- version_requirements: &id007 !ruby/object:Gem::Requirement
113
+ version_requirements: &id008 !ruby/object:Gem::Requirement
102
114
  requirements:
103
115
  - - ">="
104
116
  - !ruby/object:Gem::Version
105
117
  segments:
106
118
  - 0
107
119
  version: "0"
108
- requirement: *id007
120
+ requirement: *id008
109
121
  description: Provides convenient functions for interacting with Atlassian Stash through the command line
110
122
  email: sruiz@atlassian.com
111
123
  executables:
@@ -129,6 +141,7 @@ files:
129
141
  - lib/stash_cli.rb
130
142
  - test/helper.rb
131
143
  - test/test_stash-create-pull-request.rb
144
+ - test/test_stash-git.rb
132
145
  has_rdoc: true
133
146
  homepage: https://bitbucket.org/atlassian/stash-command-line-tools
134
147
  licenses: