git-process 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- # CHANGELOG - 1.1.3 #
1
+ # CHANGELOG - 1.1.4 #
2
+
3
+ ### Since 1.1.3 ###
4
+
5
+ * Improved URI handling of repo names. ([GH-108](https://github.com/jdigger/git-process/issues/108))
2
6
 
3
7
  ### Since 1.1.2 ###
4
8
 
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ group :default do
5
5
  gem "json", "~> 1.7.3"
6
6
  gem "trollop", "~> 1.16.2" # CLI options parser
7
7
  gem "highline", "1.6.13" # user CLI interaction. There is a bug in 1.6.14
8
+ gem "addressable", "~> 2.3.4" # URI processing
8
9
  end
9
10
 
10
11
  group :development do
data/Gemfile.lock CHANGED
@@ -41,6 +41,7 @@ PLATFORMS
41
41
  ruby
42
42
 
43
43
  DEPENDENCIES
44
+ addressable (~> 2.3.4)
44
45
  highline (= 1.6.13)
45
46
  json (~> 1.7.3)
46
47
  octokit (~> 1.24)
data/git-process.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.add_dependency "json", "~> 1.7.3"
13
13
  gem.add_dependency "trollop", "~> 1.16.2" # CLI options parser
14
14
  gem.add_dependency "highline", "1.6.13" # user CLI interaction. There is a bug in 1.6.14
15
+ gem.add_dependency "addressable", "~> 2.3.4" # URI processing
15
16
 
16
17
  gem.files = `git ls-files`.split($\).delete_if { |f| f =~ /^\./ }
17
18
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
@@ -11,6 +11,7 @@
11
11
  # limitations under the License.
12
12
 
13
13
  require 'git-process/git_config'
14
+ require 'addressable/uri'
14
15
  #require 'git-process/git_branches'
15
16
  #require 'git-process/git_status'
16
17
  #require 'git-process/git_process_error'
@@ -80,7 +81,8 @@ module GitProc
80
81
  unless @repo_name
81
82
  url = config["remote.#{name}.url"]
82
83
  raise GitProcessError.new("There is no #{name} url set up.") if url.nil? or url.empty?
83
- @repo_name = url.sub(/^.*:(.*?)(.git)?$/, '\1')
84
+ uri = Addressable::URI.parse(url)
85
+ @repo_name = uri.path.sub(/\.git/, '').sub(/^\//, '')
84
86
  end
85
87
  @repo_name
86
88
  end
@@ -14,7 +14,7 @@ module GitProc
14
14
  module Version
15
15
  MAJOR = 1
16
16
  MINOR = 1
17
- PATCH = 3
17
+ PATCH = 4
18
18
  BUILD = nil
19
19
 
20
20
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -84,6 +84,45 @@ describe GitRemote do
84
84
  end
85
85
 
86
86
 
87
+ describe "#repo_name" do
88
+ include GitRepoHelper
89
+
90
+ it "should work for an ssh address" do
91
+ remote.add('torigin', 'tuser@github.myco.com:jdigger/git-process.git')
92
+
93
+ remote.repo_name.should == 'jdigger/git-process'
94
+ end
95
+
96
+
97
+ it 'should work for an http address' do
98
+ remote.add('torigin', 'http://github.myco.com:8080/jdigger/git-process.git')
99
+
100
+ remote.repo_name.should == 'jdigger/git-process'
101
+ end
102
+
103
+
104
+ it "should work for an https address" do
105
+ remote.add('torigin', 'https://github.myco.com/jdigger/git-process.git')
106
+
107
+ remote.repo_name.should == 'jdigger/git-process'
108
+ end
109
+
110
+
111
+ it "should work for an ssh-configured url address" do
112
+ remote.add('origin', 'mygithub:jdigger/git-process.git')
113
+
114
+ content = "\nHost mygithub\n"+
115
+ " User tuser\n"+
116
+ " HostName github.myco.com\n"
117
+
118
+ in_tempfile('ssh_config', content) do |file|
119
+ remote.repo_name.should == 'jdigger/git-process'
120
+ end
121
+ end
122
+
123
+ end
124
+
125
+
87
126
  describe "#hostname_and_user_from_ssh_config" do
88
127
  include GitRepoHelper
89
128
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-process
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 3
10
- version: 1.1.3
9
+ - 4
10
+ version: 1.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Moore
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-04-29 00:00:00 Z
18
+ date: 2013-05-02 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: octokit
@@ -80,6 +80,22 @@ dependencies:
80
80
  - 13
81
81
  version: 1.6.13
82
82
  requirement: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ name: addressable
85
+ prerelease: false
86
+ type: :runtime
87
+ version_requirements: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 11
93
+ segments:
94
+ - 2
95
+ - 3
96
+ - 4
97
+ version: 2.3.4
98
+ requirement: *id005
83
99
  description: A set of scripts to make working with git easier and more consistent
84
100
  email:
85
101
  - moore.jim@gmail.com