Sha256: 60b60674ffbb5d392487a32103e2a70a63a277a7bedcb65f01a7209cac6a280c

Contents?: true

Size: 675 Bytes

Versions: 6

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2021-2022, by Samuel Williams.

require 'bake/modernize'

def git
	update(root: Dir.pwd)
end

def update(root:)
	if current_branch != "main"
		# https://github.com/github/renaming
		system("git", "branch", "-M", "main")
		system("git", "push", "-u", "origin", "main")
	end
	
	template_root = Bake::Modernize.template_path_for('git')
	Bake::Modernize.copy_template(template_root, root)
end

private

def current_branch
	require 'open3'
	
	output, status = Open3.capture2("git", "branch", "--show-current")
	
	unless status.success?
		raise "Could not get current branch!"
	end
	
	return output
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bake-modernize-0.14.0 bake/modernize/git.rb
bake-modernize-0.13.5 bake/modernize/git.rb
bake-modernize-0.13.4 bake/modernize/git.rb
bake-modernize-0.13.3 bake/modernize/git.rb
bake-modernize-0.13.2 bake/modernize/git.rb
bake-modernize-0.13.1 bake/modernize/git.rb