From b5712bc3650a2c2d38ec5e8e4021ff4b5965dd87 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 5 Sep 2011 10:48:00 -0400 Subject: v3: Dir.chdir, remove "system cd" (change directory) use Dir.chdir --- lib/sisu/v3/git.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'lib/sisu/v3/git.rb') diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v3/git.rb index 322b5846..2e76fa4a 100644 --- a/lib/sisu/v3/git.rb +++ b/lib/sisu/v3/git.rb @@ -136,16 +136,22 @@ module SiSU_Git end def git_init unless FileTest.directory?("#{@git_path[:fnb]}/.git") - system("cd #{@git_path[:fnb]}\ - && git init - ") + pwd=Dir.pwd + Dir.chdir(@git_path[:fnb]) + system("git init ") + Dir.chdir(pwd) end end def git_commit - system("cd #{@git_path[:fnb]} \ - && git add . \ - && git commit -a - ") + if FileTest.directory?("#{@git_path[:fnb]}") + pwd=Dir.pwd + Dir.chdir(@git_path[:fnb]) + system(" + git add . \ + && git commit -a + ") + Dir.chdir(pwd) + end end def populate def identify_language_versions -- cgit v1.2.3