matthewtodd-wordpress-release 2.7

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.
@@ -0,0 +1,15 @@
1
+ == 2.7 -- 2009-01-02
2
+
3
+ * Upgrade.
4
+
5
+ == 2.6 -- 2008-07-15
6
+
7
+ * Upgrade.
8
+
9
+ == 2.5.1 -- 2008-04-30
10
+
11
+ * Upgrade.
12
+
13
+ == 2.5 -- 2008-04-17
14
+
15
+ * Intial release!
@@ -0,0 +1 @@
1
+ Not yet.
@@ -0,0 +1 @@
1
+ * TODO could pull File::relative_path out into a separate project
@@ -0,0 +1,59 @@
1
+ require 'tmpdir'
2
+
3
+ class File #:nodoc:
4
+ def self.relative_path(*parts)
5
+ file = caller.first.split(':').first
6
+ File.join(File.dirname(file), *parts)
7
+ end
8
+ end
9
+
10
+ module Wordpress #:nodoc:
11
+ class Release
12
+ TARBALL = Dir.glob(File.relative_path('..', '..', 'resources', 'wordpress-*.tar.gz')).first
13
+ VERSION = File.basename(TARBALL).match(/wordpress-(.*).tar.gz/).captures.first
14
+
15
+ def contents(*parts)
16
+ `tar zxfO #{TARBALL} #{File.join('wordpress', *parts)}`
17
+ end
18
+
19
+ def upgrade(directory=Dir.pwd)
20
+ system 'mkdir', '-p', tmp
21
+ system 'tar', 'zxf', TARBALL, '--directory', tmp
22
+
23
+ Dir.chdir(directory) do
24
+ system 'rm', '-r', *wordpress_files if wordpress_files.any?
25
+ system 'cp', '-r', File.join(tmp, 'wordpress', '.'), '.'
26
+ end
27
+
28
+ system 'rm', '-r', tmp
29
+ end
30
+
31
+ private
32
+
33
+ def tmp
34
+ @tmp ||= File.join(Dir.tmpdir, "wordpress.#{Process.pid}")
35
+ end
36
+
37
+ def wordpress_files
38
+ # TODO if you look at this, even though it reads like the Wordpress
39
+ # upgrade documentation, it's not particularly necessary now, is it?
40
+ # delete these
41
+ files = %w( readme.html index.php wp.php xmlrpc.php license.txt )
42
+ files += Dir.glob('wp-*.php')
43
+ files += Dir.glob('wp-admin')
44
+ files += Dir.glob('wp-includes')
45
+
46
+ # but don't delete these
47
+ files -= %w( wp-config.php .htaccess robots.txt )
48
+ files -= Dir.glob('wp-content')
49
+ files -= Dir.glob('wp-images')
50
+
51
+ # but do delete these
52
+ files += Dir.glob('wp-content/themes/classic')
53
+ files += Dir.glob('wp-content/themes/default')
54
+
55
+ # if they exist
56
+ files.select { |file| File.exist?(file) }
57
+ end
58
+ end
59
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: matthewtodd-wordpress-release
3
+ version: !ruby/object:Gem::Version
4
+ version: "2.7"
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Todd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-02 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: matthew.todd@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - CHANGELOG.rdoc
24
+ - README.rdoc
25
+ - TODO.rdoc
26
+ files:
27
+ - CHANGELOG.rdoc
28
+ - README.rdoc
29
+ - TODO.rdoc
30
+ - lib/wordpress/release.rb
31
+ - resources/wordpress-2.7.tar.gz
32
+ has_rdoc: true
33
+ homepage:
34
+ post_install_message:
35
+ rdoc_options:
36
+ - --main
37
+ - README.rdoc
38
+ - --title
39
+ - wordpress-release-2.7
40
+ - --inline-source
41
+ - --line-numbers
42
+ - --all
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.2.0
61
+ signing_key:
62
+ specification_version: 2
63
+ summary: Upgrades a directory to Wordpress 2.7.
64
+ test_files: []
65
+