theme-juice 0.26.3 → 0.27.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 +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
@@ -21,8 +21,8 @@ SETUP
|
|
21
21
|
|
22
22
|
1. Create a deploy user on the stage server
|
23
23
|
|
24
|
-
2. Set up SSH
|
25
|
-
|
24
|
+
2. Set up SSH keys for the new deploy user for password-less SSH
|
25
|
+
access
|
26
26
|
|
27
27
|
3. Confirm the deploy user owns the deploy path
|
28
28
|
|
@@ -98,9 +98,8 @@ SECONDARY COMMANDS
|
|
98
98
|
|
99
99
|
CONFIG FILE
|
100
100
|
The YAML Juicefile(5) configuration may be used to store deploy-
|
101
|
-
ment-related settings. Below you will find the various
|
102
|
-
|
103
|
-
will be passed to capistrano(1) to invoke a deployment.
|
101
|
+
ment-related settings. Below you will find the various options you can
|
102
|
+
use to define your project's deployment setup.
|
104
103
|
|
105
104
|
deployment
|
106
105
|
Deployment configuration
|
@@ -119,14 +118,15 @@ CONFIG FILE
|
|
119
118
|
rsync_<setting> during the deployment initialization
|
120
119
|
|
121
120
|
deployment.slack
|
122
|
-
Optional
|
121
|
+
Optional settings passed to capistrano-slackify(1); mapped as
|
123
122
|
slack_<setting> during the deployment initialization
|
124
123
|
|
125
124
|
deployment.stages
|
126
125
|
Deployment stages
|
127
126
|
|
128
127
|
deployment.stages.<stage>.server
|
129
|
-
Domain or IP address of the server
|
128
|
+
Domain or IP address of the server; can include an optional port
|
129
|
+
number in the form of <ip_or_domain>:<port>
|
130
130
|
|
131
131
|
deployment.stages.<stage>.path
|
132
132
|
Root path to the deployment directory
|
@@ -182,7 +182,134 @@ CONFIG FILE
|
|
182
182
|
deployment.stages.vagrant.roles
|
183
183
|
Sequence of roles for the development environment
|
184
184
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
185
|
+
Below is an example deployment configuration:
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
# Project configuration
|
190
|
+
project:
|
191
|
+
name: example
|
192
|
+
|
193
|
+
# Deployment configuration
|
194
|
+
deployment:
|
195
|
+
|
196
|
+
# Repository settings
|
197
|
+
repository:
|
198
|
+
repo_url: git@github.com:example/example-app.git
|
199
|
+
branch: :master
|
200
|
+
scm: :rsync
|
201
|
+
|
202
|
+
# Other settings that will be passed directly to Capistrano
|
203
|
+
# @see http://capistranorb.com/
|
204
|
+
settings:
|
205
|
+
keep_releases: 5
|
206
|
+
format: :pretty
|
207
|
+
log_level: :verbose
|
208
|
+
use_sudo: false
|
209
|
+
ssh_options:
|
210
|
+
keys: ~/.ssh/id_rsa
|
211
|
+
forward_agent: true
|
212
|
+
paranoid: true
|
213
|
+
# Add additional directories to $PATH. This is useful if you're
|
214
|
+
# on a shared hosting environment (i.e. GoDaddy) and you need
|
215
|
+
# to use an executable such as wp-cli for database migration.
|
216
|
+
default_env:
|
217
|
+
path: /opt/wp-cli/bin:$PATH
|
218
|
+
|
219
|
+
# Capistrano rsync options and install procedure
|
220
|
+
# @see https://github.com/Bladrak/capistrano-rsync
|
221
|
+
rsync:
|
222
|
+
stage: tmp/deploy
|
223
|
+
cache: shared/deploy
|
224
|
+
scm: :git
|
225
|
+
depth: 1
|
226
|
+
# Options to pass to the rsync command
|
227
|
+
# @see http://linux.die.net/man/1/rsync
|
228
|
+
options:
|
229
|
+
- --recursive
|
230
|
+
- --delete
|
231
|
+
- --delete-excluded
|
232
|
+
- --include="vendor/**/*" # Overrides any excluded patterns
|
233
|
+
- --exclude="node_modules/"
|
234
|
+
- --exclude=".env.sample"
|
235
|
+
- --exclude=".git*"
|
236
|
+
- --exclude="Juicefile*"
|
237
|
+
- --exclude="composer.*"
|
238
|
+
- --exclude="package.json"
|
239
|
+
- --exclude="README.*"
|
240
|
+
# Run application install scripts
|
241
|
+
install:
|
242
|
+
- composer install --no-dev
|
243
|
+
- bundle install
|
244
|
+
- npm install
|
245
|
+
- bower install
|
246
|
+
- grunt build
|
247
|
+
# Run scripts before the deployment starts
|
248
|
+
pre_scripts:
|
249
|
+
- touch .maintenance
|
250
|
+
# Run scripts before the deployment finishes
|
251
|
+
post_scripts:
|
252
|
+
- rm .maintenance
|
253
|
+
- sudo service apache2 restart
|
254
|
+
|
255
|
+
# Slack integration
|
256
|
+
# @see https://github.com/onthebeach/capistrano-slackify
|
257
|
+
slack:
|
258
|
+
url: https://hooks.slack.com/services/your-token
|
259
|
+
username: Deploybot
|
260
|
+
channel: "#devops"
|
261
|
+
emoji: ":rocket:"
|
262
|
+
|
263
|
+
# Deployment stages
|
264
|
+
stages:
|
265
|
+
|
266
|
+
production:
|
267
|
+
server: 192.168.13.37:1234
|
268
|
+
path: /var/www/production
|
269
|
+
user: deploy
|
270
|
+
url: example.com
|
271
|
+
uploads: app/uploads
|
272
|
+
tmp: tmp
|
273
|
+
shared:
|
274
|
+
- .env.production
|
275
|
+
ignore:
|
276
|
+
- robots.txt
|
277
|
+
roles:
|
278
|
+
- :web
|
279
|
+
- :app
|
280
|
+
- :db
|
281
|
+
|
282
|
+
staging:
|
283
|
+
server: 192.168.13.37
|
284
|
+
path: /var/www/staging
|
285
|
+
user: deploy
|
286
|
+
url: staging.example.com
|
287
|
+
uploads: app/uploads
|
288
|
+
tmp: tmp
|
289
|
+
shared:
|
290
|
+
- .env.staging
|
291
|
+
roles:
|
292
|
+
- :web
|
293
|
+
- :app
|
294
|
+
- :db
|
295
|
+
|
296
|
+
# This is your development environment used to push/pull database files,
|
297
|
+
# uploads, the .env file, etc.
|
298
|
+
vagrant:
|
299
|
+
server: example.dev
|
300
|
+
path: /srv/www/tj-example
|
301
|
+
user: vagrant
|
302
|
+
pass: vagrant
|
303
|
+
url: example.dev
|
304
|
+
uploads: app/uploads
|
305
|
+
backup: backup
|
306
|
+
tmp: tmp
|
307
|
+
roles:
|
308
|
+
- :dev
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
August 2016 TJ-DEPLOY(1)
|
data/lib/theme-juice/man/tj-init
CHANGED
data/lib/theme-juice/man/tj.txt
CHANGED
@@ -112,86 +112,170 @@ SECONDARY COMMANDS
|
|
112
112
|
proxied to your Vagrant installation so that they can be run
|
113
113
|
from any directory.
|
114
114
|
|
115
|
+
CONFIG FILE
|
116
|
+
A YAML configuration file called a Juicefile(5) can be used to store
|
117
|
+
commonly used build scripts, similar to npm(1) scripts. Each command
|
118
|
+
can be mapped to any build script you like, allowing you to define a
|
119
|
+
set of commands that can be used across all of your projects. If you
|
120
|
+
plan to deploy using tj, this file will also house your deploy(1) con-
|
121
|
+
figuration.
|
122
|
+
|
123
|
+
For reference, below is an example config:
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
# Project configuration
|
128
|
+
project:
|
129
|
+
name: example
|
130
|
+
url: example.dev
|
131
|
+
|
132
|
+
# Manage command aliases for the current project
|
133
|
+
commands:
|
134
|
+
|
135
|
+
# Run project install scripts
|
136
|
+
install:
|
137
|
+
- npm install
|
138
|
+
- grunt build
|
139
|
+
|
140
|
+
# Manage build tools
|
141
|
+
dev:
|
142
|
+
- grunt %args%
|
143
|
+
|
144
|
+
# Manage front-end dependencies
|
145
|
+
assets:
|
146
|
+
- npm %args%
|
147
|
+
|
148
|
+
# Manage back-end dependencies
|
149
|
+
vendor:
|
150
|
+
- composer %args%
|
151
|
+
|
152
|
+
# Create a backup of the current database with a nice timestamp
|
153
|
+
backup:
|
154
|
+
- mkdir -p backup
|
155
|
+
- wp @dev db export backup/$(date +'%Y-%m-%d-%H-%M-%S').sql
|
156
|
+
|
157
|
+
# Manage deployment settings for the current project
|
158
|
+
deployment:
|
159
|
+
# ...
|
160
|
+
|
161
|
+
stages:
|
162
|
+
# ...
|
163
|
+
|
164
|
+
|
165
|
+
|
115
166
|
CONFIG COMMANDS
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
defined within the Theme Juice starter template.
|
167
|
+
The commands within the commands block can be run from the command line
|
168
|
+
via tj <command>. For example, we can run the dev command by running tj
|
169
|
+
dev, which will in turn run the command grunt.
|
120
170
|
|
121
|
-
|
122
|
-
|
171
|
+
If you noticed in the example above, there are a few commands that con-
|
172
|
+
tain %args%; each command list is run within a single execution via
|
173
|
+
joining: cmd1 && cmd2 [&& cmd3...], with all %args%/%argN% being
|
174
|
+
replaced with the corresponding argument index, when available.
|
123
175
|
|
124
|
-
|
125
|
-
Manage and run development build tools
|
176
|
+
Here's a few example commands using placeholders:
|
126
177
|
|
127
|
-
assets=[arg[,arg]...]
|
128
|
-
Manage front-end dependencies for project
|
129
178
|
|
130
|
-
vendor=[arg[,arg]...]
|
131
|
-
Manage back-end dependencies for project
|
132
179
|
|
133
|
-
|
134
|
-
|
180
|
+
example-command:
|
181
|
+
# Will contain all arguments joined by a space
|
182
|
+
- cmd1 %args%
|
183
|
+
# Will contain each argument mapped to its respective index
|
184
|
+
- cmd2 '%arg1% %arg2% %arg3%'
|
185
|
+
# Will only map argument 4, while ignoring 1-3
|
186
|
+
- cmd3 "%arg4%"
|
135
187
|
|
136
|
-
wp=[arg[,arg]...]
|
137
|
-
Manage project's wordpress(7) installation with wp-cli(1)
|
138
188
|
|
139
|
-
backup=[arg[,arg]...]
|
140
|
-
Backup project
|
141
189
|
|
142
|
-
|
143
|
-
|
190
|
+
To clarify a little bit more, we could run tj dev build, and since our
|
191
|
+
dev command contains %args%, that will in turn run the command grunt
|
192
|
+
build; if we run tj dev some:other task, that would be interpreted and
|
193
|
+
run as grunt some:other task.
|
144
194
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
195
|
+
You can specify an unlimited number of commands with an unlimited num-
|
196
|
+
ber of arguments within your Juicefile; however, you should be careful
|
197
|
+
with how this is used. Don't go including sudo rm -rf %arg1% in a com-
|
198
|
+
mand, while passing / as an argument. Keep it simple. These are meant
|
199
|
+
to make your life easier by helping you manage build tools, not to do
|
200
|
+
fancy scripting.
|
201
|
+
|
202
|
+
CONFIG TEMPLATE STRINGS
|
203
|
+
You may define ERB template strings within a project starter template's
|
204
|
+
Juicefile(5). These will be replaced upon running create(1).
|
205
|
+
|
206
|
+
For example,
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
# Project configuration
|
211
|
+
project:
|
212
|
+
name: <%= name %>
|
213
|
+
url: <%= url %>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
will be replaced with,
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
# Project configuration
|
222
|
+
project:
|
223
|
+
name: example-project
|
224
|
+
url: example-project.dev
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
if those were the options chosen during a creation. The following vari-
|
229
|
+
ables are available for use:
|
230
|
+
|
231
|
+
name Project name
|
232
|
+
|
233
|
+
location
|
234
|
+
Project location
|
235
|
+
|
236
|
+
url Project URL
|
237
|
+
|
238
|
+
xip_url
|
239
|
+
Project xip.io URL
|
152
240
|
|
153
|
-
|
154
|
-
|
241
|
+
template
|
242
|
+
Project template repository URL
|
155
243
|
|
156
|
-
|
157
|
-
|
244
|
+
repository
|
245
|
+
Initialized repository URL, if available
|
158
246
|
|
159
|
-
|
160
|
-
|
247
|
+
db_host
|
248
|
+
Project database host
|
161
249
|
|
162
|
-
|
163
|
-
|
250
|
+
db_name
|
251
|
+
Project database name
|
164
252
|
|
165
|
-
|
166
|
-
|
253
|
+
db_user
|
254
|
+
Project database user
|
167
255
|
|
168
|
-
|
169
|
-
|
256
|
+
db_pass
|
257
|
+
Project database password
|
170
258
|
|
171
|
-
|
172
|
-
|
259
|
+
db_import
|
260
|
+
Path to imported database file
|
173
261
|
|
174
|
-
|
175
|
-
Commands used to backup project
|
262
|
+
vm_box Virtual machine box URL
|
176
263
|
|
177
|
-
|
178
|
-
Command used to manage and run project tests
|
264
|
+
vm_ip Virtual machine IP address
|
179
265
|
|
180
|
-
|
181
|
-
|
182
|
-
mand when executed.
|
266
|
+
vm_path
|
267
|
+
Virtual machine location on the host machine
|
183
268
|
|
184
|
-
|
185
|
-
|
269
|
+
vm_root
|
270
|
+
Web root of the VM on the host machine
|
186
271
|
|
187
|
-
|
188
|
-
|
272
|
+
vm_location
|
273
|
+
Project location within the VM on the host machine
|
189
274
|
|
190
|
-
|
191
|
-
.tj.yaml naming convention. The raw filename regex matcher is below if
|
192
|
-
you want to be a little different.
|
275
|
+
vm_srv Project location within the VM on the guest machine
|
193
276
|
|
194
|
-
|
277
|
+
vm_prefix
|
278
|
+
Virtual machine project location prefix
|
195
279
|
|
196
280
|
ENVIRONMENT
|
197
281
|
All of the global options have a corresponding ENV variable that can be
|
@@ -251,4 +335,4 @@ ENVIRONMENT
|
|
251
335
|
|
252
336
|
|
253
337
|
|
254
|
-
|
338
|
+
August 2016 TJ(1)
|
data/lib/theme-juice/project.rb
CHANGED
@@ -13,6 +13,7 @@ module ThemeJuice
|
|
13
13
|
attr_accessor :vm_location
|
14
14
|
attr_accessor :vm_srv
|
15
15
|
attr_accessor :vm_restart
|
16
|
+
attr_accessor :vm_provision
|
16
17
|
attr_accessor :repository
|
17
18
|
attr_accessor :db_host
|
18
19
|
attr_accessor :db_name
|
@@ -31,7 +32,6 @@ module ThemeJuice
|
|
31
32
|
attr_accessor :no_ssl
|
32
33
|
attr_accessor :no_config
|
33
34
|
attr_accessor :wp_config_modify
|
34
|
-
attr_accessor :provision
|
35
35
|
|
36
36
|
def vm_root
|
37
37
|
@vm_root ||= File.expand_path("#{Env.vm_path}/www")
|