Guest User

Untitled

a guest
Nov 29th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'octokit'
  4. require 'fileutils'
  5.  
  6. puts "Give me your github username!"
  7. print "> " ; username = STDIN.gets.chomp
  8.  
  9. puts "Give me your account password!"
  10. print "> " ; password = STDIN.gets.chomp
  11.  
  12. api = Octokit::Client.new(:login => username, :password => password)
  13.  
  14. repos = Octokit.search_repositories("dotfiles")
  15.  
  16. repos.each do |repo|
  17. puts repo.url
  18. system "git clone #{repo.url}"
  19. if File.exist? "#{repo.name}/vimrc"
  20. vimrc = File.open("#{repo.name}/vimrc", "r")
  21. content = vimrc.read
  22. vimrc.close
  23. if content.include? "set expandtab"
  24. vimrc = File.open("#{repo.name}/vimrc", "w")
  25. content = content.gsub('set expandtab', '')
  26. vimrc.truncate(vimrc.size)
  27. vimrc.write(content)
  28. vimrc.close
  29. Dir.chdir "#{repo.name}"
  30. system "git commit -am 'Y U NO USE TABS?!'"
  31. api.fork("#{repo.username}/#{repo.name}")
  32. system "git remote add penis git@github.com:#{username}/#{repo.name}.git"
  33. system "git push -u penis master"
  34. api.create_pull_request("#{repo.username}/#{repo.name}", "master", "#{username}:master", "You are still using spaces", "According to your .vimrc you are still using spaces. I removed the 'set expandtab' option from your .vimrc so now you can use tabs again :3")
  35. api.delete_repo("#{username}/#{repo.name}")
  36. Dir.chdir ".."
  37. end
  38. end
  39. FileUtils.rm_rf(repo.name)
  40. end
Add Comment
Please, Sign In to add comment