From c1101873f6283171ca6728f94464b30686898500 Mon Sep 17 00:00:00 2001 From: Alex Dergachev Date: Thu, 18 Dec 2014 00:29:54 +0000 Subject: [PATCH] Fix syntax error in ruby 1.8; closes #10 --- app/models/repository/git_remote.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/models/repository/git_remote.rb b/app/models/repository/git_remote.rb index 7b9b0a9..8ad3508 100644 --- a/app/models/repository/git_remote.rb +++ b/app/models/repository/git_remote.rb @@ -127,12 +127,14 @@ class Repository::GitRemote < Repository::Git ret = {} # start with http://github.com/evolvingweb/git_remote or git@git.ewdev.ca:some/repo.git ret[:url] = url + + # NB: Starting lines with ".gsub" is a syntax error in ruby 1.8. + # See http://stackoverflow.com/q/12906048/9621 # path is github.com/evolvingweb/muhc-ci - ret[:path] = url - .gsub(/^.*:\/\//, '') # Remove anything before :// - .gsub(/:/, '/') # convert ":" to "/" - .gsub(/^.*@/, '') # Remove anything before @ - .gsub(/\.git$/, '') # Remove trailing .git + ret[:path] = url.gsub(/^.*:\/\//, ''). # Remove anything before :// + gsub(/:/, '/'). # convert ":" to "/" + gsub(/^.*@/, ''). # Remove anything before @ + gsub(/\.git$/, '') # Remove trailing .git ret[:host] = ret[:path].split('/').first #TODO: handle project uniqueness automatically or prompt ret[:identifier] = ret[:path].split('/').last.downcase.gsub(/[^a-z0-9_-]/,'-')