summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-02-13 23:35:45 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-02-13 23:35:45 +0800
commit59d49f70c3b36e633b78e82fe3bd85b53f06900b (patch)
tree445c8ca00a24102f9b0bc77729db77287cfd748c /qa
parent565fdd63cf49c266c7a6a2a0d2a843339a9d30e6 (diff)
downloadgitlab-ce-59d49f70c3b36e633b78e82fe3bd85b53f06900b.tar.gz
Rename Git::Repository::Location to Git::Location
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb1
-rw-r--r--qa/qa/git/location.rb39
-rw-r--r--qa/qa/git/repository.rb2
-rw-r--r--qa/qa/git/repository/location.rb41
-rw-r--r--qa/spec/git/location_spec.rb (renamed from qa/spec/git/repository/location_spec.rb)2
5 files changed, 41 insertions, 44 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index c1b5d278186..c6de8625f3d 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -169,6 +169,7 @@ module QA
#
module Git
autoload :Repository, 'qa/git/repository'
+ autoload :Location, 'qa/git/location'
end
##
diff --git a/qa/qa/git/location.rb b/qa/qa/git/location.rb
new file mode 100644
index 00000000000..fa3f5721d7a
--- /dev/null
+++ b/qa/qa/git/location.rb
@@ -0,0 +1,39 @@
+require 'uri'
+require 'forwardable'
+
+module QA
+ module Git
+ class Location
+ extend Forwardable
+
+ attr_reader :git_uri, :uri
+ def_delegators :@uri, :user, :host, :path
+
+ # See: config/initializers/1_settings.rb
+ # Settings#build_gitlab_shell_ssh_path_prefix
+ def self.parse(git_uri)
+ if git_uri.start_with?('ssh://')
+ new(git_uri, URI.parse(git_uri))
+ else
+ *rest, path = git_uri.split(':')
+ # Host cannot have : so we'll need to escape it
+ user_host = rest.join('%3A').sub(/\A\[(.+)\]\z/, '\1')
+ new(git_uri, URI.parse("ssh://#{user_host}/#{path}"))
+ end
+ end
+
+ def initialize(git_uri, uri)
+ @git_uri = git_uri
+ @uri = uri
+ end
+
+ def scheme
+ uri.scheme || 'ssh'
+ end
+
+ def port
+ uri.port || 22
+ end
+ end
+ end
+end
diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb
index 903d292b69c..8eb7031f609 100644
--- a/qa/qa/git/repository.rb
+++ b/qa/qa/git/repository.rb
@@ -4,8 +4,6 @@ require 'uri'
module QA
module Git
class Repository
- autoload :Location, 'qa/git/repository/location'
-
include Scenario::Actable
def self.perform(*args)
diff --git a/qa/qa/git/repository/location.rb b/qa/qa/git/repository/location.rb
deleted file mode 100644
index dce8327ce82..00000000000
--- a/qa/qa/git/repository/location.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require 'uri'
-require 'forwardable'
-
-module QA
- module Git
- class Repository
- class Location
- extend Forwardable
-
- attr_reader :git_uri, :uri
- def_delegators :@uri, :user, :host, :path
-
- # See: config/initializers/1_settings.rb
- # Settings#build_gitlab_shell_ssh_path_prefix
- def self.parse(git_uri)
- if git_uri.start_with?('ssh://')
- new(git_uri, URI.parse(git_uri))
- else
- *rest, path = git_uri.split(':')
- # Host cannot have : so we'll need to escape it
- user_host = rest.join('%3A').sub(/\A\[(.+)\]\z/, '\1')
- new(git_uri, URI.parse("ssh://#{user_host}/#{path}"))
- end
- end
-
- def initialize(git_uri, uri)
- @git_uri = git_uri
- @uri = uri
- end
-
- def scheme
- uri.scheme || 'ssh'
- end
-
- def port
- uri.port || 22
- end
- end
- end
- end
-end
diff --git a/qa/spec/git/repository/location_spec.rb b/qa/spec/git/location_spec.rb
index c1fe01becd7..4c68a0cda61 100644
--- a/qa/spec/git/repository/location_spec.rb
+++ b/qa/spec/git/location_spec.rb
@@ -1,4 +1,4 @@
-describe QA::Git::Repository::Location do
+describe QA::Git::Location do
describe '.parse' do
context 'when URI starts with ssh://' do
context 'when URI has port' do