wpplugin 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/wpplugin.rb +23 -4
- metadata +5 -5
data/lib/wpplugin.rb
CHANGED
@@ -22,7 +22,7 @@ require 'pathname'
|
|
22
22
|
|
23
23
|
class WPPlugin
|
24
24
|
|
25
|
-
VERSION = '0.
|
25
|
+
VERSION = '0.2'
|
26
26
|
|
27
27
|
def initialize
|
28
28
|
command = ARGV.shift
|
@@ -41,7 +41,7 @@ class WPPlugin
|
|
41
41
|
info
|
42
42
|
when nil, :"--help", :"-h"
|
43
43
|
exit_message "Usage: wpplugin update\n wpplugin [update|add|remove] {plugin-slug}"
|
44
|
-
when :add, :remove
|
44
|
+
when :add, :remove, :install, :delete, :uninstall
|
45
45
|
exit_error_message "You must provide a plugin slug" if plugin.nil?
|
46
46
|
send command, plugin
|
47
47
|
when :update, :upgrade
|
@@ -56,8 +56,9 @@ class WPPlugin
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def update plugin
|
59
|
-
|
59
|
+
remove_files plugin
|
60
60
|
add plugin
|
61
|
+
`svn status #{plugin} 2>/dev/null | grep '\!' | awk '{print $2;}' | xargs svn rm`
|
61
62
|
end
|
62
63
|
|
63
64
|
def update_all
|
@@ -67,16 +68,34 @@ class WPPlugin
|
|
67
68
|
end
|
68
69
|
|
69
70
|
def add plugin
|
71
|
+
# If the directory exists, do an update instead
|
72
|
+
if File.directory? plugin
|
73
|
+
update plugin
|
74
|
+
return
|
75
|
+
end
|
70
76
|
uri = "http://downloads.wordpress.org/plugin/#{plugin}.latest-stable.zip"
|
71
77
|
`wget -O #{plugin}.zip #{uri} > /dev/null 2>&1`
|
72
78
|
`unzip #{plugin}.zip > /dev/null 2>&1`
|
73
79
|
`rm #{plugin}.zip > /dev/null 2>&1`
|
80
|
+
`svn add --force #{plugin} > /dev/null 2>&1`
|
81
|
+
`git add --all #{plugin} > /dev/null 2>&1`
|
74
82
|
end
|
75
83
|
|
76
|
-
|
84
|
+
alias :install :add
|
85
|
+
|
86
|
+
def remove_files plugin
|
77
87
|
FileUtils.rm_rf plugin if File.directory? plugin
|
78
88
|
end
|
79
89
|
|
90
|
+
def remove plugin
|
91
|
+
remove_files plugin
|
92
|
+
`svn rm #{plugin} > /dev/null 2>&1`
|
93
|
+
`git rm -r #{plugin} > /dev/null 2>&1`
|
94
|
+
end
|
95
|
+
|
96
|
+
alias :delete :remove
|
97
|
+
alias :uninstall :remove
|
98
|
+
|
80
99
|
def info
|
81
100
|
puts "WPPlugin #{self.class::VERSION}"
|
82
101
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wpplugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 2
|
9
|
+
version: "0.2"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mark Jaquith
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-
|
17
|
+
date: 2012-09-17 00:00:00 Z
|
18
18
|
dependencies: []
|
19
19
|
|
20
20
|
description: WPPlugin is a command line tool that updates WordPress plugins. Great for WordPress installs that live in a Git repository.
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements: []
|
63
63
|
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.8.
|
65
|
+
rubygems_version: 1.8.24
|
66
66
|
signing_key:
|
67
67
|
specification_version: 3
|
68
68
|
summary: Command line tool for updating WordPress plugins
|