wordless 0.0.2 → 0.1.0
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/.rspec +1 -0
- data/Gemfile.lock +3 -24
- data/README.md +28 -12
- data/lib/wordless/cli.rb +59 -27
- data/lib/wordless/cli_helper.rb +42 -0
- data/lib/wordless/theme_builder.php +20 -0
- data/lib/wordless/version.rb +1 -1
- data/spec/cli_helper_spec.rb +68 -0
- data/spec/cli_spec.rb +112 -0
- data/spec/fixtures/wordpress_stub.zip +0 -0
- data/spec/fixtures/zipped_file.zip +0 -0
- data/spec/spec_helper.rb +41 -0
- data/wordless.gemspec +1 -3
- metadata +22 -43
- data/features/step_definitions/wordless_steps.rb +0 -18
- data/features/step_definitions/wordpress_steps.rb +0 -20
- data/features/support/env.rb +0 -3
- data/features/support/hooks.rb +0 -4
- data/features/wordless.feature +0 -7
- data/features/wordpress.feature +0 -6
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-c
|
data/Gemfile.lock
CHANGED
@@ -1,33 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wordless (0.0.
|
5
|
-
colored
|
4
|
+
wordless (0.0.2)
|
6
5
|
thor
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
aruba (0.4.11)
|
12
|
-
childprocess (>= 0.2.3)
|
13
|
-
cucumber (>= 1.1.1)
|
14
|
-
ffi (>= 1.0.11)
|
15
|
-
rspec (>= 2.7.0)
|
16
|
-
builder (3.0.0)
|
17
|
-
childprocess (0.3.1)
|
18
|
-
ffi (~> 1.0.6)
|
19
|
-
colored (1.2)
|
20
|
-
cucumber (1.1.9)
|
21
|
-
builder (>= 2.1.2)
|
22
|
-
diff-lcs (>= 1.1.2)
|
23
|
-
gherkin (~> 2.9.0)
|
24
|
-
json (>= 1.4.6)
|
25
|
-
term-ansicolor (>= 1.0.6)
|
26
10
|
diff-lcs (1.1.3)
|
27
|
-
|
28
|
-
gherkin (2.9.0)
|
29
|
-
json (>= 1.4.6)
|
30
|
-
json (1.6.5)
|
11
|
+
fakeweb (1.3.0)
|
31
12
|
rspec (2.8.0)
|
32
13
|
rspec-core (~> 2.8.0)
|
33
14
|
rspec-expectations (~> 2.8.0)
|
@@ -36,14 +17,12 @@ GEM
|
|
36
17
|
rspec-expectations (2.8.0)
|
37
18
|
diff-lcs (~> 1.1.2)
|
38
19
|
rspec-mocks (2.8.0)
|
39
|
-
term-ansicolor (1.0.7)
|
40
20
|
thor (0.14.6)
|
41
21
|
|
42
22
|
PLATFORMS
|
43
23
|
ruby
|
44
24
|
|
45
25
|
DEPENDENCIES
|
46
|
-
|
47
|
-
cucumber
|
26
|
+
fakeweb
|
48
27
|
rspec
|
49
28
|
wordless!
|
data/README.md
CHANGED
@@ -2,29 +2,45 @@
|
|
2
2
|
|
3
3
|
A command line tool to help manage your [Wordless](http://welaika.github.com/wordless/)-based WordPress sites.
|
4
4
|
|
5
|
-
WARNING: This gem is in early development and barely does anything useful yet.
|
6
|
-
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
7
|
+
gem install wordless
|
10
8
|
|
11
9
|
## Usage
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
Create a new Wordless-enabled WordPress site in directory `mysite`. This downloads the latest stable release of WordPress (you can also specify a locale):
|
12
|
+
|
13
|
+
wordless new mysite
|
14
|
+
wordless new mysite --locale=fr_FR
|
15
|
+
|
16
|
+
If you already have WordPress installed, you can install the Wordless plugin (this currently installs from the master branch on GitHub):
|
17
|
+
|
18
|
+
wordless install
|
19
|
+
|
20
|
+
Once Wordless is installed, you can create a new Wordless theme:
|
21
|
+
|
22
|
+
wordless theme mytheme
|
23
|
+
|
24
|
+
You can also simply install the latest stable release of WordPress, with an optional locale:
|
25
|
+
|
26
|
+
wordless wp mysite
|
27
|
+
wordless wp mysite --locale=fr_FR
|
28
|
+
|
29
|
+
Get some help:
|
30
|
+
|
31
|
+
wordless help
|
17
32
|
|
18
33
|
## Caveats
|
19
34
|
|
20
35
|
- If you attempt to download a WordPress localization that's outdated, the latest English version will be downloaded instead.
|
21
|
-
-
|
22
|
-
-
|
36
|
+
- Only tested on Mac OS X
|
37
|
+
- Specs that test installation of the plugin actually download the plugin from GitHub. This makes the specs a bit slow to run.
|
23
38
|
|
24
39
|
## Contributing
|
25
40
|
|
26
41
|
1. Fork it
|
27
42
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
-
3.
|
29
|
-
4.
|
30
|
-
5.
|
43
|
+
3. Add some specs
|
44
|
+
4. Commit your changes (`git commit -am 'Added some feature'`)
|
45
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
6. Create new Pull Request
|
data/lib/wordless/cli.rb
CHANGED
@@ -1,10 +1,29 @@
|
|
1
1
|
require 'thor'
|
2
|
+
# require 'thor/shell/basic'
|
2
3
|
require 'net/http'
|
3
|
-
require 'colored'
|
4
4
|
require 'rbconfig'
|
5
|
+
require 'tempfile'
|
6
|
+
require 'wordless/cli_helper'
|
5
7
|
|
6
8
|
module Wordless
|
7
9
|
class CLI < Thor
|
10
|
+
include Thor::Actions
|
11
|
+
include Wordless::CLIHelper
|
12
|
+
|
13
|
+
no_tasks do
|
14
|
+
def wordless_repo
|
15
|
+
'git://github.com/welaika/wordless.git'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "new NAME", "download WordPress in directory NAME, install the Wordless plugin and create a Wordless theme"
|
20
|
+
method_option :locale, :aliases => "-l", :desc => "WordPress locale (default is en_US)"
|
21
|
+
def new(name)
|
22
|
+
invoke('wp', [name], :bare => true, :locale => options['locale'])
|
23
|
+
Dir.chdir(name)
|
24
|
+
Wordless::CLI.new.invoke(:install)
|
25
|
+
invoke('theme', [name])
|
26
|
+
end
|
8
27
|
|
9
28
|
desc "wp DIR_NAME", "download the latest stable version of WordPress in a new directory DIR_NAME (default is wordpress)"
|
10
29
|
method_option :locale, :aliases => "-l", :desc => "WordPress locale (default is en_US)"
|
@@ -14,16 +33,26 @@ module Wordless
|
|
14
33
|
downloaded_file = Tempfile.new('wordpress')
|
15
34
|
begin
|
16
35
|
puts "Downloading WordPress #{version} (#{locale})..."
|
17
|
-
|
36
|
+
|
37
|
+
unless download(download_url, downloaded_file.path)
|
38
|
+
error "Couldn't download WordPress."
|
39
|
+
return
|
40
|
+
end
|
41
|
+
|
42
|
+
unless unzip(downloaded_file.path, dir_name)
|
43
|
+
error "Couldn't unzip WordPress."
|
44
|
+
return
|
45
|
+
end
|
46
|
+
|
18
47
|
subdirectory = Dir["#{dir_name}/*/"].first # This is probably 'wordpress', but don't assume
|
19
48
|
FileUtils.mv Dir["#{subdirectory}*"], dir_name # Remove unnecessary directory level
|
20
|
-
|
49
|
+
Dir.delete subdirectory
|
21
50
|
ensure
|
22
51
|
downloaded_file.close
|
23
52
|
downloaded_file.unlink
|
24
53
|
end
|
25
54
|
|
26
|
-
|
55
|
+
success %Q{Installed WordPress in directory "#{dir_name}".}
|
27
56
|
|
28
57
|
if options[:bare]
|
29
58
|
dirs = %w(themes plugins).map {|d| "#{dir_name}/wp-content/#{d}"}
|
@@ -32,50 +61,53 @@ module Wordless
|
|
32
61
|
dirs.each do |dir|
|
33
62
|
FileUtils.cp "#{dir_name}/wp-content/index.php", dir
|
34
63
|
end
|
35
|
-
|
64
|
+
success "Removed default themes and plugins."
|
36
65
|
end
|
37
66
|
|
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
67
|
if git_installed?
|
41
|
-
if
|
42
|
-
|
68
|
+
if run "cd #{dir_name} && git init", :verbose => false, :capture => true
|
69
|
+
success "Initialized git repository."
|
43
70
|
else
|
44
|
-
|
71
|
+
error "Couldn't initialize git repository."
|
45
72
|
end
|
46
73
|
else
|
47
|
-
|
74
|
+
warning "Didn't initialize git repository because git isn't installed."
|
48
75
|
end
|
49
76
|
end
|
50
77
|
|
51
|
-
desc "
|
52
|
-
method_option :locale, :aliases => "-l", :desc => "WordPress locale (default is en_US)"
|
53
|
-
def new(name)
|
54
|
-
# upcoming
|
55
|
-
end
|
56
|
-
|
57
|
-
desc "install", "install the Wordless plugin into an existing WordPress installation as a git submodule"
|
78
|
+
desc "install", "install the Wordless plugin into an existing WordPress installation"
|
58
79
|
def install
|
59
80
|
unless git_installed?
|
60
|
-
|
81
|
+
error "Git is not available. Please install git."
|
61
82
|
return
|
62
83
|
end
|
63
84
|
|
64
85
|
unless File.directory? 'wp-content/plugins'
|
65
|
-
|
86
|
+
error "Directory 'wp-content/plugins' not found. Make sure you're at the root level of a WordPress installation."
|
66
87
|
return
|
67
88
|
end
|
68
89
|
|
69
|
-
if
|
70
|
-
|
90
|
+
if add_git_repo wordless_repo, 'wp-content/plugins/wordless'
|
91
|
+
success "Installed Wordless plugin."
|
92
|
+
else
|
93
|
+
error "There was an error installing the Wordless plugin."
|
71
94
|
end
|
72
95
|
end
|
73
96
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
97
|
+
desc "theme NAME", "create a new Wordless theme NAME"
|
98
|
+
def theme(name)
|
99
|
+
unless File.directory? 'wp-content/themes'
|
100
|
+
error "Directory 'wp-content/themes' not found. Make sure you're at the root level of a WordPress installation."
|
101
|
+
return
|
102
|
+
end
|
103
|
+
|
104
|
+
# Run PHP helper script
|
105
|
+
if system "php #{File.join(File.expand_path(File.dirname(__FILE__)), 'theme_builder.php')} #{name}"
|
106
|
+
success "Created a new Wordless theme in 'wp-content/themes/#{name}'"
|
107
|
+
else
|
108
|
+
error "Couldn't create Wordless theme."
|
109
|
+
return
|
110
|
+
end
|
79
111
|
end
|
80
112
|
end
|
81
113
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module Wordless
|
4
|
+
module CLIHelper
|
5
|
+
def error(message)
|
6
|
+
say message, :red
|
7
|
+
end
|
8
|
+
|
9
|
+
def success(message)
|
10
|
+
say message, :green
|
11
|
+
end
|
12
|
+
|
13
|
+
def warning(message)
|
14
|
+
say message, :yellow
|
15
|
+
end
|
16
|
+
|
17
|
+
def download(url, destination)
|
18
|
+
begin
|
19
|
+
f = open(destination, "wb")
|
20
|
+
f.write(open(url).read) ? true : false
|
21
|
+
rescue
|
22
|
+
false
|
23
|
+
ensure
|
24
|
+
f.close
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def unzip(file, destination)
|
29
|
+
run "unzip #{file} -d #{destination}", :verbose => false, :capture => true
|
30
|
+
end
|
31
|
+
|
32
|
+
def git_installed?
|
33
|
+
# http://stackoverflow.com/questions/4597490/platform-independent-way-of-detecting-if-git-is-installed
|
34
|
+
void = RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw/ ? 'NUL' : '/dev/null'
|
35
|
+
system "git --version >>#{void} 2>&1"
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_git_repo(repo, destination)
|
39
|
+
run "git clone #{repo} #{destination}", :verbose => false, :capture => true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
$current_dir = getcwd();
|
4
|
+
$plugin_dir = "$current_dir/wp-content/plugins/wordless";
|
5
|
+
|
6
|
+
require_once "$plugin_dir/wordless/wordless.php";
|
7
|
+
require_once Wordless::join_paths($plugin_dir, "wordless", "theme_builder.php");
|
8
|
+
|
9
|
+
$theme_name = $argv[1] ? $argv[1] : 'wordless';
|
10
|
+
$permissions = substr(sprintf('%o', fileperms($plugin_dir)), -4);
|
11
|
+
|
12
|
+
# Required WordPress function
|
13
|
+
function get_template_directory() {
|
14
|
+
return Wordless::join_paths($current_dir, "wp-content", "themes", "whatever");
|
15
|
+
}
|
16
|
+
|
17
|
+
$builder = new WordlessThemeBuilder($theme_name, $theme_name, intval($permissions, 8));
|
18
|
+
$builder->build();
|
19
|
+
|
20
|
+
?>
|
data/lib/wordless/version.rb
CHANGED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Wordless::CLIHelper do
|
4
|
+
# def shell
|
5
|
+
# @shell ||= Thor::Shell::Basic.new
|
6
|
+
# end
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
@cli = Wordless::CLI.new
|
10
|
+
end
|
11
|
+
|
12
|
+
context "::download" do
|
13
|
+
before(:each) do
|
14
|
+
@tempfile = Tempfile.new("download_test")
|
15
|
+
@valid_url = "http://www.example.com/test"
|
16
|
+
FakeWeb.register_uri(:get, @valid_url, :body => "Download test")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "downloads a file to the specified location" do
|
20
|
+
@cli.download(@valid_url, @tempfile.path)
|
21
|
+
open(@tempfile.path).read.should eq("Download test")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns true on success" do
|
25
|
+
@cli.download(@valid_url, @tempfile.path).should eq true
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns false on failure" do
|
29
|
+
@cli.download("http://an.invalid.url", @tempfile.path).should eq false
|
30
|
+
end
|
31
|
+
|
32
|
+
after(:each) do
|
33
|
+
@tempfile.close!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "::unzip" do
|
38
|
+
it "unzips a file" do
|
39
|
+
@cli.unzip(File.expand_path('spec/fixtures/zipped_file.zip'), 'tmp/unzip')
|
40
|
+
File.exists?('tmp/unzip/zipped_file').should be true
|
41
|
+
end
|
42
|
+
|
43
|
+
after(:each) do
|
44
|
+
FileUtils.rm_rf('tmp/unzip') if File.directory? 'tmp/unzip'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "::error" do
|
49
|
+
it "displays an error" do
|
50
|
+
$stdout.should_receive(:puts).with("\e[31mI am an error\e[0m")
|
51
|
+
@cli.error("I am an error")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "::success" do
|
56
|
+
it "displays a success message" do
|
57
|
+
$stdout.should_receive(:puts).with("\e[32mI am a success message\e[0m")
|
58
|
+
@cli.success("I am a success message")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context "::warning" do
|
63
|
+
it "displays a warning" do
|
64
|
+
$stdout.should_receive(:puts).with("\e[33mI am a warning\e[0m")
|
65
|
+
@cli.warning("I am a warning")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/spec/cli_spec.rb
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Wordless::CLI do
|
4
|
+
before :each do
|
5
|
+
# $stdout = StringIO.new
|
6
|
+
@original_wd = Dir.pwd
|
7
|
+
wp_api_response = <<-eof
|
8
|
+
upgrade
|
9
|
+
http://wordpress.org/download/
|
10
|
+
http://wordpress.org/wordpress-3.3.1.zip
|
11
|
+
3.3.1
|
12
|
+
en_US
|
13
|
+
5.2.4
|
14
|
+
5.0
|
15
|
+
eof
|
16
|
+
FakeWeb.register_uri(:get, %r|http://api.wordpress.org/core/version-check/1.5/.*|, :body => wp_api_response)
|
17
|
+
FakeWeb.register_uri(:get, "http://wordpress.org/wordpress-3.3.1.zip", :body => File.expand_path('spec/fixtures/wordpress_stub.zip'))
|
18
|
+
Dir.chdir('tmp')
|
19
|
+
end
|
20
|
+
|
21
|
+
context "#new" do
|
22
|
+
it "downloads a copy of WordPress, installs Wordless and creates a theme" do
|
23
|
+
Wordless::CLI.start ['new', 'myapp']
|
24
|
+
File.exists?('wp-content/index.php').should eq true
|
25
|
+
(File.exists?('wp-content/plugins/plugin.php') || File.directory?('wp-content/themes/theme')).should eq false
|
26
|
+
File.directory?('wp-content/plugins/wordless').should eq true
|
27
|
+
File.directory?('wp-content/themes/myapp').should eq true
|
28
|
+
File.exists?('wp-content/themes/myapp/index.php').should eq true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "#wp" do
|
33
|
+
context "with no arguments" do
|
34
|
+
it "downloads a copy of WordPress" do
|
35
|
+
Wordless::CLI.start ['wp']
|
36
|
+
File.exists?('wordpress/wp-content/index.php').should eq true
|
37
|
+
end
|
38
|
+
|
39
|
+
it "initializes a git repository" do
|
40
|
+
Wordless::CLI.start ['wp']
|
41
|
+
File.directory?('wordpress/.git').should eq true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "doesn't leave a stray 'wordpress' directory" do
|
45
|
+
Wordless::CLI.start ['wp']
|
46
|
+
File.directory?('wordpress/wordpress').should eq false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "with a custom directory name" do
|
51
|
+
it "downloads a copy of WordPress in directory 'myapp'" do
|
52
|
+
Wordless::CLI.start ['wp', 'myapp']
|
53
|
+
File.exists?('myapp/wp-content/index.php').should eq true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "with the 'bare' option" do
|
58
|
+
it "downloads a copy of WordPress and removes default plugins and themes" do
|
59
|
+
Wordless::CLI.start ['wp', '--bare']
|
60
|
+
(File.exists?('wordpress/wp-content/plugins/plugin.php') || File.directory?('wordpress/wp-content/themes/theme')).should eq false
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "#install" do
|
66
|
+
context "with a valid WordPress installation" do
|
67
|
+
it "installs the Wordless plugin" do
|
68
|
+
Wordless::CLI.start ['wp']
|
69
|
+
Dir.chdir 'wordpress'
|
70
|
+
Wordless::CLI.start ['install']
|
71
|
+
File.directory?('wp-content/plugins/wordless').should eq true
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "without a valid WordPress installation" do
|
76
|
+
it "fails to install the Wordless plugin" do
|
77
|
+
content = capture(:stdout) { Wordless::CLI.start ['install'] }
|
78
|
+
content.should =~ %r|Directory 'wp-content/plugins' not found|
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context "#theme" do
|
84
|
+
context "with a valid WordPress installation and the Wordless plugin" do
|
85
|
+
before :each do
|
86
|
+
Wordless::CLI.start ['wp']
|
87
|
+
Dir.chdir 'wordpress'
|
88
|
+
Wordless::CLI.start ['install']
|
89
|
+
end
|
90
|
+
|
91
|
+
it "creates a Wordless theme" do
|
92
|
+
Wordless::CLI.start ['theme', 'mytheme']
|
93
|
+
File.directory?('wp-content/themes/mytheme').should eq true
|
94
|
+
File.exists?('wp-content/themes/mytheme/index.php').should eq true
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context "without a valid WordPress installation" do
|
99
|
+
it "fails to create a Wordless theme" do
|
100
|
+
content = capture(:stdout) { Wordless::CLI.start ['theme', 'mytheme'] }
|
101
|
+
content.should =~ %r|Directory 'wp-content/themes' not found|
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
after :each do
|
107
|
+
Dir.chdir(@original_wd)
|
108
|
+
%w(tmp/wordpress tmp/myapp).each do |dir|
|
109
|
+
FileUtils.rm_rf(dir) if File.directory? dir
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
Binary file
|
Binary file
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'wordless/cli'
|
2
|
+
require 'fakeweb'
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
# Set shell to basic
|
6
|
+
# $0 = "thor"
|
7
|
+
# $thor_runner = true
|
8
|
+
# ARGV.clear
|
9
|
+
# Thor::Base.shell = Thor::Shell::Basic
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
FakeWeb.allow_net_connect = false
|
13
|
+
|
14
|
+
$stdout = StringIO.new
|
15
|
+
|
16
|
+
# Stub Wordless::CLI#wordless_repo to avoid hitting the network when testing Wordless installation
|
17
|
+
# FIXME - Need to be able to selectively stub this
|
18
|
+
# config.before(:each, :stub_wordless_install => true) do
|
19
|
+
# module Wordless
|
20
|
+
# class CLI
|
21
|
+
# no_tasks do
|
22
|
+
# def wordless_repo
|
23
|
+
# File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'wordless_stub'))
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
|
30
|
+
def capture(stream)
|
31
|
+
begin
|
32
|
+
stream = stream.to_s
|
33
|
+
eval "$#{stream} = StringIO.new"
|
34
|
+
yield
|
35
|
+
result = eval("$#{stream}").string
|
36
|
+
ensure
|
37
|
+
eval("$#{stream} = #{stream.upcase}")
|
38
|
+
end
|
39
|
+
result
|
40
|
+
end
|
41
|
+
end
|
data/wordless.gemspec
CHANGED
@@ -9,11 +9,9 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.homepage = "http://github.com/etienne/wordless_gem"
|
10
10
|
|
11
11
|
gem.add_dependency "thor"
|
12
|
-
gem.add_dependency "colored"
|
13
12
|
|
14
13
|
gem.add_development_dependency 'rspec'
|
15
|
-
gem.add_development_dependency
|
16
|
-
gem.add_development_dependency "aruba"
|
14
|
+
gem.add_development_dependency 'fakeweb'
|
17
15
|
|
18
16
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
17
|
gem.files = `git ls-files`.split("\n")
|
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.1.0
|
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-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70226020702320 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,32 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: colored
|
27
|
-
requirement: &70210065589560 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70210065589560
|
24
|
+
version_requirements: *70226020702320
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
26
|
name: rspec
|
38
|
-
requirement: &
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
-
type: :development
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *70210065588060
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: cucumber
|
49
|
-
requirement: &70210065587480 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70226020701760 !ruby/object:Gem::Requirement
|
50
28
|
none: false
|
51
29
|
requirements:
|
52
30
|
- - ! '>='
|
@@ -54,10 +32,10 @@ dependencies:
|
|
54
32
|
version: '0'
|
55
33
|
type: :development
|
56
34
|
prerelease: false
|
57
|
-
version_requirements: *
|
35
|
+
version_requirements: *70226020701760
|
58
36
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement: &
|
37
|
+
name: fakeweb
|
38
|
+
requirement: &70226020701200 !ruby/object:Gem::Requirement
|
61
39
|
none: false
|
62
40
|
requirements:
|
63
41
|
- - ! '>='
|
@@ -65,7 +43,7 @@ dependencies:
|
|
65
43
|
version: '0'
|
66
44
|
type: :development
|
67
45
|
prerelease: false
|
68
|
-
version_requirements: *
|
46
|
+
version_requirements: *70226020701200
|
69
47
|
description: Wordless
|
70
48
|
email:
|
71
49
|
- etienne@molotov.ca
|
@@ -75,21 +53,23 @@ extensions: []
|
|
75
53
|
extra_rdoc_files: []
|
76
54
|
files:
|
77
55
|
- .gitignore
|
56
|
+
- .rspec
|
78
57
|
- Gemfile
|
79
58
|
- Gemfile.lock
|
80
59
|
- LICENSE
|
81
60
|
- README.md
|
82
61
|
- Rakefile
|
83
62
|
- bin/wordless
|
84
|
-
- features/step_definitions/wordless_steps.rb
|
85
|
-
- features/step_definitions/wordpress_steps.rb
|
86
|
-
- features/support/env.rb
|
87
|
-
- features/support/hooks.rb
|
88
|
-
- features/wordless.feature
|
89
|
-
- features/wordpress.feature
|
90
63
|
- lib/wordless.rb
|
91
64
|
- lib/wordless/cli.rb
|
65
|
+
- lib/wordless/cli_helper.rb
|
66
|
+
- lib/wordless/theme_builder.php
|
92
67
|
- lib/wordless/version.rb
|
68
|
+
- spec/cli_helper_spec.rb
|
69
|
+
- spec/cli_spec.rb
|
70
|
+
- spec/fixtures/wordpress_stub.zip
|
71
|
+
- spec/fixtures/zipped_file.zip
|
72
|
+
- spec/spec_helper.rb
|
93
73
|
- wordless.gemspec
|
94
74
|
homepage: http://github.com/etienne/wordless_gem
|
95
75
|
licenses: []
|
@@ -116,9 +96,8 @@ signing_key:
|
|
116
96
|
specification_version: 3
|
117
97
|
summary: Manage Wordless themes.
|
118
98
|
test_files:
|
119
|
-
-
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
123
|
-
-
|
124
|
-
- features/wordpress.feature
|
99
|
+
- spec/cli_helper_spec.rb
|
100
|
+
- spec/cli_spec.rb
|
101
|
+
- spec/fixtures/wordpress_stub.zip
|
102
|
+
- spec/fixtures/zipped_file.zip
|
103
|
+
- spec/spec_helper.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
Then /^the Wordless plugin should be installed$/ do
|
2
|
-
plugin_root = 'wp-content/plugins/wordless'
|
3
|
-
steps %Q{
|
4
|
-
Then the following files should exist:
|
5
|
-
| #{plugin_root}/wordless.php |
|
6
|
-
| #{plugin_root}/wordless/wordless.php |
|
7
|
-
}
|
8
|
-
end
|
9
|
-
|
10
|
-
Then /^a Wordless theme called "([^"]*)" should exist$/ do |name|
|
11
|
-
theme_root = "wp-content/themes/#{name}"
|
12
|
-
steps %Q{
|
13
|
-
Then the following files should exist:
|
14
|
-
| #{theme_root}/index.php |
|
15
|
-
| #{theme_root}/style.css |
|
16
|
-
| #{theme_root}/config/initializers/wordless_preferences.php |
|
17
|
-
}
|
18
|
-
end
|
@@ -1,20 +0,0 @@
|
|
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
|
-
|
8
|
-
Then /^a WordPress installation should exist in directory "([^"]*)"$/ do |dir|
|
9
|
-
steps %Q{
|
10
|
-
Then the following files should exist:
|
11
|
-
| #{dir}/index.php |
|
12
|
-
| #{dir}/wp-activate.php |
|
13
|
-
| #{dir}/wp-config-sample.php |
|
14
|
-
| #{dir}/wp-settings.php |
|
15
|
-
Then the following directories should exist:
|
16
|
-
| #{dir}/wp-content |
|
17
|
-
| #{dir}/wp-admin |
|
18
|
-
| #{dir}/wp-includes |
|
19
|
-
}
|
20
|
-
end
|
data/features/support/env.rb
DELETED
data/features/support/hooks.rb
DELETED
data/features/wordless.feature
DELETED