theme-juice 0.10.3 → 0.11.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 +51 -4
- data/lib/theme-juice.rb +7 -0
- data/lib/theme-juice/cli.rb +70 -70
- data/lib/theme-juice/commands/deploy.rb +21 -1
- data/lib/theme-juice/config.rb +14 -8
- data/lib/theme-juice/env.rb +2 -0
- data/lib/theme-juice/helpers/hash_helper.rb +41 -0
- data/lib/theme-juice/man/tj +20 -24
- data/lib/theme-juice/man/tj-create +3 -3
- data/lib/theme-juice/man/tj-create.txt +3 -3
- data/lib/theme-juice/man/tj-delete +2 -2
- data/lib/theme-juice/man/tj-delete.txt +3 -3
- data/lib/theme-juice/man/tj-deploy +175 -3
- data/lib/theme-juice/man/tj-deploy.txt +150 -3
- data/lib/theme-juice/man/tj-setup +3 -3
- data/lib/theme-juice/man/tj-setup.txt +3 -3
- data/lib/theme-juice/man/tj.txt +37 -37
- data/lib/theme-juice/tasks/capistrano/db.rb +81 -0
- data/lib/theme-juice/tasks/capistrano/env.rb +22 -0
- data/lib/theme-juice/tasks/capistrano/rsync.rb +39 -0
- data/lib/theme-juice/tasks/capistrano/uploads.rb +22 -0
- data/lib/theme-juice/tasks/invoke.rb +36 -0
- data/lib/theme-juice/tasks/load.rb +38 -0
- data/lib/theme-juice/tasks/settings.rb +56 -0
- data/lib/theme-juice/tasks/stage.rb +39 -0
- data/lib/theme-juice/tasks/theme.rb +1 -1
- data/lib/theme-juice/tasks/vm_stage.rb +38 -0
- data/lib/theme-juice/version.rb +1 -1
- metadata +64 -12
@@ -6,11 +6,158 @@ NAME
|
|
6
6
|
tj-deploy - Deploy a project
|
7
7
|
|
8
8
|
SYNOPSIS
|
9
|
-
tj deploy [--flag=arg] [--flag]
|
9
|
+
tj deploy stage [command] [--flag=arg] [--flag]
|
10
10
|
|
11
11
|
DESCRIPTION
|
12
|
-
|
12
|
+
Deploys a project to the passed stage. All commands are transformed and
|
13
|
+
then piped directly to capistrano(1) to handle deployment.
|
13
14
|
|
15
|
+
SETUP
|
16
|
+
Follow these steps to quickly get up and running:
|
14
17
|
|
18
|
+
1. Create a deploy user on the stage server
|
15
19
|
|
16
|
-
|
20
|
+
2. Create SSH keys for the new deploy user
|
21
|
+
|
22
|
+
3. Create a deployment key for the stage server to clone your reposi-
|
23
|
+
tory
|
24
|
+
|
25
|
+
4. Confirm the deploy user owns the deploy path
|
26
|
+
|
27
|
+
5. Run tj deploy <stage> setup to setup the initial shared and
|
28
|
+
releases directories
|
29
|
+
|
30
|
+
6. Deploy!
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
PRIMARY COMMANDS
|
35
|
+
If no command is passed, the default task to be executed is deploy
|
36
|
+
|
37
|
+
deploy Deploy a project
|
38
|
+
|
39
|
+
rollback
|
40
|
+
Rollback a previous deployment
|
41
|
+
|
42
|
+
setup, check
|
43
|
+
Run a preliminary deployment check, making sure that all neces-
|
44
|
+
sary folders are created and accessible on the passed stage
|
45
|
+
|
46
|
+
SECONDARY COMMANDS
|
47
|
+
db:backup
|
48
|
+
Back up the database on the passed stage and store it locally in
|
49
|
+
the deployment.stages.vagrant.backup directory
|
50
|
+
|
51
|
+
db:pull
|
52
|
+
Pull the database from the passed stage and import it into the
|
53
|
+
development environment
|
54
|
+
|
55
|
+
db:push
|
56
|
+
Push the database from the development environment and import it
|
57
|
+
into the passed stage
|
58
|
+
|
59
|
+
env:pull
|
60
|
+
Pull the current .env.<stage> file from the passed stage to the
|
61
|
+
development environment
|
62
|
+
|
63
|
+
env:push
|
64
|
+
Push the current .env.<stage> file from the development environ-
|
65
|
+
ment to the passed stage
|
66
|
+
|
67
|
+
uploads:pull
|
68
|
+
Pull the current stage's uploads folder from the passed stage to
|
69
|
+
the development environment
|
70
|
+
|
71
|
+
uploads:push
|
72
|
+
Push the uploads folder from the development environment to the
|
73
|
+
passed stage's uploads folder
|
74
|
+
|
75
|
+
CONFIG FILE
|
76
|
+
The YAML Juicefile(5) configuration may be used to store deploy-
|
77
|
+
ment-related settings. Below you will find the various block sequences
|
78
|
+
you may use to define your project's deployment settings. All of these
|
79
|
+
will be passed to capistrano(1) to invoke a deployment.
|
80
|
+
|
81
|
+
deployment
|
82
|
+
Deployment configuration
|
83
|
+
|
84
|
+
deployment.application
|
85
|
+
Application settings passed directly to capistrano(1)
|
86
|
+
|
87
|
+
deployment.settings
|
88
|
+
Deployment settings passed directly to capistrano(1)
|
89
|
+
|
90
|
+
deployment.repository
|
91
|
+
Repository settings passed directly to capistrano(1)
|
92
|
+
|
93
|
+
deployment.rsync
|
94
|
+
Optional settings passed to capistrano-rsync(1); mapped as
|
95
|
+
rsync_<setting> during the deployment initialization
|
96
|
+
|
97
|
+
deployment.slack
|
98
|
+
Optional settings passed to capistrano-slackify(1); mapped as
|
99
|
+
slack_<setting> during the deployment initialization
|
100
|
+
|
101
|
+
deployment.stages
|
102
|
+
Deployment stages
|
103
|
+
|
104
|
+
deployment.stages.<stage>.server
|
105
|
+
Domain or IP address of the server
|
106
|
+
|
107
|
+
deployment.stages.<stage>.path
|
108
|
+
Root path to the deployment directory
|
109
|
+
|
110
|
+
deployment.stages.<stage>.user
|
111
|
+
User account to deploy as (it is recommended not to use root)
|
112
|
+
|
113
|
+
deployment.stages.<stage>.url
|
114
|
+
URL of the stage
|
115
|
+
|
116
|
+
deployment.stages.<stage>.uploads
|
117
|
+
Relative path from deploy path to the uploads folder
|
118
|
+
|
119
|
+
deployment.stages.<stage>.tmp
|
120
|
+
Relative path from deploy path to the tmp folder
|
121
|
+
|
122
|
+
deployment.stages.<stage>.shared
|
123
|
+
Sequence of relative files from application root to place inside
|
124
|
+
of the shared folder
|
125
|
+
|
126
|
+
deployment.stages.<stage>.roles
|
127
|
+
Sequence of deployment roles for the stage
|
128
|
+
|
129
|
+
deployment.stages.vagrant
|
130
|
+
Required development environment settings; these are used for
|
131
|
+
database and file migration
|
132
|
+
|
133
|
+
deployment.stages.vagrant.server
|
134
|
+
Domain or IP address of the development environment
|
135
|
+
|
136
|
+
deployment.stages.vagrant.path
|
137
|
+
Root path to the application directory within the VM
|
138
|
+
|
139
|
+
deployment.stages.vagrant.user
|
140
|
+
User account to deploy as (usually vagrant)
|
141
|
+
|
142
|
+
deployment.stages.vagrant.pass
|
143
|
+
Password for the user (usually vagrant)
|
144
|
+
|
145
|
+
deployment.stages.vagrant.url
|
146
|
+
URL of the project
|
147
|
+
|
148
|
+
deployment.stages.vagrant.uploads
|
149
|
+
Relative path from application root to the uploads folder
|
150
|
+
|
151
|
+
deployment.stages.vagrant.backup
|
152
|
+
Relative path from application root to the backup folder
|
153
|
+
|
154
|
+
deployment.stages.vagrant.tmp
|
155
|
+
Relative path from application root to the tmp folder
|
156
|
+
|
157
|
+
deployment.stages.vagrant.roles
|
158
|
+
Sequence of roles for the development environment
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
July 2015 TJ-DEPLOY(1)
|
@@ -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\-SETUP" "1" "
|
4
|
+
.TH "TJ\-SETUP" "1" "July 2015" "" "Theme Juice Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBtj\-setup\fR \- Setup an existing project
|
@@ -28,7 +28,7 @@ Development URL for the project
|
|
28
28
|
.
|
29
29
|
.TP
|
30
30
|
\fB\-r\fR, \fB\-\-repository\fR=\fIrepository\fR
|
31
|
-
Initialize a new
|
31
|
+
Initialize a new git(1) remote repository
|
32
32
|
.
|
33
33
|
.TP
|
34
34
|
\fB\-i\fR, \fB\-\-import\-db\fR=\fIpath\fR
|
@@ -48,7 +48,7 @@ Skip all prompts and use default settings
|
|
48
48
|
.
|
49
49
|
.TP
|
50
50
|
\fB\-\-no\-wp\fR
|
51
|
-
Project is not a
|
51
|
+
Project is not a wordpress(7) install
|
52
52
|
.
|
53
53
|
.TP
|
54
54
|
\fB\-\-no\-db\fR
|
@@ -24,7 +24,7 @@ GLOBAL OPTIONS
|
|
24
24
|
Development URL for the project
|
25
25
|
|
26
26
|
-r, --repository=repository
|
27
|
-
Initialize a new
|
27
|
+
Initialize a new git(1) remote repository
|
28
28
|
|
29
29
|
-i, --import-db=path
|
30
30
|
Import an existing database
|
@@ -39,7 +39,7 @@ GLOBAL OPTIONS
|
|
39
39
|
Skip all prompts and use default settings
|
40
40
|
|
41
41
|
--no-wp
|
42
|
-
Project is not a
|
42
|
+
Project is not a wordpress(7) install
|
43
43
|
|
44
44
|
--no-db
|
45
45
|
Project does not need a database
|
@@ -47,4 +47,4 @@ GLOBAL OPTIONS
|
|
47
47
|
|
48
48
|
|
49
49
|
|
50
|
-
|
50
|
+
July 2015 TJ-SETUP(1)
|
data/lib/theme-juice/man/tj.txt
CHANGED
@@ -9,16 +9,16 @@ SYNOPSIS
|
|
9
9
|
tj [command] [--flag=arg] [--flag]
|
10
10
|
|
11
11
|
DESCRIPTION
|
12
|
-
tj is a
|
13
|
-
|
14
|
-
(using
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
Theme Juice (tj(1)) is a command line utility modern for WordPress
|
13
|
+
development. It allows you to scaffold out a vagrant(1) development
|
14
|
+
environment in seconds (using an apache(7) fork of vvv(7) called
|
15
|
+
vvv-apache(7) as the VM), and generate/manage an unlimited number of
|
16
|
+
development projects. It also helps you manage dependencies and build
|
17
|
+
tools, and can even handle your deployments.
|
18
18
|
|
19
19
|
GLOBAL OPTIONS
|
20
20
|
--vm-box=repository
|
21
|
-
Force
|
21
|
+
Force vagrant(1) box for use as VM
|
22
22
|
|
23
23
|
--vm-path=path
|
24
24
|
Force path to VM
|
@@ -29,7 +29,8 @@ GLOBAL OPTIONS
|
|
29
29
|
--vm-prefix=string
|
30
30
|
Force directory prefix for project in VM
|
31
31
|
|
32
|
-
--yolo Say yes to anything and everything
|
32
|
+
--yolo Say yes to anything and everything, and maybe even get a few
|
33
|
+
surprises
|
33
34
|
|
34
35
|
--boring
|
35
36
|
Prints all output without any fancy formatting
|
@@ -44,34 +45,34 @@ GLOBAL OPTIONS
|
|
44
45
|
Prints all output without animations
|
45
46
|
|
46
47
|
--no-landrush
|
47
|
-
Disable the landrush gem for managing DNS
|
48
|
+
Disable the landrush(1) gem for managing DNS
|
48
49
|
|
49
50
|
--no-port-forward, --no-port-forwarding
|
50
51
|
Disable automatic port forwarding
|
51
52
|
|
52
53
|
--verbose
|
53
|
-
Prints
|
54
|
+
Prints out additional logging information and raises any excep-
|
54
55
|
tions caught during runtime
|
55
56
|
|
56
57
|
--dryrun, --dry-run
|
57
58
|
Run a command without actually doing anything
|
58
59
|
|
59
60
|
--nginx, --no-apache
|
60
|
-
Create conf files for nginx instead of apache
|
61
|
+
Create conf files for nginx(7) instead of apache(7)
|
61
62
|
|
62
63
|
PRIMARY COMMANDS
|
63
64
|
Run tj help [command] to view an individual command's man page.
|
64
65
|
|
65
|
-
create, new, mk
|
66
|
+
create(1), new, mk
|
66
67
|
Create a new project
|
67
68
|
|
68
|
-
setup, up, init
|
69
|
+
setup(1), up, init
|
69
70
|
Setup an existing project
|
70
71
|
|
71
|
-
delete, rm, remove, trash
|
72
|
+
delete(1), rm, remove, trash
|
72
73
|
Delete a project
|
73
74
|
|
74
|
-
deploy, server, remote
|
75
|
+
deploy(1), server, remote
|
75
76
|
Deploy a project
|
76
77
|
|
77
78
|
SECONDARY COMMANDS
|
@@ -82,12 +83,12 @@ SECONDARY COMMANDS
|
|
82
83
|
List all projects
|
83
84
|
|
84
85
|
vm, vagrant, vvv=[command[,command]...]
|
85
|
-
Manage development
|
86
|
-
to
|
87
|
-
directory.
|
86
|
+
Manage development environment via vagrant(1). Commands are
|
87
|
+
proxied to your Vagrant installation so that they can be run
|
88
|
+
from any directory.
|
88
89
|
|
89
90
|
CONFIG COMMANDS
|
90
|
-
These
|
91
|
+
These run the corresponding command from your project's config file.
|
91
92
|
They accept any number of arguments, since the behavior and handling of
|
92
93
|
input is defined within the config file itself.
|
93
94
|
|
@@ -107,7 +108,7 @@ CONFIG COMMANDS
|
|
107
108
|
Package project for distribution
|
108
109
|
|
109
110
|
wp, wordpress=[arg[,arg]...]
|
110
|
-
Manage project's
|
111
|
+
Manage project's wordpress(7) installation with wp-cli(1)
|
111
112
|
|
112
113
|
backup, bk=[arg[,arg]...]
|
113
114
|
Backup project
|
@@ -116,10 +117,10 @@ CONFIG COMMANDS
|
|
116
117
|
Manage and run project tests
|
117
118
|
|
118
119
|
CONFIG FILE
|
119
|
-
A
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
A YAML Juicefile(5) configuration can be used to store commonly-used
|
121
|
+
build scripts. Each command block sequence can be mapped to an individ-
|
122
|
+
ual project's build tool, allowing a streamlined set of commands to be
|
123
|
+
used across multiple projects that utilize different tools.
|
123
124
|
|
124
125
|
commands
|
125
126
|
Collection of various command block sequences
|
@@ -148,9 +149,6 @@ CONFIG FILE
|
|
148
149
|
commands.test
|
149
150
|
Command used to manage and run project tests
|
150
151
|
|
151
|
-
deployment
|
152
|
-
Coming soon
|
153
|
-
|
154
152
|
Placeholder arguments can be used within any command block sequence to
|
155
153
|
allow splat or indexed arguments to be passed to the corresponding com-
|
156
154
|
mand when executed.
|
@@ -165,16 +163,16 @@ CONFIG FILE
|
|
165
163
|
.tj.yaml naming convention. The raw filename regex matcher is below if
|
166
164
|
you want to be a little different.
|
167
165
|
|
168
|
-
/^(((\.)?(tj)|((J|j)uicefile))(
|
166
|
+
/^(((\.)?(tj)|((J|j)uicefile))(\.y(a)?ml)?$)/
|
169
167
|
|
170
168
|
ENVIRONMENT
|
171
169
|
All of the global options have a corresponding ENV variable that can be
|
172
|
-
set to permanently use the specified value each time tj is run. This
|
173
|
-
useful
|
174
|
-
|
170
|
+
set to permanently use the specified value each time tj(1) is run. This
|
171
|
+
is useful if you're using an alternate vagrant(1) box, or if you need
|
172
|
+
to disable certain features due to limited support e.g. on Windows.
|
175
173
|
|
176
174
|
TJ_VM_BOX=repository
|
177
|
-
Force
|
175
|
+
Force vagrant(1) box for use as VM
|
178
176
|
|
179
177
|
TJ_PATH=path
|
180
178
|
Force path to VM
|
@@ -186,7 +184,8 @@ ENVIRONMENT
|
|
186
184
|
Force directory prefix for project in VM
|
187
185
|
|
188
186
|
TJ_YOLO=bool
|
189
|
-
Say yes to anything and everything
|
187
|
+
Say yes to anything and everything, and maybe even get a few
|
188
|
+
surprises
|
190
189
|
|
191
190
|
TJ_BORING=bool
|
192
191
|
Prints all output without any fancy formatting
|
@@ -201,21 +200,22 @@ ENVIRONMENT
|
|
201
200
|
Prints all output without animations (coming soon)
|
202
201
|
|
203
202
|
TJ_NO_LANDRUSH=bool
|
204
|
-
Disable the landrush gem for managing DNS
|
203
|
+
Disable the landrush(1) gem for managing DNS
|
205
204
|
|
206
205
|
TJ_NO_PORT_FORWARD=bool
|
207
206
|
Disable automatic port forwarding
|
208
207
|
|
209
208
|
TJ_VERBOSE=bool
|
210
|
-
Prints
|
209
|
+
Prints out additional logging information and raises any excep-
|
210
|
+
tions caught during runtime
|
211
211
|
|
212
212
|
TJ_DRYRUN=bool
|
213
213
|
Run a command without actually doing anything
|
214
214
|
|
215
215
|
TJ_NGINX=bool
|
216
|
-
Create conf files for nginx instead of apache
|
216
|
+
Create conf files for nginx(7) instead of apache(7)
|
217
217
|
|
218
218
|
|
219
219
|
|
220
220
|
|
221
|
-
|
221
|
+
July 2015 TJ(1)
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
namespace :db do
|
4
|
+
|
5
|
+
desc "Initialize database variables"
|
6
|
+
task :init do
|
7
|
+
set :timestamp, Time.now.strftime("%Y%m%d%H%M%S")
|
8
|
+
set :remote_db, "#{fetch(:timestamp)}.#{fetch(:stage)}.sql"
|
9
|
+
set :vm_db, "#{fetch(:timestamp)}.local.sql"
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Backup database on remote to local"
|
13
|
+
task :backup do
|
14
|
+
invoke "db:init"
|
15
|
+
|
16
|
+
on roles(:db) do
|
17
|
+
|
18
|
+
within release_path do
|
19
|
+
execute :wp, :db, :export, "#{fetch(:tmp_dir)}/#{fetch(:remote_db)}", "--add-drop-table"
|
20
|
+
end
|
21
|
+
|
22
|
+
run_locally do
|
23
|
+
execute :mkdir, "-p", fetch(:vm_backup_dir)
|
24
|
+
end
|
25
|
+
|
26
|
+
download! "#{fetch(:tmp_dir)}/#{fetch(:remote_db)}", "#{fetch(:vm_backup_dir)}/#{fetch(:remote_db)}"
|
27
|
+
|
28
|
+
within release_path do
|
29
|
+
execute :rm, "#{fetch(:tmp_dir)}/#{fetch(:remote_db)}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Push local database to remote"
|
35
|
+
task :push do
|
36
|
+
invoke "db:backup"
|
37
|
+
|
38
|
+
on roles(:dev) do
|
39
|
+
within fetch(:dev_path) do
|
40
|
+
execute :wp, :db, :export, "#{fetch(:vm_backup_dir)}/#{fetch(:vm_db)}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
on roles(:web) do
|
45
|
+
upload! "#{fetch(:vm_backup_dir)}/#{fetch(:vm_db)}", "#{fetch(:tmp_dir)}/#{fetch(:vm_db)}"
|
46
|
+
|
47
|
+
within release_path do
|
48
|
+
execute :wp, :db, :import, "#{fetch(:tmp_dir)}/#{fetch(:vm_db)}"
|
49
|
+
execute :rm, "#{fetch(:tmp_dir)}/#{fetch(:vm_db)}"
|
50
|
+
execute :wp, "search-replace", fetch(:vm_url), fetch(:stage_url), fetch(:wpcli_args) || "--skip-columns=guid"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
on roles(:dev) do
|
55
|
+
within fetch(:dev_path) do
|
56
|
+
execute :rm, "#{fetch(:vm_backup_dir)}/#{fetch(:vm_db)}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "Pull remote database to local"
|
62
|
+
task :pull do
|
63
|
+
invoke "db:backup"
|
64
|
+
|
65
|
+
on roles(:db) do
|
66
|
+
within release_path do
|
67
|
+
execute :wp, :db, :export, "#{fetch(:tmp_dir)}/#{fetch(:remote_db)}"
|
68
|
+
download! "#{fetch(:tmp_dir)}/#{fetch(:remote_db)}", "#{fetch(:vm_backup_dir)}/#{fetch(:remote_db)}"
|
69
|
+
execute :rm, "#{fetch(:tmp_dir)}/#{fetch(:remote_db)}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
on roles(:dev) do
|
74
|
+
within fetch(:dev_path) do
|
75
|
+
execute :wp, :db, :import, "#{fetch(:vm_backup_dir)}/#{fetch(:remote_db)}"
|
76
|
+
execute :rm, "#{fetch(:vm_backup_dir)}/#{fetch(:remote_db)}"
|
77
|
+
execute :wp, "search-replace", fetch(:stage_url), fetch(:vm_url), fetch(:wpcli_args) || "--skip-columns=guid"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|