Sha256: 090770919ca2a4f9f78f3495b0af9bbe3d7afd0f0ea952c5472d01be2185a481

Contents?: true

Size: 907 Bytes

Versions: 32

Compression:

Stored size: 907 Bytes

Contents

require 'bake/modernize'

def gemfile
	update(root: Dir.pwd)
end

def update(root:)
	gemfile_path = File.expand_path("Gemfile", root)
	gems_path = File.expand_path("gems.rb", root)
	
	if File.exist?(gemfile_path)
		FileUtils::Verbose.mv gemfile_path, gems_path
	end
	
	gemfile_lock_path = File.expand_path("Gemfile.lock", root)
	gems_locked_path = File.expand_path("gems.locked", root)
	
	if File.exist?(gemfile_lock_path)
		FileUtils::Verbose.mv gemfile_lock_path, gems_locked_path
	end
	
	gitignore_path = File.expand_path(".gitignore", root)
	
	if File.exist?(gitignore_path)
		lines = File.readlines(gitignore_path)
		
		if index = lines.index{|pattern| pattern =~ /Gemfile\.lock/}
			lines[index] = "/gems.locked"
		elsif !lines.index{|pattern| pattern =~ /gems\.locked/}
			lines << ""
			lines << "/gems.locked"
		end
		
		File.open(gitignore_path, "w") do |file|
			file.puts(lines)
		end
	end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
bake-modernize-0.12.2 bake/modernize/gemfile.rb
bake-modernize-0.12.1 bake/modernize/gemfile.rb
bake-modernize-0.12.0 bake/modernize/gemfile.rb
bake-modernize-0.11.0 bake/modernize/gemfile.rb
bake-modernize-0.10.1 bake/modernize/gemfile.rb
bake-modernize-0.10.0 bake/modernize/gemfile.rb
bake-modernize-0.9.1 bake/modernize/gemfile.rb
bake-modernize-0.8.2 bake/modernize/gemfile.rb
bake-modernize-0.8.1 bake/modernize/gemfile.rb
bake-modernize-0.8.0 bake/modernize/gemfile.rb
bake-modernize-0.7.0 bake/modernize/gemfile.rb
bake-modernize-0.6.0 bake/modernize/gemfile.rb
bake-modernize-0.5.1 bake/modernize/gemfile.rb
bake-modernize-0.5.0 bake/modernize/gemfile.rb
bake-modernize-0.4.10 bake/modernize/gemfile.rb
bake-modernize-0.4.9 bake/modernize/gemfile.rb
bake-modernize-0.4.8 bake/modernize/gemfile.rb
bake-modernize-0.4.7 bake/modernize/gemfile.rb
bake-modernize-0.4.6 bake/modernize/gemfile.rb
bake-modernize-0.4.5 bake/modernize/gemfile.rb