Skip to content

Commit c110187

Browse files
committed
Fix syntax error in ruby 1.8; closes dergachev#10
1 parent 0401cff commit c110187

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/models/repository/git_remote.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,14 @@ def parse(url)
127127
ret = {}
128128
# start with http://github.com/evolvingweb/git_remote or [email protected]:some/repo.git
129129
ret[:url] = url
130+
131+
# NB: Starting lines with ".gsub" is a syntax error in ruby 1.8.
132+
# See http://stackoverflow.com/q/12906048/9621
130133
# path is github.com/evolvingweb/muhc-ci
131-
ret[:path] = url
132-
.gsub(/^.*:\/\//, '') # Remove anything before ://
133-
.gsub(/:/, '/') # convert ":" to "/"
134-
.gsub(/^.*@/, '') # Remove anything before @
135-
.gsub(/\.git$/, '') # Remove trailing .git
134+
ret[:path] = url.gsub(/^.*:\/\//, ''). # Remove anything before ://
135+
gsub(/:/, '/'). # convert ":" to "/"
136+
gsub(/^.*@/, ''). # Remove anything before @
137+
gsub(/\.git$/, '') # Remove trailing .git
136138
ret[:host] = ret[:path].split('/').first
137139
#TODO: handle project uniqueness automatically or prompt
138140
ret[:identifier] = ret[:path].split('/').last.downcase.gsub(/[^a-z0-9_-]/,'-')

0 commit comments

Comments
 (0)