Sha256: 0d32f284f076ecf0659af7c93b59cacbe1e198b9cdfe17c2b977f8595846907f

Contents?: true

Size: 677 Bytes

Versions: 6

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

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

require 'bake/modernize'

def git
	update(root: Dir.pwd)
end

def update(root:)
	if current_branch == "master"
		# 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.15.1 bake/modernize/git.rb
bake-modernize-0.15.0 bake/modernize/git.rb
bake-modernize-0.14.4 bake/modernize/git.rb
bake-modernize-0.14.3 bake/modernize/git.rb
bake-modernize-0.14.2 bake/modernize/git.rb
bake-modernize-0.14.1 bake/modernize/git.rb