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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c26c72c71bd8bb74b3fcdb3a2ae4302a8b22170
4
- data.tar.gz: be929e12b15a9acbabf077e61e64095042844869
3
+ metadata.gz: 2aab5b9ce9b86829003f51b82bbc192c4c573e2e
4
+ data.tar.gz: c0074b0ac07c8f4544758df01b1ce8cd73d2e305
5
5
  SHA512:
6
- metadata.gz: bd84358d1962f3dd601947996aeee5d11734fa67e74e8cc7c64ff3bd9d1b76bf0f13a36477cd81d382a504982cd159aa4af51ddb792c7dbb016895e8fc54001d
7
- data.tar.gz: 95711a166ecd825eb9f74d8399d8e580168ffa28c50c0779bcfdf4f08ec4eac10bea524daef455c6bc7068e8c9cf7ebb2d5388cc058caba470a8f069f3150805
6
+ metadata.gz: b3ce822c5a57b292d6d031846bdc703c648c2509dc55d8f91c8dbe4c631ec8cf18bf34c6aa4590271b87ae5298a52335bee58e1beeab73538da258bfefa7b03e
7
+ data.tar.gz: 5d63e473f3a5edef32a82e67d863b9d4fef6eed2bb390288573e6b88856cb2436298055d680f2762dab784b46523efecafed3022b6cf9f0c31028b3b7cd81833
data/README.md CHANGED
@@ -20,6 +20,7 @@ Get some help:
20
20
 
21
21
  ```bash
22
22
  Options:
23
+ [--force] # Overwrite existing WP-CLI / WP-CLI Server installation
23
24
  -l, [--locale=LOCALE] # WordPress locale
24
25
  # Default: en_US
25
26
  -b, [--bare=BARE] # Remove default themes and plugins
@@ -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
@@ -1,6 +1,7 @@
1
1
  module WordPressTools
2
2
  class Database < Thor
3
3
  include CLIHelper
4
+ include SharedOptions
4
5
 
5
6
  attr_reader :db_name
6
7
 
@@ -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,3 +1,3 @@
1
1
  module WordPressTools
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  module WordPressTools
2
2
  class WordPress < Thor
3
3
  include CLIHelper
4
+ include SharedOptions
4
5
 
5
6
  attr_reader :dir_name
6
7
 
@@ -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
@@ -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.1
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