theme-juice 0.19.5 → 0.20.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.
- checksums.yaml +4 -4
- data/lib/theme-juice.rb +1 -0
- data/lib/theme-juice/cli.rb +16 -12
- data/lib/theme-juice/commands/create.rb +31 -19
- data/lib/theme-juice/config.rb +2 -0
- data/lib/theme-juice/man/tj-create +17 -1
- data/lib/theme-juice/man/tj-create.txt +14 -1
- data/lib/theme-juice/project.rb +4 -0
- data/lib/theme-juice/tasks/dot_env.rb +1 -1
- data/lib/theme-juice/tasks/wp_cli.rb +1 -1
- data/lib/theme-juice/tasks/wp_config.rb +79 -0
- data/lib/theme-juice/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c9fca52d72a4f48aee8afea4a1bf79e910ab5b4
|
4
|
+
data.tar.gz: 556f6c6891375960ddb923ea494ef8b614ba8a87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a9a77b68588a07545cc0c80d3bc6bedbd2fccf0326fa78212ecf73b24a9916bf21c074e250febc19b22b7950e4bb816a9a0620aa6c923689bb102645c542d31
|
7
|
+
data.tar.gz: 3766089d433880aaa037038019a367a0ac5719714ee3e11e500d6141d3f0354ff30dcf19943f6609788ab287adf240907d04251354367af86a80ad687f5a2781
|
data/lib/theme-juice.rb
CHANGED
@@ -27,6 +27,7 @@ require "theme-juice/tasks/location"
|
|
27
27
|
require "theme-juice/tasks/template"
|
28
28
|
require "theme-juice/tasks/repo"
|
29
29
|
require "theme-juice/tasks/dot_env"
|
30
|
+
require "theme-juice/tasks/wp_config"
|
30
31
|
require "theme-juice/tasks/forward_ports"
|
31
32
|
require "theme-juice/tasks/nginx"
|
32
33
|
require "theme-juice/tasks/apache"
|
data/lib/theme-juice/cli.rb
CHANGED
@@ -122,18 +122,22 @@ module ThemeJuice
|
|
122
122
|
end
|
123
123
|
|
124
124
|
desc "create", "Create new project"
|
125
|
-
method_option :name,
|
126
|
-
method_option :location,
|
127
|
-
method_option :template,
|
128
|
-
method_option :url,
|
129
|
-
method_option :repository,
|
130
|
-
method_option :db_import,
|
131
|
-
method_option :bare,
|
132
|
-
method_option :skip_repo,
|
133
|
-
method_option :skip_db,
|
134
|
-
method_option :use_defaults,
|
135
|
-
method_option :no_wp,
|
136
|
-
method_option :
|
125
|
+
method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => ""
|
126
|
+
method_option :location, :type => :string, :aliases => "-l", :default => nil, :desc => ""
|
127
|
+
method_option :template, :type => :string, :aliases => "-t", :default => nil, :desc => ""
|
128
|
+
method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => ""
|
129
|
+
method_option :repository, :type => :string, :aliases => "-r", :desc => ""
|
130
|
+
method_option :db_import, :type => :string, :aliases => %w[-i --import-db], :desc => ""
|
131
|
+
method_option :bare, :type => :boolean, :aliases => %w[--no-template], :desc => ""
|
132
|
+
method_option :skip_repo, :type => :boolean, :desc => ""
|
133
|
+
method_option :skip_db, :type => :boolean, :desc => ""
|
134
|
+
method_option :use_defaults, :type => :boolean, :desc => ""
|
135
|
+
method_option :no_wp, :type => :boolean, :desc => ""
|
136
|
+
method_option :no_wp_cli, :type => :boolean, :aliases => %w[--no-wp-cli-config], :desc => ""
|
137
|
+
method_option :no_db, :type => :boolean, :desc => ""
|
138
|
+
method_option :no_env, :type => :boolean, :desc => ""
|
139
|
+
method_option :no_config, :type => :boolean, :aliases => %w[--no-juicefile], :desc => ""
|
140
|
+
method_option :wp_config_modify, :type => :boolean, :aliases => %w[--modify-wp-config], :desc => ""
|
137
141
|
def create
|
138
142
|
@io.hello
|
139
143
|
@create.new(options).execute
|
@@ -30,7 +30,11 @@ module ThemeJuice
|
|
30
30
|
else
|
31
31
|
tasks << Tasks::Apache.new
|
32
32
|
end
|
33
|
-
|
33
|
+
if @project.no_env
|
34
|
+
tasks << Tasks::WPConfig.new
|
35
|
+
else
|
36
|
+
tasks << Tasks::DotEnv.new
|
37
|
+
end
|
34
38
|
tasks << Tasks::Landrush.new
|
35
39
|
tasks << Tasks::ForwardPorts.new
|
36
40
|
tasks << Tasks::SyncedFolder.new
|
@@ -46,23 +50,27 @@ module ThemeJuice
|
|
46
50
|
private
|
47
51
|
|
48
52
|
def init_project
|
49
|
-
@project.use_defaults
|
50
|
-
@project.bare
|
51
|
-
@project.skip_repo
|
52
|
-
@project.skip_db
|
53
|
-
@project.no_wp
|
54
|
-
@project.
|
55
|
-
@project.
|
56
|
-
@project.
|
57
|
-
@project.
|
58
|
-
@project.
|
59
|
-
@project.
|
60
|
-
@project.
|
61
|
-
@project.
|
62
|
-
@project.
|
63
|
-
@project.
|
64
|
-
@project.
|
65
|
-
@project.
|
53
|
+
@project.use_defaults = @opts.fetch("use_defaults") { false }
|
54
|
+
@project.bare = @opts.fetch("bare") { false }
|
55
|
+
@project.skip_repo = @opts.fetch("skip_repo") { false }
|
56
|
+
@project.skip_db = @opts.fetch("skip_db") { false }
|
57
|
+
@project.no_wp = @opts.fetch("no_wp") { false }
|
58
|
+
@project.no_wp_cli = @opts.fetch("no_wp_cli") { false }
|
59
|
+
@project.no_db = @opts.fetch("no_db") { false }
|
60
|
+
@project.wp_config_modify = @opts.fetch("wp_config_modify") { false }
|
61
|
+
@project.no_config = @opts.fetch("no_config") { false }
|
62
|
+
@project.no_env = @opts.fetch("no_env") { @project.wp_config_modify }
|
63
|
+
@project.name = @opts.fetch("name") { name }
|
64
|
+
@project.location = @opts.fetch("location") { location }
|
65
|
+
@project.url = @opts.fetch("url") { url }
|
66
|
+
@project.xip_url = @opts.fetch("xip_url") { xip_url }
|
67
|
+
@project.template = @opts.fetch("template") { template }
|
68
|
+
@project.repository = @opts.fetch("repository") { repository }
|
69
|
+
@project.db_host = @opts.fetch("db_host") { db_host }
|
70
|
+
@project.db_name = @opts.fetch("db_name") { db_name }
|
71
|
+
@project.db_user = @opts.fetch("db_user") { db_user }
|
72
|
+
@project.db_pass = @opts.fetch("db_pass") { db_pass }
|
73
|
+
@project.db_import = @opts.fetch("db_import") { db_import }
|
66
74
|
end
|
67
75
|
|
68
76
|
def name
|
@@ -144,7 +152,11 @@ module ThemeJuice
|
|
144
152
|
when /(theme-juice)/
|
145
153
|
@io.say "Awesome choice!", :color => :green, :icon => :success
|
146
154
|
when /(wordpress)/
|
147
|
-
@
|
155
|
+
@project.wp_config_modify = true
|
156
|
+
@project.no_config = true
|
157
|
+
@project.no_wp_cli = true
|
158
|
+
@project.no_env = true
|
159
|
+
@io.say "This is a stock WordPress install, so I'll go ahead and modify the 'wp-config' file for you.", {
|
148
160
|
:color => :yellow, :icon => :notice }
|
149
161
|
when /(other)/
|
150
162
|
TEMPLATES[choice] = @io.ask "What is the repository URL of the starter template that you would like to clone?"
|
data/lib/theme-juice/config.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "TJ\-CREATE" "1" "
|
4
|
+
.TH "TJ\-CREATE" "1" "January 2016" "" "Theme Juice Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBtj\-create\fR \- Create a new project
|
@@ -91,6 +91,22 @@ Skip all prompts and use default settings
|
|
91
91
|
Project is not a wordpress(7) install
|
92
92
|
.
|
93
93
|
.TP
|
94
|
+
\fB\-\-no\-wp\-cli\fR, \fB\-\-no\-wp\-cli\-config\fR
|
95
|
+
Skip creating the local wp\-cli(1) config file
|
96
|
+
.
|
97
|
+
.TP
|
94
98
|
\fB\-\-no\-db\fR
|
95
99
|
Project does not need a database
|
100
|
+
.
|
101
|
+
.TP
|
102
|
+
\fB\-\-no\-env\fR
|
103
|
+
Project does not need a \fB\.env\fR file
|
104
|
+
.
|
105
|
+
.TP
|
106
|
+
\fB\-\-no\-config\fR, \fB\-\-no\-juicefile\fR
|
107
|
+
Project does not have a Juicefile(1) config
|
108
|
+
.
|
109
|
+
.TP
|
110
|
+
\fB\-\-modify\-wp\-config\fR, \fB\-\-wp\-config\-modify\fR
|
111
|
+
Modify \fBwp\-config\.php\fR file contents with project configuration (this flag automatically disables the \fB\.env\fR file when used)
|
96
112
|
|
@@ -73,10 +73,23 @@ GLOBAL OPTIONS
|
|
73
73
|
--no-wp
|
74
74
|
Project is not a wordpress(7) install
|
75
75
|
|
76
|
+
--no-wp-cli, --no-wp-cli-config
|
77
|
+
Skip creating the local wp-cli(1) config file
|
78
|
+
|
76
79
|
--no-db
|
77
80
|
Project does not need a database
|
78
81
|
|
82
|
+
--no-env
|
83
|
+
Project does not need a .env file
|
84
|
+
|
85
|
+
--no-config, --no-juicefile
|
86
|
+
Project does not have a Juicefile(1) config
|
87
|
+
|
88
|
+
--modify-wp-config, --wp-config-modify
|
89
|
+
Modify wp-config.php file contents with project configuration
|
90
|
+
(this flag automatically disables the .env file when used)
|
91
|
+
|
79
92
|
|
80
93
|
|
81
94
|
|
82
|
-
|
95
|
+
January 2016 TJ-CREATE(1)
|
data/lib/theme-juice/project.rb
CHANGED
@@ -25,7 +25,11 @@ module ThemeJuice
|
|
25
25
|
attr_accessor :skip_db
|
26
26
|
attr_accessor :use_defaults
|
27
27
|
attr_accessor :no_wp
|
28
|
+
attr_accessor :no_wp_cli
|
28
29
|
attr_accessor :no_db
|
30
|
+
attr_accessor :no_env
|
31
|
+
attr_accessor :no_config
|
32
|
+
attr_accessor :wp_config_modify
|
29
33
|
|
30
34
|
def vm_root
|
31
35
|
@vm_root ||= File.expand_path("#{Env.vm_path}/www")
|
@@ -27,7 +27,7 @@ module ThemeJuice
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def create_wp_cli_file
|
30
|
-
return if wp_cli_is_setup? || @project.no_wp
|
30
|
+
return if wp_cli_is_setup? || @project.no_wp_cli || @project.no_wp
|
31
31
|
|
32
32
|
@io.log "Creating WP-CLI file"
|
33
33
|
@util.create_file wp_cli_file, { :verbose => @env.verbose,
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class WPConfig < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
|
10
|
+
@using_wp_config_sample = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute
|
14
|
+
return if !@project.wp_config_modify || @project.no_wp || @project.no_db
|
15
|
+
|
16
|
+
unless wp_config_is_setup?
|
17
|
+
@io.say "Could not find wp-config file to modify", {
|
18
|
+
:color => :yellow, :icon => :notice }
|
19
|
+
|
20
|
+
unless wp_config_sample_is_setup?
|
21
|
+
@io.error "Could not find a wp-config-sample file either. Are you sure one exists in the project directory?"
|
22
|
+
end
|
23
|
+
|
24
|
+
@util.create_file(wp_config_file, { :verbose => @env.verbose,
|
25
|
+
:capture => @env.quiet }) { File.read(wp_config_sample_file) }
|
26
|
+
|
27
|
+
@using_wp_config_sample = true
|
28
|
+
end
|
29
|
+
|
30
|
+
modify_wp_config_settings({
|
31
|
+
:db_name => "#{@project.db_name}",
|
32
|
+
:db_user => "#{@project.db_user}",
|
33
|
+
:db_password => "#{@project.db_pass}",
|
34
|
+
:db_host => "#{@project.db_host}",
|
35
|
+
:wp_debug => true
|
36
|
+
})
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def wp_config_file
|
42
|
+
"#{@project.location}/wp-config.php"
|
43
|
+
end
|
44
|
+
|
45
|
+
def wp_config_is_setup?
|
46
|
+
File.exist? wp_config_file
|
47
|
+
end
|
48
|
+
|
49
|
+
def wp_config_sample_file
|
50
|
+
"#{@project.location}/wp-config-sample.php"
|
51
|
+
end
|
52
|
+
|
53
|
+
def wp_config_sample_is_setup?
|
54
|
+
File.exist? wp_config_sample_file
|
55
|
+
end
|
56
|
+
|
57
|
+
def modify_wp_config_settings(settings)
|
58
|
+
if @using_wp_config_sample
|
59
|
+
@io.log "Creating wp-config file from sample"
|
60
|
+
else
|
61
|
+
return unless @io.agree? "Do you want to modify your current wp-config settings?"
|
62
|
+
@io.log "Modifying wp-config file"
|
63
|
+
end
|
64
|
+
|
65
|
+
settings.each do |setting, value|
|
66
|
+
replacement = case value
|
67
|
+
when TrueClass, FalseClass
|
68
|
+
"define('#{setting.upcase}', #{value.to_s});"
|
69
|
+
else
|
70
|
+
"define('#{setting.upcase}', '#{value.to_s}');"
|
71
|
+
end
|
72
|
+
|
73
|
+
@util.gsub_file wp_config_file, /define\(\W*#{setting}\W*,\s*['"]{0,1}(.*?)['"]{0,1}\)\;/mi,
|
74
|
+
"#{replacement}", { :verbose => @env.verbose, :capture => @env.quiet }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/theme-juice/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: theme-juice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezekiel Gabrielse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- lib/theme-juice/tasks/vm_restart.rb
|
210
210
|
- lib/theme-juice/tasks/vm_stage.rb
|
211
211
|
- lib/theme-juice/tasks/wp_cli.rb
|
212
|
+
- lib/theme-juice/tasks/wp_config.rb
|
212
213
|
- lib/theme-juice/util.rb
|
213
214
|
- lib/theme-juice/version.rb
|
214
215
|
homepage: http://themejuice.it
|