Browse code

improved regexes for setup_github_pages task

Brandon Mathis authored on 13/01/2013 at 16:02:54
Showing 1 changed files
... ...
@@ -308,9 +308,9 @@ task :setup_github_pages, :repo do |t, args|
308 308
     repo_url = get_stdin("Repository url: ")
309 309
   end
310 310
   user = repo_url.match(/:([^\/]+)/)[1]
311
-  branch = (repo_url.match(/\/[\w-]+.github.com/).nil?) ? 'gh-pages' : 'master'
311
+  branch = (repo_url.match(/\/[\w-]+\.github\.com/).nil?) ? 'gh-pages' : 'master'
312 312
   project = (branch == 'gh-pages') ? repo_url.match(/\/([^\.]+)/)[1] : ''
313
-  unless `git remote -v`.match(/origin.+?octopress(\.git)?/).nil?
313
+  unless (`git remote -v` =~ /origin.+?octopress(?:\.git)?/).nil?
314 314
     # If octopress is still the origin remote (from cloning) rename it to octopress
315 315
     system "git remote rename origin octopress"
316 316
     if branch == 'master'