git @ Cat's Eye Technologies The-Dipple / master ruby / hgrcify
master

Tree @master (Download .tar.gz)

hgrcify @masterraw · history · blame

#!/usr/bin/env ruby

# SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
# For more information, please refer to <https://unlicense.org/>
# SPDX-License-Identifier: Unlicense

project = File.basename(Dir.pwd)
filename = ".hg/hgrc"
if File.exist? filename
  puts "#{filename} exists:\n\n"
else
  File.open(filename, 'w') do |f|  
    f.puts <<"EOF"
[paths]
default = https://catseye@bitbucket.org/catseye/#{project}
EOF
  end  
  puts "created #{filename}:\n\n"
end
File.open(filename, 'r') do |f|
  while line = f.gets  
    puts line
  end
end