From 3aab4526f644600ce44bb335ba1019ab7214248d Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 12 Jan 2012 01:58:51 -0500 Subject: [PATCH] Do git and svn magic. Svn 1.7 required. --- lib/wpplugin.rb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/wpplugin.rb b/lib/wpplugin.rb index 57ee1fc..2d7b1d9 100755 --- a/lib/wpplugin.rb +++ b/lib/wpplugin.rb @@ -22,7 +22,7 @@ class WPPlugin - VERSION = '0.2-beta' + VERSION = '0.2beta1' def initialize command = ARGV.shift @@ -56,11 +56,9 @@ def initialize end def update plugin - # Gotta add some git and svn magic here for deleted files - # e.g. svn status . | grep '\!' | awk '{print $2;}' | xargs svn rm - # e.g. git add --all . - remove plugin + remove_files plugin add plugin + `svn status #{plugin} | grep '\!' | awk '{print $2;}' | xargs svn rm` end def update_all @@ -74,12 +72,20 @@ def add plugin `wget -O #{plugin}.zip #{uri} > /dev/null 2>&1` `unzip #{plugin}.zip > /dev/null 2>&1` `rm #{plugin}.zip > /dev/null 2>&1` + `svn add --force #{plugin} > /dev/null 2>&1` + `git add --all #{plugin} > /dev/null 2>&1` end - def remove plugin + def remove_files plugin FileUtils.rm_rf plugin if File.directory? plugin end + def remove plugin + remove_files plugin + `svn rm #{plugin} > /dev/null 2>&1` + `git rm -r #{plugin} > /dev/null 2>&1` + end + def info puts "WPPlugin #{self.class::VERSION}" end