wordpress_tools 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +55 -0
- data/Rakefile +7 -7
- data/lib/wordpress_tools/cli.rb +3 -3
- data/lib/wordpress_tools/config.rb +0 -3
- data/lib/wordpress_tools/database.rb +10 -3
- data/lib/wordpress_tools/shared_options.rb +31 -9
- data/lib/wordpress_tools/version.rb +1 -1
- data/lib/wordpress_tools/wp_cli_core.rb +9 -3
- data/wordpress_tools.gemspec +22 -11
- metadata +30 -30
- data/templates/wp_cli_config.yml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b6f9177d92343495b44611738f38bf7e2eb3200
|
4
|
+
data.tar.gz: 25e3a913dc283033b546b0d4ed75452b7e698668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6d9a25fd425b1bbc6def8314b8409b52d3fe3db1b442e38859ace7527276a7a9bf4cc315b0f176f8056762d61b04c1343f0513b2ec72d42e717ab6b37ae06fb
|
7
|
+
data.tar.gz: f2ad8407c789e7132a53ddb586f95b65d8c36f7ecc72cf059474d02af7f847b4a0e848d822e7bb8215f1f7d84381e5edd779300d342996329f4e4cfa1ffe983e
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
Rails:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Rails/Output:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.4
|
9
|
+
DisplayCopNames: true
|
10
|
+
DisplayStyleGuide: true
|
11
|
+
|
12
|
+
Exclude:
|
13
|
+
- 'bin/*'
|
14
|
+
- 'spec/fixtures/**/*'
|
15
|
+
|
16
|
+
Metrics/LineLength:
|
17
|
+
Max: 100
|
18
|
+
|
19
|
+
Metrics/MethodLength:
|
20
|
+
Max: 20
|
21
|
+
|
22
|
+
Metrics/ClassLength:
|
23
|
+
Max: 200
|
24
|
+
|
25
|
+
Metrics/BlockLength:
|
26
|
+
Exclude:
|
27
|
+
- 'spec/**/*_spec.rb'
|
28
|
+
- 'spec/factories/*.rb'
|
29
|
+
- '*.gemspec'
|
30
|
+
|
31
|
+
Metrics/CyclomaticComplexity:
|
32
|
+
Max: 10
|
33
|
+
|
34
|
+
Metrics/PerceivedComplexity:
|
35
|
+
Max: 10
|
36
|
+
|
37
|
+
Style/StringLiterals:
|
38
|
+
Enabled: false
|
39
|
+
EnforcedStyle: double_quotes
|
40
|
+
|
41
|
+
Style/Documentation:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/FrozenStringLiteralComment:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Metrics/AbcSize:
|
48
|
+
Max: 40
|
49
|
+
|
50
|
+
Lint/HandleExceptions:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Style/FormatStringToken:
|
54
|
+
Exclude:
|
55
|
+
- 'lib/wordless/wordless_cli.rb'
|
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# no rspec available
|
9
|
-
end
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
task default: :spec
|
7
|
+
|
8
|
+
RuboCop::RakeTask.new(:rubocop)
|
9
|
+
task default: :rubocop
|
data/lib/wordpress_tools/cli.rb
CHANGED
@@ -3,7 +3,8 @@ module WordPressTools
|
|
3
3
|
include CLIHelper
|
4
4
|
include SharedOptions
|
5
5
|
|
6
|
-
desc "new [DIR_NAME]", "download the latest stable version of WordPress in
|
6
|
+
desc "new [DIR_NAME]", "download the latest stable version of WordPress in
|
7
|
+
a new directory with specified name (default is wordpress)"
|
7
8
|
add_method_options(shared_options)
|
8
9
|
def new(dir_name = 'wordpress')
|
9
10
|
if File.exist?(dir_name)
|
@@ -13,8 +14,8 @@ module WordPressTools
|
|
13
14
|
|
14
15
|
info("Starting...")
|
15
16
|
|
16
|
-
WPCLICore.new.invoke :install, [], options
|
17
17
|
Database.new.invoke :create, [dir_name], options
|
18
|
+
WPCLICore.new.invoke :install, [], options
|
18
19
|
WordPress.new.invoke :download, [dir_name], options
|
19
20
|
WordPress.new.invoke :setup, [dir_name], options
|
20
21
|
|
@@ -22,4 +23,3 @@ module WordPressTools
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
25
|
-
|
@@ -1,10 +1,8 @@
|
|
1
1
|
module WordPressTools
|
2
2
|
class Configuration
|
3
|
-
|
4
3
|
DEFAULT_CONFIG = {
|
5
4
|
wp_cli_download_url: "https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar",
|
6
5
|
wp_cli_path: "/usr/local/bin/wp",
|
7
|
-
wp_cli_config_path: "~/.wp-cli/config.yml",
|
8
6
|
admin_user: "admin",
|
9
7
|
admin_email: "admin@example.com",
|
10
8
|
admin_password: "password",
|
@@ -17,6 +15,5 @@ module WordPressTools
|
|
17
15
|
def self.for(key)
|
18
16
|
DEFAULT_CONFIG[key]
|
19
17
|
end
|
20
|
-
|
21
18
|
end
|
22
19
|
end
|
@@ -18,15 +18,22 @@ module WordPressTools
|
|
18
18
|
|
19
19
|
no_tasks do
|
20
20
|
def create_database
|
21
|
-
run_command(mysql_create_command) ||
|
21
|
+
run_command(mysql_create_command) ||
|
22
|
+
error("Cannot create database '#{db_name}'. Already exists?")
|
22
23
|
end
|
23
24
|
|
24
25
|
def test_login
|
25
|
-
run_command("#{mysql_command} --execute='QUIT'") ||
|
26
|
+
run_command("#{mysql_command} --execute='QUIT'") ||
|
27
|
+
error("Cannot login to MySQL. Wrong credentials?")
|
26
28
|
end
|
27
29
|
|
28
30
|
def mysql_create_command
|
29
|
-
|
31
|
+
[
|
32
|
+
mysql_command,
|
33
|
+
"--execute='CREATE DATABASE ",
|
34
|
+
db_name,
|
35
|
+
"DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;'"
|
36
|
+
].join
|
30
37
|
end
|
31
38
|
|
32
39
|
def mysql_command
|
@@ -5,15 +5,37 @@ module WordPressTools
|
|
5
5
|
class_methods do
|
6
6
|
def shared_options
|
7
7
|
[
|
8
|
-
[:force, {
|
9
|
-
|
10
|
-
|
11
|
-
[:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
[:
|
8
|
+
[:force, {
|
9
|
+
type: :boolean, desc: "Overwrite existing WP-CLI installation"
|
10
|
+
}],
|
11
|
+
[:locale, {
|
12
|
+
aliases: "-l",
|
13
|
+
desc: "WordPress locale",
|
14
|
+
default: Configuration.for(:locale)
|
15
|
+
}],
|
16
|
+
[:bare, {
|
17
|
+
type: :boolean,
|
18
|
+
aliases: "-b",
|
19
|
+
desc: "Remove default themes and plugins"
|
20
|
+
}],
|
21
|
+
[:admin_user, {
|
22
|
+
desc: "WordPress admin user", default: Configuration.for(:admin_user)
|
23
|
+
}],
|
24
|
+
[:admin_email, {
|
25
|
+
desc: "WordPress admin email", default: Configuration.for(:admin_email)
|
26
|
+
}],
|
27
|
+
[:admin_password, {
|
28
|
+
desc: "WordPress admin password", default: Configuration.for(:admin_password)
|
29
|
+
}],
|
30
|
+
[:db_user, {
|
31
|
+
desc: "MySQL database user", default: Configuration.for(:db_user)
|
32
|
+
}],
|
33
|
+
[:db_password, {
|
34
|
+
desc: "MySQL database pasword", default: Configuration.for(:db_password)
|
35
|
+
}],
|
36
|
+
[:site_url, {
|
37
|
+
desc: "Wordpress site URL", default: Configuration.for(:site_url)
|
38
|
+
}]
|
17
39
|
]
|
18
40
|
end
|
19
41
|
|
@@ -35,21 +35,27 @@ module WordPressTools
|
|
35
35
|
|
36
36
|
def download
|
37
37
|
info("Downloading WP-CLI...")
|
38
|
-
get(download_url, download_path, verbose: false, force: true) ||
|
38
|
+
get(download_url, download_path, verbose: false, force: true) ||
|
39
|
+
error("Cannot download WP-CLI")
|
40
|
+
|
39
41
|
success("Downloaded WP-CLI")
|
40
42
|
end
|
41
43
|
|
42
44
|
def move
|
43
45
|
info("Installing WP-CLI...")
|
44
46
|
need_sudo = !File.writable?(install_dir)
|
45
|
-
run_command(move_command(download_path, install_path, need_sudo)) ||
|
47
|
+
run_command(move_command(download_path, install_path, need_sudo)) ||
|
48
|
+
error("Cannot install WP-CLI in '#{install_path}'")
|
49
|
+
|
46
50
|
success("Installed WP-CLI in '#{install_path}'")
|
47
51
|
end
|
48
52
|
|
49
53
|
def make_executable
|
50
54
|
info("Making WP-CLI executable...")
|
51
55
|
need_sudo = !File.writable?(install_dir)
|
52
|
-
run_command(executable_bit_command(install_path, need_sudo)) ||
|
56
|
+
run_command(executable_bit_command(install_path, need_sudo)) ||
|
57
|
+
error("Cannot make WP-CLI executable")
|
58
|
+
|
53
59
|
success("WP-CLI is now executable")
|
54
60
|
end
|
55
61
|
|
data/wordpress_tools.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "wordpress_tools/version"
|
@@ -6,28 +5,40 @@ require "wordpress_tools/version"
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "wordpress_tools"
|
8
7
|
spec.version = WordPressTools::VERSION
|
9
|
-
spec.authors = ["Étienne Després",
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
spec.authors = ["Étienne Després",
|
9
|
+
"Alessandro Fazzi",
|
10
|
+
"Filippo Gangi Dino",
|
11
|
+
"Ju Liu",
|
12
|
+
"Fabrizio Monti",
|
13
|
+
"Matteo Piotto"]
|
14
|
+
spec.email = ["etienne@molotov.ca",
|
15
|
+
"alessandro.fazzi@welaika.com",
|
16
|
+
"filippo.gangidino@welaika.com",
|
17
|
+
"ju.liu@welaika.com",
|
18
|
+
"fabrizio.monti@welaika.com",
|
19
|
+
"matteo.piotto@welaika.com"]
|
20
|
+
spec.summary = "Manage WordPress installations."
|
21
|
+
spec.description = "Command line tool to manage WordPress installations."
|
13
22
|
spec.homepage = "http://github.com/welaika/wordpress_tools"
|
14
23
|
spec.license = "MIT"
|
15
24
|
|
16
|
-
spec.files =
|
25
|
+
spec.files = `git ls-files -z`
|
26
|
+
.split("\x0")
|
27
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
28
|
spec.bindir = "exe"
|
18
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
30
|
spec.require_paths = ["lib"]
|
20
31
|
|
21
|
-
spec.required_ruby_version = ">= 2.1
|
32
|
+
spec.required_ruby_version = ">= 2.4.1"
|
22
33
|
|
23
|
-
spec.add_dependency "thor", "~> 0.19.1"
|
24
34
|
spec.add_dependency "activesupport", "~> 5.0"
|
35
|
+
spec.add_dependency "thor", "~> 0.19.1"
|
25
36
|
|
26
37
|
spec.add_development_dependency "bundler", ">= 1.6.2"
|
38
|
+
spec.add_development_dependency "priscilla", "~> 1.0"
|
39
|
+
spec.add_development_dependency "pry-byebug", "~> 3.0"
|
27
40
|
spec.add_development_dependency "rake", "~> 10.4"
|
28
41
|
spec.add_development_dependency "rspec", "~> 3.2"
|
42
|
+
spec.add_development_dependency "rubocop"
|
29
43
|
spec.add_development_dependency "webmock"
|
30
|
-
spec.add_development_dependency "pry-byebug", "~> 3.0"
|
31
|
-
spec.add_development_dependency "priscilla", "~> 1.0"
|
32
|
-
spec.add_development_dependency "gem-release"
|
33
44
|
end
|
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.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Étienne Després
|
@@ -13,36 +13,36 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: exe
|
15
15
|
cert_chain: []
|
16
|
-
date: 2017-
|
16
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
|
-
name:
|
19
|
+
name: activesupport
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - "~>"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0
|
24
|
+
version: '5.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
29
|
- - "~>"
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0
|
31
|
+
version: '5.0'
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
|
-
name:
|
33
|
+
name: thor
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
36
|
- - "~>"
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
38
|
+
version: 0.19.1
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
43
|
- - "~>"
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 0.19.1
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: bundler
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,77 +58,77 @@ dependencies:
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 1.6.2
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
61
|
+
name: priscilla
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '1.0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '1.0'
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
|
-
name:
|
75
|
+
name: pry-byebug
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
78
|
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '3.
|
80
|
+
version: '3.0'
|
81
81
|
type: :development
|
82
82
|
prerelease: false
|
83
83
|
version_requirements: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '3.
|
87
|
+
version: '3.0'
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
|
-
name:
|
89
|
+
name: rake
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
94
|
+
version: '10.4'
|
95
95
|
type: :development
|
96
96
|
prerelease: false
|
97
97
|
version_requirements: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- - "
|
99
|
+
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
101
|
+
version: '10.4'
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
|
-
name:
|
103
|
+
name: rspec
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '3.
|
108
|
+
version: '3.2'
|
109
109
|
type: :development
|
110
110
|
prerelease: false
|
111
111
|
version_requirements: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: '3.
|
115
|
+
version: '3.2'
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
|
-
name:
|
117
|
+
name: rubocop
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- - "
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
122
|
+
version: '0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - "
|
127
|
+
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '
|
129
|
+
version: '0'
|
130
130
|
- !ruby/object:Gem::Dependency
|
131
|
-
name:
|
131
|
+
name: webmock
|
132
132
|
requirement: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - ">="
|
@@ -156,6 +156,7 @@ extra_rdoc_files: []
|
|
156
156
|
files:
|
157
157
|
- ".gitignore"
|
158
158
|
- ".rspec"
|
159
|
+
- ".rubocop.yml"
|
159
160
|
- ".ruby-version"
|
160
161
|
- ".vscode/launch.json"
|
161
162
|
- Gemfile
|
@@ -186,7 +187,6 @@ files:
|
|
186
187
|
- lib/wordpress_tools/version.rb
|
187
188
|
- lib/wordpress_tools/wordpress.rb
|
188
189
|
- lib/wordpress_tools/wp_cli_core.rb
|
189
|
-
- templates/wp_cli_config.yml
|
190
190
|
- tmp/.keep
|
191
191
|
- wordpress_tools.gemspec
|
192
192
|
homepage: http://github.com/welaika/wordpress_tools
|
@@ -201,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
201
|
requirements:
|
202
202
|
- - ">="
|
203
203
|
- !ruby/object:Gem::Version
|
204
|
-
version: 2.1
|
204
|
+
version: 2.4.1
|
205
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
207
|
- - ">="
|
data/templates/wp_cli_config.yml
DELETED