diff --git a/lib/tachikoma/application.rb b/lib/tachikoma/application.rb index b29cc7c..1076cbc 100644 --- a/lib/tachikoma/application.rb +++ b/lib/tachikoma/application.rb @@ -141,7 +141,7 @@ def target_repository_user(type, fetch_url, github_account) end def repository_identity(url) - %r!((?:[^/]*?)/(?:[^/]*?))(?:\.git)?$!.match(url)[1] + %r!((?:[^/]*?)/(?:[^/]*?))(?:\.git|/)?$!.match(url)[1] end def bundler_parallel_option(bundler_version, parallel_number) diff --git a/spec/tachikoma/application_spec.rb b/spec/tachikoma/application_spec.rb index 550e12e..5e89cea 100644 --- a/spec/tachikoma/application_spec.rb +++ b/spec/tachikoma/application_spec.rb @@ -76,4 +76,22 @@ end end end + + describe '#repository_identity' do + subject { described_class.new } + let(:identity) { 'example1/example2' } + + context 'https with .git' do + let(:url) { 'https://github.com/example1/example2.git' } + it { expect(subject.repository_identity(url)).to eq identity } + end + context 'https without .git' do + let(:url) { 'https://github.com/example1/example2' } + it { expect(subject.repository_identity(url)).to eq identity } + end + context 'https with trail slash' do + let(:url) { 'https://github.com/example1/example2/' } + it { expect(subject.repository_identity(url)).to eq identity } + end + end end