You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2019/12/04 16:15:33 UTC

[whimsy] branch master updated: add a clean option

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 93258af  add a clean option
93258af is described below

commit 93258afbbf174793843cc97f51af476305c9210a
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Dec 4 11:15:17 2019 -0500

    add a clean option
---
 config/setupmymac | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/config/setupmymac b/config/setupmymac
index e4d63cb..d7b23a1 100755
--- a/config/setupmymac
+++ b/config/setupmymac
@@ -34,7 +34,7 @@ $dry_run = false
 restart_apache = false
 $brew_updated = false
 
-force = {}
+force = {clean: false}
 force[:svn] = true unless Dir.exists? '/srv/svn'
 force[:git] = true unless Dir.exists? '/srv/git'
 
@@ -147,6 +147,10 @@ OptionParser.new do |opts|
     force.default = true
   end
 
+  opts.on('--[no-]clean', "Clean up source directory") do |opt|
+    force[:clean] = opt
+  end
+
   opts.on('--dry-run', "Only indicate what commands would be run") do |opt|
     $dry_run = true
   end
@@ -232,6 +236,14 @@ if not Dir.exist? '/srv/whimsy'
   end
 end
 
+# clean source
+if force[:clean] and not $root
+  Dir.chdir '/srv/whimsy' do
+    run 'git', 'reset', '--hard'
+    run 'git', 'clean', '-fxd'
+  end
+end
+
 # update source
 if force[:source] and not $root
   Dir.chdir '/srv/whimsy' do