Pass destination when cloning url.
This commit is contained in:
committed by
Chris Salzberg
parent
e06a5d6300
commit
9ad171ab78
@@ -50,8 +50,8 @@ module Homesick
|
|||||||
git_clone "https://github.com/#{Regexp.last_match[1]}.git",
|
git_clone "https://github.com/#{Regexp.last_match[1]}.git",
|
||||||
destination: destination
|
destination: destination
|
||||||
elsif uri =~ /%r([^%r]*?)(\.git)?\Z/ || uri =~ /[^:]+:([^:]+)(\.git)?\Z/
|
elsif uri =~ /%r([^%r]*?)(\.git)?\Z/ || uri =~ /[^:]+:([^:]+)(\.git)?\Z/
|
||||||
destination = Pathname.new(Regexp.last_match[1])
|
destination = Pathname.new(Regexp.last_match[1].gsub(/\.git$/,'')).basename
|
||||||
git_clone uri
|
git_clone uri, destination: destination
|
||||||
else
|
else
|
||||||
fail "Unknown URI format: #{uri}"
|
fail "Unknown URI format: #{uri}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -81,34 +81,39 @@ describe Homesick::CLI do
|
|||||||
|
|
||||||
it 'clones git repo like git://host/path/to.git' do
|
it 'clones git repo like git://host/path/to.git' do
|
||||||
expect(homesick).to receive(:git_clone)
|
expect(homesick).to receive(:git_clone)
|
||||||
.with('git://github.com/technicalpickles/pickled-vim.git')
|
.with('git://github.com/technicalpickles/pickled-vim.git',
|
||||||
|
destination: Pathname.new('pickled-vim'))
|
||||||
|
|
||||||
homesick.clone 'git://github.com/technicalpickles/pickled-vim.git'
|
homesick.clone 'git://github.com/technicalpickles/pickled-vim.git'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'clones git repo like git@host:path/to.git' do
|
it 'clones git repo like git@host:path/to.git' do
|
||||||
expect(homesick).to receive(:git_clone)
|
expect(homesick).to receive(:git_clone)
|
||||||
.with('git@github.com:technicalpickles/pickled-vim.git')
|
.with('git@github.com:technicalpickles/pickled-vim.git',
|
||||||
|
destination: Pathname.new('pickled-vim'))
|
||||||
|
|
||||||
homesick.clone 'git@github.com:technicalpickles/pickled-vim.git'
|
homesick.clone 'git@github.com:technicalpickles/pickled-vim.git'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'clones git repo like http://host/path/to.git' do
|
it 'clones git repo like http://host/path/to.git' do
|
||||||
expect(homesick).to receive(:git_clone)
|
expect(homesick).to receive(:git_clone)
|
||||||
.with('http://github.com/technicalpickles/pickled-vim.git')
|
.with('http://github.com/technicalpickles/pickled-vim.git',
|
||||||
|
destination: Pathname.new('pickled-vim'))
|
||||||
|
|
||||||
homesick.clone 'http://github.com/technicalpickles/pickled-vim.git'
|
homesick.clone 'http://github.com/technicalpickles/pickled-vim.git'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'clones git repo like http://host/path/to' do
|
it 'clones git repo like http://host/path/to' do
|
||||||
expect(homesick).to receive(:git_clone)
|
expect(homesick).to receive(:git_clone)
|
||||||
.with('http://github.com/technicalpickles/pickled-vim')
|
.with('http://github.com/technicalpickles/pickled-vim',
|
||||||
|
destination: Pathname.new('pickled-vim'))
|
||||||
|
|
||||||
homesick.clone 'http://github.com/technicalpickles/pickled-vim'
|
homesick.clone 'http://github.com/technicalpickles/pickled-vim'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'clones git repo like host-alias:repos.git' do
|
it 'clones git repo like host-alias:repos.git' do
|
||||||
expect(homesick).to receive(:git_clone).with('gitolite:pickled-vim.git')
|
expect(homesick).to receive(:git_clone).with('gitolite:pickled-vim.git',
|
||||||
|
destination: Pathname.new('pickled-vim'))
|
||||||
|
|
||||||
homesick.clone 'gitolite:pickled-vim.git'
|
homesick.clone 'gitolite:pickled-vim.git'
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user