wordless 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -2
- data/features/step_definitions/wordpress_steps.rb +7 -0
- data/features/support/hooks.rb +2 -1
- data/features/wordless.feature +7 -0
- data/features/wordpress.feature +1 -1
- data/lib/wordless/cli.rb +45 -6
- data/lib/wordless/version.rb +1 -1
- data/wordless.gemspec +1 -1
- metadata +15 -13
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Wordless
|
2
2
|
|
3
|
-
|
3
|
+
A command line tool to help manage your [Wordless](http://welaika.github.com/wordless/)-based WordPress sites.
|
4
4
|
|
5
5
|
WARNING: This gem is in early development and barely does anything useful yet.
|
6
6
|
|
@@ -10,8 +10,16 @@ WARNING: This gem is in early development and barely does anything useful yet.
|
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
+
`wordless help` shows some help.
|
13
14
|
`wordless wp mysite` creates a `mysite` directory and installs the latest stable release of WordPress.
|
14
|
-
`wordless wp --locale=fr_FR --bare` installs the
|
15
|
+
`wordless wp --locale=fr_FR --bare` installs the French version of WordPress, and removes default plugins and themes.
|
16
|
+
`wordless install` installs the Wordless plugin in the current WordPress installation as a git submodule.
|
17
|
+
|
18
|
+
## Caveats
|
19
|
+
|
20
|
+
- If you attempt to download a WordPress localization that's outdated, the latest English version will be downloaded instead.
|
21
|
+
- Currently, the Wordless plugin is installed as a git submodule, so your WordPress directory must be a git repo.
|
22
|
+
- The Cucumber features run very slowly because they actually download WordPress and the Wordless plugin. I haven’t figured out how to properly stub the downloads.
|
15
23
|
|
16
24
|
## Contributing
|
17
25
|
|
@@ -1,3 +1,10 @@
|
|
1
|
+
Given /^WordPress is already installed$/ do
|
2
|
+
in_current_dir do
|
3
|
+
`git init`
|
4
|
+
end
|
5
|
+
create_dir('wp-content/plugins') # Will do for now
|
6
|
+
end
|
7
|
+
|
1
8
|
Then /^a WordPress installation should exist in directory "([^"]*)"$/ do |dir|
|
2
9
|
steps %Q{
|
3
10
|
Then the following files should exist:
|
data/features/support/hooks.rb
CHANGED
data/features/wordpress.feature
CHANGED
data/lib/wordless/cli.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'net/http'
|
3
3
|
require 'colored'
|
4
|
+
require 'rbconfig'
|
4
5
|
|
5
6
|
module Wordless
|
6
7
|
class CLI < Thor
|
7
8
|
|
8
|
-
desc "wp DIR_NAME", "
|
9
|
+
desc "wp DIR_NAME", "download the latest stable version of WordPress in a new directory DIR_NAME (default is wordpress)"
|
9
10
|
method_option :locale, :aliases => "-l", :desc => "WordPress locale (default is en_US)"
|
10
11
|
method_option :bare, :aliases => "-b", :desc => "Remove default themes and plugins"
|
11
12
|
def wp(dir_name = 'wordpress')
|
12
13
|
download_url, version, locale = Net::HTTP.get('api.wordpress.org', "/core/version-check/1.5/?locale=#{options[:locale]}").split[2,3]
|
13
14
|
downloaded_file = Tempfile.new('wordpress')
|
14
15
|
begin
|
15
|
-
puts "Downloading WordPress #{version} (#{locale})..."
|
16
|
+
puts "Downloading WordPress #{version} (#{locale})..."
|
16
17
|
`curl #{download_url} > #{downloaded_file.path} && unzip #{downloaded_file.path} -d #{dir_name}`
|
17
18
|
subdirectory = Dir["#{dir_name}/*/"].first # This is probably 'wordpress', but don't assume
|
18
19
|
FileUtils.mv Dir["#{subdirectory}*"], dir_name # Remove unnecessary directory level
|
@@ -22,21 +23,59 @@ module Wordless
|
|
22
23
|
downloaded_file.unlink
|
23
24
|
end
|
24
25
|
|
25
|
-
puts %Q{Installed WordPress in directory "#{dir_name}"}.green
|
26
|
+
puts %Q{Installed WordPress in directory "#{dir_name}".}.green
|
26
27
|
|
27
28
|
if options[:bare]
|
28
|
-
puts "Removing default themes and plugins...".green
|
29
29
|
dirs = %w(themes plugins).map {|d| "#{dir_name}/wp-content/#{d}"}
|
30
30
|
FileUtils.rm_rf dirs
|
31
31
|
FileUtils.mkdir dirs
|
32
32
|
dirs.each do |dir|
|
33
33
|
FileUtils.cp "#{dir_name}/wp-content/index.php", dir
|
34
34
|
end
|
35
|
+
puts "Removed default themes and plugins.".green
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
-
|
38
|
+
# http://stackoverflow.com/questions/4597490/platform-independent-way-of-detecting-if-git-is-installed
|
39
|
+
void = RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw/ ? 'NUL' : '/dev/null'
|
40
|
+
if git_installed?
|
41
|
+
if system 'git init'
|
42
|
+
puts "Initialized git repository.".green
|
43
|
+
else
|
44
|
+
puts "Couldn't initialize git repository.".red
|
45
|
+
end
|
46
|
+
else
|
47
|
+
puts "Didn't initialize git repository because git isn't installed.".yellow
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "new [NAME]", "download WordPress in directory [NAME], install the Wordless plugin and create a Wordless theme"
|
52
|
+
method_option :locale, :aliases => "-l", :desc => "WordPress locale (default is en_US)"
|
53
|
+
def new(name)
|
54
|
+
# upcoming
|
39
55
|
end
|
40
56
|
|
57
|
+
desc "install", "install the Wordless plugin into an existing WordPress installation as a git submodule"
|
58
|
+
def install
|
59
|
+
unless git_installed?
|
60
|
+
puts "Git is not available. Please install git.".red
|
61
|
+
return
|
62
|
+
end
|
63
|
+
|
64
|
+
unless File.directory? 'wp-content/plugins'
|
65
|
+
puts "Directory 'wp-content/plugins' not found. Make sure you're at the root level of a WordPress installation.".red
|
66
|
+
return
|
67
|
+
end
|
68
|
+
|
69
|
+
if system "git submodule add git://github.com/welaika/wordless.git wp-content/plugins/wordless && git submodule init && git submodule update"
|
70
|
+
puts "Installed Wordless plugin.".green
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def git_installed?
|
77
|
+
void = RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw/ ? 'NUL' : '/dev/null'
|
78
|
+
system "git --version >>#{void} 2>&1"
|
79
|
+
end
|
41
80
|
end
|
42
81
|
end
|
data/lib/wordless/version.rb
CHANGED
data/wordless.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["etienne@molotov.ca"]
|
7
7
|
gem.description = %q{Wordless}
|
8
8
|
gem.summary = %q{Manage Wordless themes.}
|
9
|
-
gem.homepage = "http://github.com/etienne/
|
9
|
+
gem.homepage = "http://github.com/etienne/wordless_gem"
|
10
10
|
|
11
11
|
gem.add_dependency "thor"
|
12
12
|
gem.add_dependency "colored"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70210065590180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70210065590180
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: colored
|
27
|
-
requirement: &
|
27
|
+
requirement: &70210065589560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70210065589560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70210065588060 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70210065588060
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cucumber
|
49
|
-
requirement: &
|
49
|
+
requirement: &70210065587480 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70210065587480
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: aruba
|
60
|
-
requirement: &
|
60
|
+
requirement: &70210065586840 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70210065586840
|
69
69
|
description: Wordless
|
70
70
|
email:
|
71
71
|
- etienne@molotov.ca
|
@@ -85,12 +85,13 @@ files:
|
|
85
85
|
- features/step_definitions/wordpress_steps.rb
|
86
86
|
- features/support/env.rb
|
87
87
|
- features/support/hooks.rb
|
88
|
+
- features/wordless.feature
|
88
89
|
- features/wordpress.feature
|
89
90
|
- lib/wordless.rb
|
90
91
|
- lib/wordless/cli.rb
|
91
92
|
- lib/wordless/version.rb
|
92
93
|
- wordless.gemspec
|
93
|
-
homepage: http://github.com/etienne/
|
94
|
+
homepage: http://github.com/etienne/wordless_gem
|
94
95
|
licenses: []
|
95
96
|
post_install_message:
|
96
97
|
rdoc_options: []
|
@@ -119,4 +120,5 @@ test_files:
|
|
119
120
|
- features/step_definitions/wordpress_steps.rb
|
120
121
|
- features/support/env.rb
|
121
122
|
- features/support/hooks.rb
|
123
|
+
- features/wordless.feature
|
122
124
|
- features/wordpress.feature
|