theme-juice 0.26.3 → 0.27.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/README.md +66 -47
- data/lib/theme-juice.rb +1 -0
- data/lib/theme-juice/cli.rb +2 -4
- data/lib/theme-juice/commands/create.rb +47 -18
- data/lib/theme-juice/commands/delete.rb +4 -1
- data/lib/theme-juice/commands/init.rb +5 -2
- data/lib/theme-juice/config.rb +33 -10
- data/lib/theme-juice/env.rb +3 -3
- data/lib/theme-juice/helpers/singleton_helper.rb +11 -0
- data/lib/theme-juice/man/tj +154 -53
- data/lib/theme-juice/man/tj-create +0 -4
- data/lib/theme-juice/man/tj-create.txt +0 -3
- data/lib/theme-juice/man/tj-deploy +136 -4
- data/lib/theme-juice/man/tj-deploy.txt +138 -11
- data/lib/theme-juice/man/tj-init +1 -1
- data/lib/theme-juice/man/tj-init.txt +1 -1
- data/lib/theme-juice/man/tj-setup +0 -4
- data/lib/theme-juice/man/tj-setup.txt +0 -3
- data/lib/theme-juice/man/tj.txt +141 -57
- data/lib/theme-juice/project.rb +1 -1
- data/lib/theme-juice/tasks/dns.rb +4 -3
- data/lib/theme-juice/tasks/settings.rb +7 -2
- data/lib/theme-juice/tasks/template.rb +15 -1
- data/lib/theme-juice/tasks/vm_plugins.rb +3 -4
- data/lib/theme-juice/tasks/wp_cli.rb +2 -8
- data/lib/theme-juice/version.rb +1 -1
- metadata +12 -3
data/lib/theme-juice/env.rb
CHANGED
@@ -30,15 +30,15 @@ module ThemeJuice
|
|
30
30
|
attr_accessor :branch
|
31
31
|
|
32
32
|
def vm_box=(val)
|
33
|
-
@vm_box = val || ENV.fetch("TJ_VM_BOX") { "git@github.com:ezekg/
|
33
|
+
@vm_box = val || ENV.fetch("TJ_VM_BOX") { "git@github.com:ezekg/graft.git" }
|
34
34
|
end
|
35
35
|
|
36
36
|
def vm_path=(val)
|
37
|
-
@vm_path = val || ENV.fetch("TJ_VM_PATH") { File.expand_path("~/
|
37
|
+
@vm_path = val || ENV.fetch("TJ_VM_PATH") { File.expand_path("~/graft") }
|
38
38
|
end
|
39
39
|
|
40
40
|
def vm_ip=(val)
|
41
|
-
@vm_ip = val || ENV.fetch("TJ_VM_IP") { "192.168.
|
41
|
+
@vm_ip = val || ENV.fetch("TJ_VM_IP") { "192.168.13.37" }
|
42
42
|
end
|
43
43
|
|
44
44
|
def vm_prefix=(val)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module ThemeJuice
|
2
2
|
module SingletonHelper
|
3
|
+
|
3
4
|
def inspect
|
4
5
|
res = []
|
5
6
|
|
@@ -12,5 +13,15 @@ module ThemeJuice
|
|
12
13
|
|
13
14
|
res.sort
|
14
15
|
end
|
16
|
+
|
17
|
+
def to_h
|
18
|
+
hash = {}
|
19
|
+
|
20
|
+
self.instance_variables.each do |k, _|
|
21
|
+
hash[k[1..-1]] = instance_variable_get k
|
22
|
+
end
|
23
|
+
|
24
|
+
hash
|
25
|
+
end
|
15
26
|
end
|
16
27
|
end
|
data/lib/theme-juice/man/tj
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" "1" "
|
4
|
+
.TH "TJ" "1" "August 2016" "" "Theme Juice Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBtj\fR \- WordPress development made easy
|
@@ -138,96 +138,197 @@ List all projects
|
|
138
138
|
\fBvm\fR, \fBvagrant\fR, \fBvvv\fR=[\fIcommand\fR[,\fIcommand\fR]\.\.\.]
|
139
139
|
Manage development environment via vagrant(1)\. Commands are proxied to your Vagrant installation so that they can be run from any directory\.
|
140
140
|
.
|
141
|
+
.SH "CONFIG FILE"
|
142
|
+
A YAML configuration file called a Juicefile(5) can be used to store commonly used build scripts, similar to npm(1) scripts\. Each command can be mapped to any build script you like, allowing you to define a set of commands that can be used across all of your projects\. If you plan to deploy using \fBtj\fR, this file will also house your deploy(1) configuration\.
|
143
|
+
.
|
144
|
+
.P
|
145
|
+
For reference, below is an example config:
|
146
|
+
.
|
147
|
+
.IP "" 4
|
148
|
+
.
|
149
|
+
.nf
|
150
|
+
|
151
|
+
# Project configuration
|
152
|
+
project:
|
153
|
+
name: example
|
154
|
+
url: example\.dev
|
155
|
+
|
156
|
+
# Manage command aliases for the current project
|
157
|
+
commands:
|
158
|
+
|
159
|
+
# Run project install scripts
|
160
|
+
install:
|
161
|
+
\- npm install
|
162
|
+
\- grunt build
|
163
|
+
|
164
|
+
# Manage build tools
|
165
|
+
dev:
|
166
|
+
\- grunt %args%
|
167
|
+
|
168
|
+
# Manage front\-end dependencies
|
169
|
+
assets:
|
170
|
+
\- npm %args%
|
171
|
+
|
172
|
+
# Manage back\-end dependencies
|
173
|
+
vendor:
|
174
|
+
\- composer %args%
|
175
|
+
|
176
|
+
# Create a backup of the current database with a nice timestamp
|
177
|
+
backup:
|
178
|
+
\- mkdir \-p backup
|
179
|
+
\- wp @dev db export backup/$(date +\'%Y\-%m\-%d\-%H\-%M\-%S\')\.sql
|
180
|
+
|
181
|
+
# Manage deployment settings for the current project
|
182
|
+
deployment:
|
183
|
+
# \.\.\.
|
184
|
+
|
185
|
+
stages:
|
186
|
+
# \.\.\.
|
187
|
+
.
|
188
|
+
.fi
|
189
|
+
.
|
190
|
+
.IP "" 0
|
191
|
+
.
|
141
192
|
.SH "CONFIG COMMANDS"
|
142
|
-
|
193
|
+
The commands within the \fBcommands\fR block can be run from the command line via \fBtj <command>\fR\. For example, we can run the \fBdev\fR command by running \fBtj dev\fR, which will in turn run the command \fBgrunt\fR\.
|
143
194
|
.
|
144
|
-
.
|
145
|
-
\
|
146
|
-
Run installation for project
|
195
|
+
.P
|
196
|
+
If you noticed in the example above, there are a few commands that contain \fB%args%\fR; each command list is run within a single execution via joining: \fBcmd1 && cmd2 [&& cmd3\.\.\.]\fR, with all \fB%args%\fR/\fB%argN%\fR being replaced with the corresponding argument index, when available\.
|
147
197
|
.
|
148
|
-
.
|
149
|
-
\
|
150
|
-
Manage and run development build tools
|
198
|
+
.P
|
199
|
+
Here\'s a few example commands using placeholders:
|
151
200
|
.
|
152
|
-
.
|
153
|
-
\fBassets\fR=[\fIarg\fR[,\fIarg\fR]\.\.\.]
|
154
|
-
Manage front\-end dependencies for project
|
201
|
+
.IP "" 4
|
155
202
|
.
|
156
|
-
.
|
157
|
-
|
158
|
-
|
203
|
+
.nf
|
204
|
+
|
205
|
+
example\-command:
|
206
|
+
# Will contain all arguments joined by a space
|
207
|
+
\- cmd1 %args%
|
208
|
+
# Will contain each argument mapped to its respective index
|
209
|
+
\- cmd2 \'%arg1% %arg2% %arg3%\'
|
210
|
+
# Will only map argument 4, while ignoring 1\-3
|
211
|
+
\- cmd3 "%arg4%"
|
159
212
|
.
|
160
|
-
.
|
161
|
-
|
162
|
-
|
213
|
+
.fi
|
214
|
+
.
|
215
|
+
.IP "" 0
|
216
|
+
.
|
217
|
+
.P
|
218
|
+
To clarify a little bit more, we could run \fBtj dev build\fR, and since our \fBdev\fR command contains \fB%args%\fR, that will in turn run the command \fBgrunt build\fR; if we run \fBtj dev some:other task\fR, that would be interpreted and run as \fBgrunt some:other task\fR\.
|
219
|
+
.
|
220
|
+
.P
|
221
|
+
You can specify an unlimited number of commands with an unlimited number of arguments within your \fBJuicefile\fR; however, you should be careful with how this is used\. Don\'t go including \fBsudo rm \-rf %arg1%\fR in a command, while passing \fB/\fR as an argument\. Keep it simple\. These are meant to make your life easier by helping you manage build tools, not to do fancy scripting\.
|
222
|
+
.
|
223
|
+
.SH "CONFIG TEMPLATE STRINGS"
|
224
|
+
You may define ERB template strings within a project starter template\'s Juicefile(5)\. These will be replaced upon running create(1)\.
|
225
|
+
.
|
226
|
+
.P
|
227
|
+
For example,
|
228
|
+
.
|
229
|
+
.IP "" 4
|
230
|
+
.
|
231
|
+
.nf
|
232
|
+
|
233
|
+
# Project configuration
|
234
|
+
project:
|
235
|
+
name: <%= name %>
|
236
|
+
url: <%= url %>
|
237
|
+
.
|
238
|
+
.fi
|
239
|
+
.
|
240
|
+
.IP "" 0
|
241
|
+
.
|
242
|
+
.P
|
243
|
+
will be replaced with,
|
244
|
+
.
|
245
|
+
.IP "" 4
|
246
|
+
.
|
247
|
+
.nf
|
248
|
+
|
249
|
+
# Project configuration
|
250
|
+
project:
|
251
|
+
name: example\-project
|
252
|
+
url: example\-project\.dev
|
253
|
+
.
|
254
|
+
.fi
|
255
|
+
.
|
256
|
+
.IP "" 0
|
257
|
+
.
|
258
|
+
.P
|
259
|
+
if those were the options chosen during a creation\. The following variables are available for use:
|
163
260
|
.
|
164
261
|
.TP
|
165
|
-
\
|
166
|
-
|
262
|
+
\fBname\fR
|
263
|
+
Project name
|
167
264
|
.
|
168
265
|
.TP
|
169
|
-
\
|
170
|
-
|
266
|
+
\fBlocation\fR
|
267
|
+
Project location
|
171
268
|
.
|
172
269
|
.TP
|
173
|
-
\
|
174
|
-
|
270
|
+
\fBurl\fR
|
271
|
+
Project URL
|
175
272
|
.
|
176
|
-
.
|
177
|
-
|
273
|
+
.TP
|
274
|
+
\fBxip_url\fR
|
275
|
+
Project xip\.io URL
|
178
276
|
.
|
179
277
|
.TP
|
180
|
-
\
|
181
|
-
|
278
|
+
\fBtemplate\fR
|
279
|
+
Project template repository URL
|
182
280
|
.
|
183
281
|
.TP
|
184
|
-
\
|
185
|
-
|
282
|
+
\fBrepository\fR
|
283
|
+
Initialized repository URL, if available
|
186
284
|
.
|
187
285
|
.TP
|
188
|
-
\
|
189
|
-
|
286
|
+
\fBdb_host\fR
|
287
|
+
Project database host
|
190
288
|
.
|
191
289
|
.TP
|
192
|
-
\
|
193
|
-
|
290
|
+
\fBdb_name\fR
|
291
|
+
Project database name
|
194
292
|
.
|
195
293
|
.TP
|
196
|
-
\
|
197
|
-
|
294
|
+
\fBdb_user\fR
|
295
|
+
Project database user
|
198
296
|
.
|
199
297
|
.TP
|
200
|
-
\
|
201
|
-
|
298
|
+
\fBdb_pass\fR
|
299
|
+
Project database password
|
202
300
|
.
|
203
301
|
.TP
|
204
|
-
\
|
205
|
-
|
302
|
+
\fBdb_import\fR
|
303
|
+
Path to imported database file
|
206
304
|
.
|
207
305
|
.TP
|
208
|
-
\
|
209
|
-
|
306
|
+
\fBvm_box\fR
|
307
|
+
Virtual machine box URL
|
210
308
|
.
|
211
309
|
.TP
|
212
|
-
\
|
213
|
-
|
310
|
+
\fBvm_ip\fR
|
311
|
+
Virtual machine IP address
|
214
312
|
.
|
215
|
-
.
|
216
|
-
|
313
|
+
.TP
|
314
|
+
\fBvm_path\fR
|
315
|
+
Virtual machine location on the host machine
|
217
316
|
.
|
218
317
|
.TP
|
219
|
-
\
|
220
|
-
|
318
|
+
\fBvm_root\fR
|
319
|
+
Web root of the VM on the host machine
|
221
320
|
.
|
222
321
|
.TP
|
223
|
-
\
|
224
|
-
|
322
|
+
\fBvm_location\fR
|
323
|
+
Project location within the VM on the host machine
|
225
324
|
.
|
226
|
-
.
|
227
|
-
|
325
|
+
.TP
|
326
|
+
\fBvm_srv\fR
|
327
|
+
Project location within the VM on the guest machine
|
228
328
|
.
|
229
|
-
.
|
230
|
-
\
|
329
|
+
.TP
|
330
|
+
\fBvm_prefix\fR
|
331
|
+
Virtual machine project location prefix
|
231
332
|
.
|
232
333
|
.SH "ENVIRONMENT"
|
233
334
|
All of the global options have a corresponding \fBENV\fR variable that can be set to permanently use the specified value each time tj(1) is run\. This is useful if you\'re using an alternate vagrant(1) box, or if you need to disable certain features due to limited support i\.e\. on Windows\.
|
@@ -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\-DEPLOY" "1" "
|
4
|
+
.TH "TJ\-DEPLOY" "1" "August 2016" "" "Theme Juice Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBtj\-deploy\fR \- Deploy a project
|
@@ -22,7 +22,7 @@ Follow these steps to quickly get up and running:
|
|
22
22
|
Create a \fBdeploy\fR user on the \fBstage\fR server
|
23
23
|
.
|
24
24
|
.IP "2." 4
|
25
|
-
Set up SSH keys for the new \fBdeploy\fR user
|
25
|
+
Set up SSH keys for the new \fBdeploy\fR user for password\-less SSH access
|
26
26
|
.
|
27
27
|
.IP "3." 4
|
28
28
|
Confirm the \fBdeploy\fR user owns the deploy path
|
@@ -107,7 +107,7 @@ Recursively pull a relative directory from the passed \fBstage\fR to the develop
|
|
107
107
|
Recursively push a relative directory from the development environment to the passed \fBstage\fR\.
|
108
108
|
.
|
109
109
|
.SH "CONFIG FILE"
|
110
|
-
The YAML Juicefile(5) configuration may be used to store deployment\-related settings\. Below you will find the various
|
110
|
+
The YAML Juicefile(5) configuration may be used to store deployment\-related settings\. Below you will find the various options you can use to define your project\'s deployment setup\.
|
111
111
|
.
|
112
112
|
.TP
|
113
113
|
\fBdeployment\fR
|
@@ -139,7 +139,7 @@ Deployment stages
|
|
139
139
|
.
|
140
140
|
.TP
|
141
141
|
\fBdeployment\.stages\.<stage>\.server\fR
|
142
|
-
Domain or IP address of the server
|
142
|
+
Domain or IP address of the server; can include an optional port number in the form of \fB<ip_or_domain>:<port>\fR
|
143
143
|
.
|
144
144
|
.TP
|
145
145
|
\fBdeployment\.stages\.<stage>\.path\fR
|
@@ -208,4 +208,136 @@ Relative path from application root to the tmp folder
|
|
208
208
|
.TP
|
209
209
|
\fBdeployment\.stages\.vagrant\.roles\fR
|
210
210
|
Sequence of roles for the development environment
|
211
|
+
.
|
212
|
+
.P
|
213
|
+
Below is an example deployment configuration:
|
214
|
+
.
|
215
|
+
.IP "" 4
|
216
|
+
.
|
217
|
+
.nf
|
218
|
+
|
219
|
+
# Project configuration
|
220
|
+
project:
|
221
|
+
name: example
|
222
|
+
|
223
|
+
# Deployment configuration
|
224
|
+
deployment:
|
225
|
+
|
226
|
+
# Repository settings
|
227
|
+
repository:
|
228
|
+
repo_url: git@github\.com:example/example\-app\.git
|
229
|
+
branch: :master
|
230
|
+
scm: :rsync
|
231
|
+
|
232
|
+
# Other settings that will be passed directly to Capistrano
|
233
|
+
# @see http://capistranorb\.com/
|
234
|
+
settings:
|
235
|
+
keep_releases: 5
|
236
|
+
format: :pretty
|
237
|
+
log_level: :verbose
|
238
|
+
use_sudo: false
|
239
|
+
ssh_options:
|
240
|
+
keys: ~/\.ssh/id_rsa
|
241
|
+
forward_agent: true
|
242
|
+
paranoid: true
|
243
|
+
# Add additional directories to $PATH\. This is useful if you\'re
|
244
|
+
# on a shared hosting environment (i\.e\. GoDaddy) and you need
|
245
|
+
# to use an executable such as wp\-cli for database migration\.
|
246
|
+
default_env:
|
247
|
+
path: /opt/wp\-cli/bin:$PATH
|
248
|
+
|
249
|
+
# Capistrano rsync options and install procedure
|
250
|
+
# @see https://github\.com/Bladrak/capistrano\-rsync
|
251
|
+
rsync:
|
252
|
+
stage: tmp/deploy
|
253
|
+
cache: shared/deploy
|
254
|
+
scm: :git
|
255
|
+
depth: 1
|
256
|
+
# Options to pass to the rsync command
|
257
|
+
# @see http://linux\.die\.net/man/1/rsync
|
258
|
+
options:
|
259
|
+
\- \-\-recursive
|
260
|
+
\- \-\-delete
|
261
|
+
\- \-\-delete\-excluded
|
262
|
+
\- \-\-include="vendor/**/*" # Overrides any excluded patterns
|
263
|
+
\- \-\-exclude="node_modules/"
|
264
|
+
\- \-\-exclude="\.env\.sample"
|
265
|
+
\- \-\-exclude="\.git*"
|
266
|
+
\- \-\-exclude="Juicefile*"
|
267
|
+
\- \-\-exclude="composer\.*"
|
268
|
+
\- \-\-exclude="package\.json"
|
269
|
+
\- \-\-exclude="README\.*"
|
270
|
+
# Run application install scripts
|
271
|
+
install:
|
272
|
+
\- composer install \-\-no\-dev
|
273
|
+
\- bundle install
|
274
|
+
\- npm install
|
275
|
+
\- bower install
|
276
|
+
\- grunt build
|
277
|
+
# Run scripts before the deployment starts
|
278
|
+
pre_scripts:
|
279
|
+
\- touch \.maintenance
|
280
|
+
# Run scripts before the deployment finishes
|
281
|
+
post_scripts:
|
282
|
+
\- rm \.maintenance
|
283
|
+
\- sudo service apache2 restart
|
284
|
+
|
285
|
+
# Slack integration
|
286
|
+
# @see https://github\.com/onthebeach/capistrano\-slackify
|
287
|
+
slack:
|
288
|
+
url: https://hooks\.slack\.com/services/your\-token
|
289
|
+
username: Deploybot
|
290
|
+
channel: "#devops"
|
291
|
+
emoji: ":rocket:"
|
292
|
+
|
293
|
+
# Deployment stages
|
294
|
+
stages:
|
295
|
+
|
296
|
+
production:
|
297
|
+
server: 192\.168\.13\.37:1234
|
298
|
+
path: /var/www/production
|
299
|
+
user: deploy
|
300
|
+
url: example\.com
|
301
|
+
uploads: app/uploads
|
302
|
+
tmp: tmp
|
303
|
+
shared:
|
304
|
+
\- \.env\.production
|
305
|
+
ignore:
|
306
|
+
\- robots\.txt
|
307
|
+
roles:
|
308
|
+
\- :web
|
309
|
+
\- :app
|
310
|
+
\- :db
|
311
|
+
|
312
|
+
staging:
|
313
|
+
server: 192\.168\.13\.37
|
314
|
+
path: /var/www/staging
|
315
|
+
user: deploy
|
316
|
+
url: staging\.example\.com
|
317
|
+
uploads: app/uploads
|
318
|
+
tmp: tmp
|
319
|
+
shared:
|
320
|
+
\- \.env\.staging
|
321
|
+
roles:
|
322
|
+
\- :web
|
323
|
+
\- :app
|
324
|
+
\- :db
|
325
|
+
|
326
|
+
# This is your development environment used to push/pull database files,
|
327
|
+
# uploads, the \.env file, etc\.
|
328
|
+
vagrant:
|
329
|
+
server: example\.dev
|
330
|
+
path: /srv/www/tj\-example
|
331
|
+
user: vagrant
|
332
|
+
pass: vagrant
|
333
|
+
url: example\.dev
|
334
|
+
uploads: app/uploads
|
335
|
+
backup: backup
|
336
|
+
tmp: tmp
|
337
|
+
roles:
|
338
|
+
\- :dev
|
339
|
+
.
|
340
|
+
.fi
|
341
|
+
.
|
342
|
+
.IP "" 0
|
211
343
|
|