Last active
June 4, 2018 14:19
-
-
Save laurafeier/ef9b0fc37425d9b4cf3ec47c85b7fb60 to your computer and use it in GitHub Desktop.
ROSSConf MR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'trackler' | |
require 'uri' | |
ORG_NAME = 'rossconf2018-exercism-track-id'.freeze | |
CONFIGLET_PATH = '/Users/laura.feier/Downloads/configlet'.freeze | |
HERE = Pathname.new(__FILE__).dirname.expand_path | |
ORIGINAL_DIR = HERE.join('original').tap(&:mkpath) | |
BRANCH_NAME = 'order-configs'.freeze | |
Dir.chdir(HERE) | |
WHITELIST = %w[csharp erlang rust haskell ruby].freeze | |
Trackler.tracks.each do |track| | |
next unless WHITELIST.include?(track.id) | |
repo_url = track.repository | |
repo_name = URI(repo_url).path.sub('/', '') | |
Dir.chdir(ORIGINAL_DIR) | |
dirname = repo_name.split('/').last | |
repo_path = ORIGINAL_DIR.join(dirname).expand_path.to_s | |
puts %x(git clone #{repo_url}) | |
Dir.chdir(repo_path) | |
puts %x(git remote rm origin) | |
puts %x(git remote add origin git@github.com:#{ORG_NAME}/#{dirname}.git) | |
puts %x(git fetch origin master) | |
puts %x(git reset origin/master --hard) | |
puts %x(git pull origin master) | |
puts %x(git checkout -b #{BRANCH_NAME} --track) | |
puts %x(#{CONFIGLET_PATH} fmt #{repo_path} -v) | |
puts %x(git add config.json config/maintainers.json) | |
msg = <<~MSG | |
Reformat config files for reordering | |
Result of configlet fmt. | |
MSG | |
puts %x(git commit -m "#{msg}") | |
issue = 'exercism/meta#95' | |
destination = 'exercism:master' | |
source = "#{ORG_NAME}:#{BRANCH_NAME}" | |
desc = "#{msg} See #{issue} \n\n Created at ROSSConf. /cc @kytrinyx" | |
puts %x(hub pull-request -b #{destination} -p -h #{source} -m "#{desc}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment