wordpress_tools 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/wordpress_tools/cli.rb +3 -2
- data/lib/wordpress_tools/cli_helper.rb +0 -22
- data/lib/wordpress_tools/database.rb +1 -0
- data/lib/wordpress_tools/shared_options.rb +27 -0
- data/lib/wordpress_tools/version.rb +1 -1
- data/lib/wordpress_tools/wordpress.rb +1 -0
- data/lib/wordpress_tools/wp_cli_core.rb +3 -1
- data/lib/wordpress_tools/wp_cli_server.rb +3 -1
- data/lib/wordpress_tools.rb +4 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aab5b9ce9b86829003f51b82bbc192c4c573e2e
|
4
|
+
data.tar.gz: c0074b0ac07c8f4544758df01b1ce8cd73d2e305
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3ce822c5a57b292d6d031846bdc703c648c2509dc55d8f91c8dbe4c631ec8cf18bf34c6aa4590271b87ae5298a52335bee58e1beeab73538da258bfefa7b03e
|
7
|
+
data.tar.gz: 5d63e473f3a5edef32a82e67d863b9d4fef6eed2bb390288573e6b88856cb2436298055d680f2762dab784b46523efecafed3022b6cf9f0c31028b3b7cd81833
|
data/README.md
CHANGED
data/lib/wordpress_tools/cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module WordPressTools
|
2
2
|
class CLI < Thor
|
3
3
|
include CLIHelper
|
4
|
+
include SharedOptions
|
4
5
|
|
5
6
|
desc "new [DIR_NAME]", "download the latest stable version of WordPress in a new directory with specified name (default is wordpress)"
|
6
7
|
add_method_options(shared_options)
|
@@ -12,8 +13,8 @@ module WordPressTools
|
|
12
13
|
|
13
14
|
info("Starting...")
|
14
15
|
|
15
|
-
WPCLICore.new.invoke :install
|
16
|
-
WPCLIServer.new.invoke :install
|
16
|
+
WPCLICore.new.invoke :install, [], options
|
17
|
+
WPCLIServer.new.invoke :install, [], options
|
17
18
|
Database.new.invoke :create, [dir_name], options
|
18
19
|
WordPress.new.invoke :download, [dir_name], options
|
19
20
|
WordPress.new.invoke :setup, [dir_name], options
|
@@ -1,29 +1,7 @@
|
|
1
1
|
module WordPressTools
|
2
2
|
module CLIHelper
|
3
|
-
extend ActiveSupport::Concern
|
4
3
|
include Thor::Actions
|
5
4
|
|
6
|
-
class_methods do
|
7
|
-
def shared_options
|
8
|
-
[
|
9
|
-
[:locale, { aliases: "-l", desc: "WordPress locale", default: Configuration.for(:locale)}],
|
10
|
-
[:bare, {aliases: "-b", desc: "Remove default themes and plugins"}],
|
11
|
-
[:admin_user, { desc: "WordPress admin user", default: Configuration.for(:admin_user)}],
|
12
|
-
[:admin_email, {desc: "WordPress admin email", default: Configuration.for(:admin_email)}],
|
13
|
-
[:admin_password, {desc: "WordPress admin password", default: Configuration.for(:admin_password)}],
|
14
|
-
[:db_user, {desc: "MySQL database user", default: Configuration.for(:db_user)}],
|
15
|
-
[:db_password, {desc: "MySQL database pasword", default: Configuration.for(:db_password)}],
|
16
|
-
[:site_url, {desc: "Wordpress site URL", default: Configuration.for(:site_url)}]
|
17
|
-
]
|
18
|
-
end
|
19
|
-
|
20
|
-
def add_method_options(options)
|
21
|
-
options.each do |option|
|
22
|
-
method_option(*option)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
5
|
def info(message)
|
28
6
|
say message
|
29
7
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module WordPressTools
|
2
|
+
module SharedOptions
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
class_methods do
|
6
|
+
def shared_options
|
7
|
+
[
|
8
|
+
[:force, {type: :boolean, desc: "Overwrite existing WP-CLI / WP-CLI Server installation"}],
|
9
|
+
[:locale, { aliases: "-l", desc: "WordPress locale", default: Configuration.for(:locale)}],
|
10
|
+
[:bare, {aliases: "-b", desc: "Remove default themes and plugins"}],
|
11
|
+
[:admin_user, { desc: "WordPress admin user", default: Configuration.for(:admin_user)}],
|
12
|
+
[:admin_email, {desc: "WordPress admin email", default: Configuration.for(:admin_email)}],
|
13
|
+
[:admin_password, {desc: "WordPress admin password", default: Configuration.for(:admin_password)}],
|
14
|
+
[:db_user, {desc: "MySQL database user", default: Configuration.for(:db_user)}],
|
15
|
+
[:db_password, {desc: "MySQL database pasword", default: Configuration.for(:db_password)}],
|
16
|
+
[:site_url, {desc: "Wordpress site URL", default: Configuration.for(:site_url)}]
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_method_options(options)
|
21
|
+
options.each do |option|
|
22
|
+
method_option(*option)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module WordPressTools
|
2
2
|
class WPCLICore < Thor
|
3
3
|
include CLIHelper
|
4
|
+
include SharedOptions
|
4
5
|
|
5
6
|
desc "install", ""
|
7
|
+
add_method_options(shared_options)
|
6
8
|
def install
|
7
9
|
return unless overwrite?
|
8
10
|
|
@@ -20,7 +22,7 @@ module WordPressTools
|
|
20
22
|
|
21
23
|
no_tasks do
|
22
24
|
def overwrite?
|
23
|
-
if installed?
|
25
|
+
if installed? && options[:force] != true
|
24
26
|
yes? "WP-CLI already installed [#{install_path}]. Do you want to overwite it? [y]es, [N]o"
|
25
27
|
else
|
26
28
|
true
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module WordPressTools
|
2
2
|
class WPCLIServer < Thor
|
3
3
|
include CLIHelper
|
4
|
+
include SharedOptions
|
4
5
|
|
5
6
|
desc "install", ""
|
7
|
+
add_method_options(shared_options)
|
6
8
|
def install
|
7
9
|
return unless overwrite?
|
8
10
|
|
@@ -13,7 +15,7 @@ module WordPressTools
|
|
13
15
|
|
14
16
|
no_tasks do
|
15
17
|
def overwrite?
|
16
|
-
if installed?
|
18
|
+
if installed? && options[:force] != true
|
17
19
|
yes? "WP-CLI server command already installed [#{install_dir}]. Do you want to overwite it? [y]es, [N]o"
|
18
20
|
else
|
19
21
|
true
|
data/lib/wordpress_tools.rb
CHANGED
@@ -4,11 +4,12 @@ require "thor"
|
|
4
4
|
require "active_support"
|
5
5
|
require "active_support/all"
|
6
6
|
|
7
|
-
require "wordpress_tools/version"
|
8
|
-
require "wordpress_tools/config"
|
9
7
|
require "wordpress_tools/cli_helper"
|
8
|
+
require "wordpress_tools/shared_options"
|
9
|
+
require "wordpress_tools/config"
|
10
10
|
require "wordpress_tools/cli"
|
11
|
+
require "wordpress_tools/database"
|
12
|
+
require "wordpress_tools/version"
|
11
13
|
require "wordpress_tools/wordpress"
|
12
14
|
require "wordpress_tools/wp_cli_core"
|
13
15
|
require "wordpress_tools/wp_cli_server"
|
14
|
-
require "wordpress_tools/database"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordpress_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Étienne Després"
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/wordpress_tools/cli_helper.rb
|
157
157
|
- lib/wordpress_tools/config.rb
|
158
158
|
- lib/wordpress_tools/database.rb
|
159
|
+
- lib/wordpress_tools/shared_options.rb
|
159
160
|
- lib/wordpress_tools/version.rb
|
160
161
|
- lib/wordpress_tools/wordpress.rb
|
161
162
|
- lib/wordpress_tools/wp_cli_core.rb
|