theme-juice 0.6.18 → 0.7.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 +106 -75
- data/bin/tj +5 -5
- data/lib/theme-juice.rb +32 -16
- data/lib/theme-juice/cli.rb +191 -298
- data/lib/theme-juice/command.rb +14 -13
- data/lib/theme-juice/commands/create.rb +214 -9
- data/lib/theme-juice/commands/delete.rb +45 -10
- data/lib/theme-juice/commands/deploy.rb +20 -0
- data/lib/theme-juice/config.rb +43 -0
- data/lib/theme-juice/env.rb +25 -0
- data/lib/theme-juice/io.rb +323 -0
- data/lib/theme-juice/project.rb +35 -0
- data/lib/theme-juice/task.rb +42 -0
- data/lib/theme-juice/tasks/create_confirm.rb +33 -0
- data/lib/theme-juice/tasks/create_success.rb +42 -0
- data/lib/theme-juice/tasks/database.rb +50 -0
- data/lib/theme-juice/tasks/delete_confirm.rb +24 -0
- data/lib/theme-juice/tasks/delete_success.rb +31 -0
- data/lib/theme-juice/tasks/dns.rb +45 -0
- data/lib/theme-juice/tasks/dot_env.rb +53 -0
- data/lib/theme-juice/tasks/entry.rb +50 -0
- data/lib/theme-juice/tasks/hosts.rb +43 -0
- data/lib/theme-juice/tasks/import_database.rb +28 -0
- data/lib/theme-juice/tasks/landrush.rb +33 -0
- data/lib/theme-juice/tasks/list.rb +50 -0
- data/lib/theme-juice/tasks/location.rb +23 -0
- data/lib/theme-juice/tasks/nginx.rb +51 -0
- data/lib/theme-juice/tasks/repo.rb +49 -0
- data/lib/theme-juice/tasks/synced_folder.rb +30 -0
- data/lib/theme-juice/tasks/theme.rb +34 -0
- data/lib/theme-juice/tasks/vm.rb +30 -0
- data/lib/theme-juice/tasks/vm_customfile.rb +42 -0
- data/lib/theme-juice/tasks/vm_location.rb +32 -0
- data/lib/theme-juice/tasks/vm_plugins.rb +32 -0
- data/lib/theme-juice/tasks/vm_provision.rb +39 -0
- data/lib/theme-juice/tasks/vm_restart.rb +25 -0
- data/lib/theme-juice/tasks/wp_cli.rb +52 -0
- data/lib/theme-juice/util.rb +45 -0
- data/lib/theme-juice/version.rb +1 -1
- metadata +66 -34
- data/LICENSE +0 -339
- data/lib/theme-juice/commands/install.rb +0 -16
- data/lib/theme-juice/commands/list.rb +0 -16
- data/lib/theme-juice/commands/subcommand.rb +0 -16
- data/lib/theme-juice/environment.rb +0 -15
- data/lib/theme-juice/interaction.rb +0 -445
- data/lib/theme-juice/interactions/create.rb +0 -278
- data/lib/theme-juice/interactions/delete.rb +0 -48
- data/lib/theme-juice/interactions/teejay.rb +0 -12
- data/lib/theme-juice/service.rb +0 -224
- data/lib/theme-juice/services/config.rb +0 -44
- data/lib/theme-juice/services/create.rb +0 -376
- data/lib/theme-juice/services/delete.rb +0 -113
- data/lib/theme-juice/services/list.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6723de16768298aea17ee0d1f9c07254776eb24
|
4
|
+
data.tar.gz: 1221dc65cd74ae60f045aba59e40f7af3765db98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b54c081943afc61514c857e7df586d5cc244154322200e4962f44576eabfe67b900c38595c0806dd29ad82ee5cbe2bee3114ff4962694cda2a84309d6c601d
|
7
|
+
data.tar.gz: 6a926e9644dae59f5e29a5867ddd950299fd4324abaa1e7aeda3d5c681c7d6fdd619eca3f838f8e6e9c7333246e533579d9298f78ef252e358f32faded07fca0
|
data/README.md
CHANGED
@@ -1,35 +1,34 @@
|
|
1
1
|
# Theme Juice [![Gem Version](http://img.shields.io/gem/v/theme-juice.svg)](https://rubygems.org/gems/theme-juice)
|
2
|
-
What is it? Theme Juice is a command line
|
2
|
+
What is it? Theme Juice is a command line tool that allows you to scaffold out a new WordPress development environment (using [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV) as the VM) and countless development projects. Everybody loves one command setups, and `tj` will eventually even do one command deployments too.
|
3
3
|
|
4
4
|
## Installation
|
5
5
|
* First, install [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) for local development.
|
6
|
-
* Then, install [Composer](https://getcomposer.org/) and [WP-CLI](http://wp-cli.org/)
|
6
|
+
* Then, install [Composer](https://getcomposer.org/) and [WP-CLI](http://wp-cli.org/), and make sure they're executable.
|
7
7
|
* Finally, install with: `gem install theme-juice`
|
8
8
|
That`s it!
|
9
9
|
|
10
10
|
## Config
|
11
|
-
Because everybody likes to use different tools, you can create a `tj.
|
11
|
+
Because everybody likes to use different tools, you can create a `Juicefile` or `tj.yaml` config (with an optional preceding `.`) that will house all of your theme-specific commands. This allows you to use a streamlined set of commands that will act as aliases to your per-project configuration, as well as starter-theme specific information, such as deployment configuration, etc. For right now, we'll just stick to the `commands` section.
|
12
12
|
|
13
|
-
If you're into [Grunt](https://github.com/gruntjs/grunt), then use it. Prefer [Guard](https://github.com/guard/guard)? Go right ahead. This is obviously relative to the starter theme you use, since you can't exactly use Grunt with a
|
13
|
+
If you're into [Grunt](https://github.com/gruntjs/grunt), then use it. Prefer [Guard](https://github.com/guard/guard)? Go right ahead. This is obviously relative to the starter theme you use, since you can't exactly use Grunt with a project that doesn't support it. Below is the config that comes baked into [our starter theme](https://github.com/ezekg/theme-juice-starter):
|
14
14
|
|
15
15
|
```yml
|
16
16
|
commands:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
install:
|
18
|
+
- composer install
|
19
|
+
watch:
|
20
|
+
- grunt
|
21
|
+
vendor:
|
22
|
+
- composer
|
23
|
+
wp:
|
24
|
+
- wp ssh --host=vagrant
|
25
|
+
backup:
|
26
|
+
- wp ssh --host=vagrant db export backup/$(date +'%Y-%m-%d-%H-%M-%S').sql
|
27
|
+
dist:
|
28
|
+
- tar -zcvf dist.tar.gz .
|
22
29
|
```
|
23
30
|
|
24
|
-
|
25
|
-
|
26
|
-
### Command options:
|
27
|
-
| Option | Usage |
|
28
|
-
|:--------- |:----------------------------------------------------------------------------- |
|
29
|
-
| `watch` | Command to be aliased when you run `tj watch` for bulding assets |
|
30
|
-
| `server` | Command to be aliased when you run `tj server` for deployments |
|
31
|
-
| `vendor` | Command to be aliased when you run `tj vendor` for dependencies |
|
32
|
-
| `install` | Each command is executed when you run `tj install` to prepare a starter theme |
|
31
|
+
Each command is run within a single execution, with all arguments passed to each command; i.e. `cmd1 [<ARGS>] && cmd2 [<ARGS>] && ...`. So, you should be careful with how this is used. Don't do something like including `sudo rm -rf` in a command, and then passing `/` as an argument. Keep it simple.
|
33
32
|
|
34
33
|
## Usage
|
35
34
|
|
@@ -42,103 +41,135 @@ tj
|
|
42
41
|
### Print version:
|
43
42
|
This command will print the current version of `tj`.
|
44
43
|
```bash
|
45
|
-
tj --version # Aliases: -v
|
44
|
+
tj --version # Aliases: -v version
|
46
45
|
```
|
47
46
|
|
48
47
|
### Global flags:
|
49
|
-
| Flag
|
50
|
-
|
51
|
-
| `[--
|
52
|
-
| `[--
|
53
|
-
|
54
|
-
|
55
|
-
| `[--
|
48
|
+
| Flag | Type | Description |
|
49
|
+
|:---------------------- |:------ |:------------------------------------------ |
|
50
|
+
| `[--vm-path=PATH]` | String | Force path to VM |
|
51
|
+
| `[--vm-ip=IP]` | String | Force IP address for VM |
|
52
|
+
| `[--vm-prefix=PREFIX]` | String | Force directory prefix for project in VM |
|
53
|
+
| `[--yolo]` | Bool | Say yes to anything and everything |
|
54
|
+
| `[--boring]` | Bool | Disable all the coolness |
|
55
|
+
| `[--no-unicode]` | Bool | Disable all unicode characters |
|
56
|
+
| `[--no-colors]` | Bool | Disable all colored output |
|
57
|
+
| `[--no-animations]` | Bool | Disable all animations |
|
58
|
+
| `[--no-landrush]` | Bool | Disable landrush for DNS |
|
59
|
+
| `[--verbose]` | Bool | Verbose output |
|
60
|
+
| `[--dryrun]` | Bool | Disable running all commands |
|
61
|
+
|
62
|
+
_Use `ENV` variables to set global flags. For example, by running `export TJ_VM_PATH=~/vagrant-vvv`, the `ENV` variable will be used instead of the default `vm-path` from then on. You can remove global flags with `unset TJ_VM_PATH`_
|
56
63
|
|
57
64
|
### Creating a new development site:
|
58
|
-
Use this to create a new
|
65
|
+
Use this to create a new project. It will automagically set up your VM, including a local development site at `http://<url>.dev` with WordPress installed and a fresh WP database. It will sync up your local site installation with the Vagrant VM, so you can organize your projects however you want. This task will also install VVV into your `vm-path` directory if it has not already been installed.
|
59
66
|
```bash
|
60
|
-
tj create
|
67
|
+
tj create # Aliases: mk new add
|
61
68
|
```
|
62
69
|
|
63
70
|
#### Option flags:
|
64
|
-
| Flag
|
65
|
-
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
| `[--
|
73
|
-
| `[--
|
74
|
-
| `[--
|
71
|
+
| Flag | Type | Description |
|
72
|
+
|:-------------------------------- |:------ |:------------------------------------------------ |
|
73
|
+
| `[-n, --name]` | String | Name of the project |
|
74
|
+
| `[-l, --location]` | String | Location of the local project |
|
75
|
+
| `[-t, --theme]` | String | Starter theme to install |
|
76
|
+
| `[-u, --url]` | String | Development URL for the project |
|
77
|
+
| `[-r, --repository]` | String | Initialize a new Git remote repository |
|
78
|
+
| `[--import-db, --db_import, -i]` | String | Import an existing database |
|
79
|
+
| `[--bare]` | Bool | Create a project without a starter theme |
|
80
|
+
| `[--skip_repo]` | Bool | Skip repository prompts and use default settings |
|
81
|
+
| `[--skip_db]` | Bool | Skip database prompts and use default settings |
|
82
|
+
| `[--use_defaults]` | Bool | Skip all prompts and use default settings |
|
83
|
+
| `[--no_wp]` | Bool | New project is not a WordPress install |
|
84
|
+
| `[--no_db]` | Bool | New project does not need a database |
|
75
85
|
|
76
86
|
### Setting up an existing site:
|
77
|
-
Use this to setup an existing local site installation within the development environment. You will go through the setup process to create the necessary files for the VM, including `vvv-hosts`, `vvv-nginx.conf`, and a fresh database (unless one already exists by the name chosen).
|
87
|
+
Use this to setup an existing local site installation within the development environment. You will go through the setup process to create the necessary files for the VM, including `vvv-hosts`, `vvv-nginx.conf`, and a fresh database (unless one already exists by the name chosen). This is essentially an alias for `create`, but with a few options being skipped.
|
78
88
|
```bash
|
79
|
-
tj setup
|
89
|
+
tj setup # Aliases: up prep init make
|
80
90
|
```
|
81
91
|
|
82
92
|
#### Option flags:
|
83
|
-
| Flag
|
84
|
-
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
| `[--
|
90
|
-
| `[--
|
91
|
-
| `[--
|
93
|
+
| Flag | Type | Description |
|
94
|
+
|:-------------------------------- |:------ |:------------------------------------------------ |
|
95
|
+
| `[-n, --name]` | String | Name of the project |
|
96
|
+
| `[-l, --location]` | String | Location of the local project |
|
97
|
+
| `[-u, --url]` | String | Development URL for the project |
|
98
|
+
| `[-r, --repository]` | String | Initialize a new Git remote repository |
|
99
|
+
| `[-i, --import-db, --db_import]` | String | Import an existing database |
|
100
|
+
| `[--skip_repo]` | Bool | Skip repository prompts and use default settings |
|
101
|
+
| `[--skip_db]` | Bool | Skip database prompts and use default settings |
|
102
|
+
| `[--use_defaults]` | Bool | Skip all prompts and use default settings |
|
103
|
+
| `[--no_wp]` | Bool | New project is not a WordPress install |
|
104
|
+
| `[--no_db]` | Bool | New project does not need a database |
|
92
105
|
|
93
106
|
### Deleting a site from the VM: _(Does not remove your local site)_
|
94
|
-
Use this to remove a site from your development environment. This
|
107
|
+
Use this to remove a site from your development environment. This will only remove files that were generated by `tj`. including the database setup, development url, and shared directories. _It will not touch your local folders that were synced to the VM._
|
95
108
|
```bash
|
96
|
-
tj delete
|
109
|
+
tj delete # Aliases: rm remove trash teardown
|
97
110
|
```
|
98
111
|
|
99
112
|
#### Option flags:
|
100
|
-
| Flag
|
101
|
-
|
102
|
-
|
|
103
|
-
| `[--
|
104
|
-
|
105
|
-
|
106
|
-
|
113
|
+
| Flag | Type | Description |
|
114
|
+
|:---------------- |:------ |:------------------------------- |
|
115
|
+
| `[-n, --name]` | String | Name of the development project |
|
116
|
+
| `[-u, --url]` | String | Development URL for the project |
|
117
|
+
| `[--db_drop]` | Bool | Drop project's database |
|
118
|
+
| `[--vm_restart]` | Bool | Restart VM after deletion |
|
119
|
+
|
120
|
+
### Managing deployment and migration (coming soon):
|
121
|
+
Use this to easily manage your deployment and migration with [Capistrano](https://github.com/capistrano/capistrano) or whatever command is in your config. This is just a wrapper for your chosen command.
|
107
122
|
```bash
|
108
|
-
tj
|
123
|
+
tj deploy # Aliases: deployer server remote
|
109
124
|
```
|
110
125
|
|
111
|
-
###
|
112
|
-
Use this to
|
126
|
+
### Listing all `tj` projects in the VM:
|
127
|
+
Use this to list all projects within your VM that were generated by `tj`.
|
113
128
|
```bash
|
114
|
-
tj
|
129
|
+
tj list # Aliases: ls projects apps sites
|
115
130
|
```
|
116
131
|
|
117
132
|
### Managing development environment:
|
118
|
-
Use this to easily manage your [Varying Vagrant Vagrants](https://github.com/Varying-Vagrant-Vagrants/VVV)
|
133
|
+
Use this to easily manage your [Varying Vagrant Vagrants](https://github.com/Varying-Vagrant-Vagrants/VVV) VM. This is a wrapper for Vagrant commands executed within your VM path.
|
134
|
+
```bash
|
135
|
+
tj vm # Aliases: vagrant vvv
|
136
|
+
```
|
137
|
+
|
138
|
+
### Watching and compiling assets:
|
139
|
+
Use this to watch and compile assets with your preferred build tool, whether that be [Grunt](https://github.com/gruntjs/grunt), [Gulp](https://github.com/gulpjs/gulp), [Guard](https://github.com/guard/guard), or whatever. This is simply a wrapper for whatever command is in your config file.
|
119
140
|
```bash
|
120
|
-
tj
|
141
|
+
tj watch # Aliases: assets dev build
|
121
142
|
```
|
122
143
|
|
123
144
|
### Managing vendor dependencies:
|
124
|
-
Use this to easily manage your dependencies with [Composer](https://github.com/composer/composer), or whatever
|
145
|
+
Use this to easily manage your dependencies with [Composer](https://github.com/composer/composer), or whatever command you set within your config.
|
146
|
+
```bash
|
147
|
+
tj vendor # Aliases: dependencies deps
|
148
|
+
```
|
149
|
+
|
150
|
+
### Executing WP-CLI locally inside your VM:
|
151
|
+
Upon setup, an `ssh` block for the VM is automatically added to the `wp-cli.local.yml` file with all of your VM paths. In our starter theme, we use [wp-cli-ssh](https://github.com/xwp/wp-cli-ssh) to run `wp` commands locally.
|
152
|
+
In order to do the same, it needs to be a dependency in your `composer.json`.
|
125
153
|
```bash
|
126
|
-
tj
|
154
|
+
tj wp # Aliases: wordpress
|
127
155
|
```
|
128
156
|
|
129
|
-
###
|
130
|
-
|
157
|
+
### Backing up your database:
|
158
|
+
Uses `backup` command within your config.
|
131
159
|
```bash
|
132
|
-
tj
|
160
|
+
tj backup # Aliases: bk
|
133
161
|
```
|
134
162
|
|
135
|
-
###
|
136
|
-
|
163
|
+
### Distributing a package of your project:
|
164
|
+
Uses `dist` command within your config.
|
137
165
|
```bash
|
138
|
-
|
166
|
+
tj dist # Aliases: distrubute pack package
|
167
|
+
```
|
139
168
|
|
140
|
-
|
141
|
-
|
169
|
+
### Running your test suite:
|
170
|
+
Uses `dist` command within your config.
|
171
|
+
```bash
|
172
|
+
tj test # Aliases: tests spec specs
|
142
173
|
```
|
143
174
|
|
144
175
|
## Contributing
|
data/bin/tj
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
4
|
begin
|
5
|
-
|
5
|
+
require_relative "../lib/theme-juice"
|
6
6
|
rescue LoadError => err
|
7
|
-
|
8
|
-
|
7
|
+
warn err
|
8
|
+
exit 1
|
9
9
|
end
|
10
10
|
|
11
11
|
Signal.trap "INT" do
|
12
|
-
|
12
|
+
ThemeJuice::IO.goodbye
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
ThemeJuice::CLI.start
|
data/lib/theme-juice.rb
CHANGED
@@ -2,29 +2,45 @@
|
|
2
2
|
|
3
3
|
require "thor"
|
4
4
|
require "faker"
|
5
|
-
require "
|
6
|
-
require "pathname"
|
7
|
-
require "tempfile"
|
5
|
+
require "os"
|
8
6
|
require "yaml"
|
9
7
|
|
10
8
|
module ThemeJuice
|
11
9
|
end
|
12
10
|
|
13
11
|
require_relative "theme-juice/version"
|
14
|
-
require_relative "theme-juice/
|
15
|
-
require_relative "theme-juice/
|
16
|
-
require_relative "theme-juice/
|
17
|
-
require_relative "theme-juice/
|
18
|
-
require_relative "theme-juice/
|
19
|
-
require_relative "theme-juice/
|
20
|
-
require_relative "theme-juice/
|
21
|
-
require_relative "theme-juice/
|
22
|
-
require_relative "theme-juice/
|
23
|
-
require_relative "theme-juice/
|
12
|
+
require_relative "theme-juice/env"
|
13
|
+
require_relative "theme-juice/project"
|
14
|
+
require_relative "theme-juice/util"
|
15
|
+
require_relative "theme-juice/io"
|
16
|
+
require_relative "theme-juice/config"
|
17
|
+
require_relative "theme-juice/task"
|
18
|
+
require_relative "theme-juice/tasks/entry"
|
19
|
+
require_relative "theme-juice/tasks/vm"
|
20
|
+
require_relative "theme-juice/tasks/create_confirm"
|
21
|
+
require_relative "theme-juice/tasks/delete_confirm"
|
22
|
+
require_relative "theme-juice/tasks/location"
|
23
|
+
require_relative "theme-juice/tasks/theme"
|
24
|
+
require_relative "theme-juice/tasks/repo"
|
25
|
+
require_relative "theme-juice/tasks/dot_env"
|
26
|
+
require_relative "theme-juice/tasks/hosts"
|
27
|
+
require_relative "theme-juice/tasks/nginx"
|
28
|
+
require_relative "theme-juice/tasks/vm_plugins"
|
29
|
+
require_relative "theme-juice/tasks/vm_location"
|
30
|
+
require_relative "theme-juice/tasks/vm_customfile"
|
31
|
+
require_relative "theme-juice/tasks/database"
|
32
|
+
require_relative "theme-juice/tasks/landrush"
|
33
|
+
require_relative "theme-juice/tasks/synced_folder"
|
34
|
+
require_relative "theme-juice/tasks/dns"
|
35
|
+
require_relative "theme-juice/tasks/wp_cli"
|
36
|
+
require_relative "theme-juice/tasks/create_success"
|
37
|
+
require_relative "theme-juice/tasks/delete_success"
|
38
|
+
require_relative "theme-juice/tasks/vm_provision"
|
39
|
+
require_relative "theme-juice/tasks/vm_restart"
|
40
|
+
require_relative "theme-juice/tasks/import_database"
|
41
|
+
require_relative "theme-juice/tasks/list"
|
24
42
|
require_relative "theme-juice/command"
|
25
|
-
require_relative "theme-juice/commands/install"
|
26
43
|
require_relative "theme-juice/commands/create"
|
27
44
|
require_relative "theme-juice/commands/delete"
|
28
|
-
require_relative "theme-juice/commands/
|
29
|
-
require_relative "theme-juice/commands/subcommand"
|
45
|
+
require_relative "theme-juice/commands/deploy"
|
30
46
|
require_relative "theme-juice/cli"
|
data/lib/theme-juice/cli.rb
CHANGED
@@ -1,318 +1,211 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module ThemeJuice
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#
|
32
|
-
# Print current version
|
33
|
-
#
|
34
|
-
# @return {String}
|
35
|
-
#
|
36
|
-
def version
|
37
|
-
self.set_environment
|
38
|
-
|
39
|
-
@interaction.speak @version, {
|
40
|
-
:color => :green
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "create [NAME]", "Create new site and setup VVV environment"
|
45
|
-
method_option :name, :type => :string, :aliases => "-n", :default => false, :desc => "Name of the development site"
|
46
|
-
method_option :location, :type => :string, :aliases => "-l", :default => false, :desc => "Location of the local site"
|
47
|
-
method_option :theme, :type => :string, :aliases => "-t", :default => false, :desc => "Starter theme to install"
|
48
|
-
method_option :url, :type => :string, :aliases => "-u", :default => false, :desc => "Development URL of the site"
|
49
|
-
method_option :repository, :type => :string, :aliases => "-r", :desc => "Initialize a new Git remote repository"
|
50
|
-
method_option :bare, :type => :boolean, :desc => "Create a VVV site without a starter theme"
|
51
|
-
method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use defaults"
|
52
|
-
method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use defaults"
|
53
|
-
method_option :use_defaults, :type => :boolean, :desc => "Skip all prompts and use default settings"
|
54
|
-
#
|
55
|
-
# Install and setup VVV environment with new site
|
56
|
-
#
|
57
|
-
# @param {String} name (nil)
|
58
|
-
# Name of the site to create
|
59
|
-
#
|
60
|
-
# @return {Void}
|
61
|
-
#
|
62
|
-
def create(name = nil)
|
63
|
-
self.set_environment
|
64
|
-
@interaction.hello
|
65
|
-
|
66
|
-
opts = {
|
67
|
-
:site_name => name || options[:name],
|
68
|
-
:site_location => options[:location],
|
69
|
-
:site_starter_theme => options[:theme],
|
70
|
-
:site_dev_location => nil,
|
71
|
-
:site_dev_url => options[:url],
|
72
|
-
:site_repository => options[:repository],
|
73
|
-
:site_bare => options[:bare],
|
74
|
-
:skip_repo => options[:skip_repo],
|
75
|
-
:skip_db => options[:skip_db],
|
76
|
-
:use_defaults => options[:use_defaults]
|
77
|
-
}
|
78
|
-
|
79
|
-
@create.new(opts)
|
80
|
-
end
|
81
|
-
|
82
|
-
desc "setup [NAME]", "Setup an existing site within the development environment"
|
83
|
-
method_option :name, :type => :string, :aliases => "-n", :default => false, :desc => "Name of the development site"
|
84
|
-
method_option :location, :type => :string, :aliases => "-l", :default => false, :desc => "Location of the local site"
|
85
|
-
method_option :url, :type => :string, :aliases => "-u", :default => false, :desc => "Development URL of the site"
|
86
|
-
method_option :repository, :type => :string, :aliases => "-r", :desc => "Initialize a new Git remote repository"
|
87
|
-
method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use defaults"
|
88
|
-
method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use defaults"
|
89
|
-
method_option :use_defaults, :type => :boolean, :desc => "Skip all prompts and use default settings"
|
90
|
-
#
|
91
|
-
# Setup an existing WordPress install in VVV
|
92
|
-
#
|
93
|
-
# @param {String} name (nil)
|
94
|
-
# Name of the site to setup
|
95
|
-
#
|
96
|
-
# @return {Void}
|
97
|
-
#
|
98
|
-
def setup(name = nil)
|
99
|
-
self.set_environment
|
100
|
-
@interaction.hello
|
101
|
-
|
102
|
-
opts = {
|
103
|
-
:site_name => name || options[:name],
|
104
|
-
:site_location => options[:location],
|
105
|
-
:site_starter_theme => false,
|
106
|
-
:site_dev_location => nil,
|
107
|
-
:site_dev_url => options[:url],
|
108
|
-
:site_repository => options[:repository],
|
109
|
-
:site_bare => true,
|
110
|
-
:skip_repo => options[:skip_repo],
|
111
|
-
:skip_db => options[:skip_db],
|
112
|
-
:use_defaults => options[:use_defaults]
|
113
|
-
}
|
114
|
-
|
115
|
-
@create.new(opts)
|
116
|
-
end
|
117
|
-
|
118
|
-
desc "delete [NAME]", "Remove site from the VVV development environment (does not remove local site)"
|
119
|
-
method_option :name, :type => :string, :aliases => "-n", :default => false, :desc => "Name of the development site"
|
120
|
-
method_option :restart, :type => :boolean, :desc => "Restart development environment after deletion"
|
121
|
-
#
|
122
|
-
# Remove all traces of site from Vagrant
|
123
|
-
#
|
124
|
-
# @param {String} name (nil)
|
125
|
-
# Site to delete. This will not delete your local files, only
|
126
|
-
# files within the VVV environment.
|
127
|
-
#
|
128
|
-
# @return {Void}
|
129
|
-
#
|
130
|
-
def delete(name = nil)
|
131
|
-
self.set_environment
|
132
|
-
|
133
|
-
opts = {
|
134
|
-
:site_name => name || options[:name],
|
135
|
-
:site_dev_location => nil,
|
136
|
-
:restart => options[:restart]
|
137
|
-
}
|
138
|
-
|
139
|
-
@delete.new(opts)
|
140
|
-
end
|
141
|
-
|
142
|
-
desc "list", "List all sites within the VVV development environment"
|
143
|
-
#
|
144
|
-
# List all development sites
|
145
|
-
#
|
146
|
-
# @return {Void}
|
147
|
-
#
|
148
|
-
def list
|
149
|
-
self.set_environment
|
150
|
-
|
151
|
-
@list.new
|
152
|
-
end
|
153
|
-
|
154
|
-
desc "install", "Run installation for the starter theme"
|
155
|
-
#
|
156
|
-
# Install and setup starter theme
|
157
|
-
#
|
158
|
-
# @return {Void}
|
159
|
-
#
|
160
|
-
def install
|
161
|
-
self.set_environment
|
162
|
-
|
163
|
-
@install.new
|
164
|
-
end
|
165
|
-
|
166
|
-
desc "watch [COMMANDS]", "Watch and compile assets"
|
167
|
-
#
|
168
|
-
# Assets
|
169
|
-
#
|
170
|
-
# @param {*} commands
|
171
|
-
# Commands to run
|
172
|
-
#
|
173
|
-
# @return {Void}
|
174
|
-
#
|
175
|
-
def watch(*commands)
|
176
|
-
self.set_environment
|
177
|
-
|
178
|
-
opts = {
|
179
|
-
:subcommand => "watch",
|
180
|
-
:commands => commands.join(" ")
|
181
|
-
}
|
182
|
-
|
183
|
-
@subcommand.new(opts)
|
184
|
-
end
|
185
|
-
|
186
|
-
desc "vendor [COMMANDS]", "Manage vendor dependencies"
|
187
|
-
#
|
188
|
-
# Vendor dependencies
|
189
|
-
#
|
190
|
-
# @param {*} commands
|
191
|
-
# Commands to run
|
192
|
-
#
|
193
|
-
# @return {Void}
|
194
|
-
#
|
195
|
-
def vendor(*commands)
|
196
|
-
self.set_environment
|
197
|
-
|
198
|
-
opts = {
|
199
|
-
:subcommand => "vendor",
|
200
|
-
:commands => commands.join(" ")
|
201
|
-
}
|
4
|
+
class CLI < Thor
|
5
|
+
|
6
|
+
def initialize(*)
|
7
|
+
super
|
8
|
+
|
9
|
+
@version = VERSION
|
10
|
+
@env = Env
|
11
|
+
@io = IO
|
12
|
+
@config = Config
|
13
|
+
@project = Project
|
14
|
+
@util = Util.new
|
15
|
+
@list = Tasks::List
|
16
|
+
@create = Commands::Create
|
17
|
+
@delete = Commands::Delete
|
18
|
+
@deploy = Commands::Deploy
|
19
|
+
@env.vm_path = options.fetch "vm_path", ENV.fetch("TJ_VM_PATH", File.expand_path("~/vagrant"))
|
20
|
+
@env.vm_ip = options.fetch "vm_ip", ENV.fetch("TJ_VM_IP", "192.168.50.4")
|
21
|
+
@env.vm_prefix = options.fetch "vm_prefix", ENV.fetch("TJ_VM_PREFIX", "tj-")
|
22
|
+
@env.yolo = options.fetch "yolo", ENV.fetch("TJ_YOLO", false)
|
23
|
+
@env.boring = options.fetch "boring", ENV.fetch("TJ_BORING", false)
|
24
|
+
@env.no_unicode = options.fetch "no_unicode", ENV.fetch("TJ_NO_UNICODE", @env.boring)
|
25
|
+
@env.no_colors = options.fetch "no_colors", ENV.fetch("TJ_NO_COLORS", @env.boring)
|
26
|
+
@env.no_animations = options.fetch "no_animations", ENV.fetch("TJ_NO_ANIMATIONS", @env.boring)
|
27
|
+
@env.no_landrush = options.fetch "no_landrush", ENV.fetch("TJ_NO_LANDRUSH", false)
|
28
|
+
@env.verbose = options.fetch "verbose", ENV.fetch("TJ_VERBOSE", false)
|
29
|
+
@env.dryrun = options.fetch "dryrun", ENV.fetch("TJ_DRYRUN", false)
|
30
|
+
end
|
202
31
|
|
203
|
-
|
204
|
-
|
32
|
+
map %w[--version -v] => :version
|
33
|
+
map %w[mk new add] => :create
|
34
|
+
map %w[up prep init make] => :setup
|
35
|
+
map %w[rm remove trash teardown] => :delete
|
36
|
+
map %w[ls projects apps sites] => :list
|
37
|
+
map %w[assets dev build] => :watch
|
38
|
+
map %w[dependencies deps] => :vendor
|
39
|
+
map %w[distrubute pack package] => :dist
|
40
|
+
map %w[wordpress] => :wp
|
41
|
+
map %w[bk] => :backup
|
42
|
+
map %w[tests spec specs] => :test
|
43
|
+
map %w[deployer server remote] => :deploy
|
44
|
+
map %w[vagrant vvv] => :vm
|
45
|
+
|
46
|
+
class_option :vm_path, :type => :string, :default => nil, :desc => "Force path to VM"
|
47
|
+
class_option :vm_ip, :type => :string, :default => nil, :desc => "Force IP address for VM"
|
48
|
+
class_option :vm_prefix, :type => :string, :default => nil, :desc => "Force directory prefix for project in VM"
|
49
|
+
class_option :yolo, :type => :boolean, :desc => "Say yes to anything and everything"
|
50
|
+
class_option :boring, :type => :boolean, :desc => "Disable all the coolness"
|
51
|
+
class_option :no_unicode, :type => :boolean, :desc => "Disable all unicode characters"
|
52
|
+
class_option :no_colors, :type => :boolean, :desc => "Disable all colored output"
|
53
|
+
class_option :no_animations, :type => :boolean, :desc => "Disable all animations"
|
54
|
+
class_option :no_landrush, :type => :boolean, :desc => "Disable landrush for DNS"
|
55
|
+
class_option :verbose, :type => :boolean, :desc => "Verbose output"
|
56
|
+
class_option :dryrun, :type => :boolean, :desc => "Disable running all commands"
|
57
|
+
|
58
|
+
desc "--version, -v", "Print current version"
|
59
|
+
#
|
60
|
+
# @return {String}
|
61
|
+
#
|
62
|
+
def version
|
63
|
+
@io.speak @version, :color => :green
|
64
|
+
end
|
205
65
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
66
|
+
desc "create", "Create new project"
|
67
|
+
method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => "Name of the project"
|
68
|
+
method_option :location, :type => :string, :aliases => "-l", :default => nil, :desc => "Location of the local project"
|
69
|
+
method_option :theme, :type => :string, :aliases => "-t", :default => nil, :desc => "Starter theme to install"
|
70
|
+
method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => "Development URL for the project"
|
71
|
+
method_option :repository, :type => :string, :aliases => "-r", :desc => "Initialize a new Git remote repository"
|
72
|
+
method_option :db_import, :type => :string, :aliases => %w[--import-db -i], :desc => "Import an existing database"
|
73
|
+
method_option :bare, :type => :boolean, :desc => "Create a project without a starter theme"
|
74
|
+
method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use default settings"
|
75
|
+
method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use default settings"
|
76
|
+
method_option :use_defaults, :type => :boolean, :desc => "Skip all prompts and use default settings"
|
77
|
+
method_option :no_wp, :type => :boolean, :desc => "New project is not a WordPress install"
|
78
|
+
method_option :no_db, :type => :boolean, :desc => "New project does not need a database"
|
79
|
+
#
|
80
|
+
# @return {Void}
|
81
|
+
#
|
82
|
+
def create
|
83
|
+
@io.hello
|
84
|
+
@create.new(options).execute
|
85
|
+
end
|
217
86
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
87
|
+
desc "setup", "Setup existing project"
|
88
|
+
method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => "Name of the project"
|
89
|
+
method_option :location, :type => :string, :aliases => "-l", :default => nil, :desc => "Location of the local project"
|
90
|
+
method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => "Development URL for the project"
|
91
|
+
method_option :repository, :type => :string, :aliases => "-r", :desc => "Initialize a new Git remote repository"
|
92
|
+
method_option :import_db, :type => :string, :aliases => "-i", :desc => "Import an existing database"
|
93
|
+
method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use default settings"
|
94
|
+
method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use default settings"
|
95
|
+
method_option :use_defaults, :type => :boolean, :desc => "Skip all prompts and use default settings"
|
96
|
+
method_option :no_wp, :type => :boolean, :desc => "New project is not a WordPress install"
|
97
|
+
method_option :no_db, :type => :boolean, :desc => "New project does not need a database"
|
98
|
+
#
|
99
|
+
# @return {Void}
|
100
|
+
#
|
101
|
+
def setup
|
102
|
+
@io.hello
|
103
|
+
@create.new(options.dup.merge({
|
104
|
+
:theme => false,
|
105
|
+
:bare => true,
|
106
|
+
})).execute
|
107
|
+
end
|
222
108
|
|
223
|
-
|
224
|
-
|
109
|
+
desc "delete", "Delete project (does not delete local project)"
|
110
|
+
method_option :name, :type => :string, :aliases => "-n", :default => nil, :desc => "Name of the development project"
|
111
|
+
method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => "Development URL for the project"
|
112
|
+
method_option :db_drop, :type => :boolean, :aliases => "--drop-db", :desc => "Drop project's database"
|
113
|
+
method_option :vm_restart, :type => :boolean, :aliases => "--restart-vm", :desc => "Restart VM after deletion"
|
114
|
+
#
|
115
|
+
# @return {Void}
|
116
|
+
#
|
117
|
+
def delete
|
118
|
+
@delete.new(options).unexecute
|
119
|
+
end
|
225
120
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
# @return {Void}
|
234
|
-
#
|
235
|
-
def vm(*commands)
|
236
|
-
self.set_environment
|
121
|
+
desc "deploy", "Manage deployment and migration"
|
122
|
+
#
|
123
|
+
# @return {Void}
|
124
|
+
#
|
125
|
+
def deploy
|
126
|
+
@deploy.new(options).execute
|
127
|
+
end
|
237
128
|
|
238
|
-
|
239
|
-
|
129
|
+
desc "list", "List all projects"
|
130
|
+
#
|
131
|
+
# @return {Void}
|
132
|
+
#
|
133
|
+
def list
|
134
|
+
@list.new(options).list :projects
|
135
|
+
end
|
240
136
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
137
|
+
desc "install", "Run installation for project"
|
138
|
+
#
|
139
|
+
# @return {Void}
|
140
|
+
#
|
141
|
+
def install
|
142
|
+
@config.install
|
143
|
+
end
|
245
144
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
@environment = ::ThemeJuice::Environment
|
254
|
-
@interaction = ::ThemeJuice::Interaction
|
255
|
-
@create = ::ThemeJuice::Command::Create
|
256
|
-
@delete = ::ThemeJuice::Command::Delete
|
257
|
-
@list = ::ThemeJuice::Command::List
|
258
|
-
@install = ::ThemeJuice::Command::Install
|
259
|
-
@subcommand = ::ThemeJuice::Command::Subcommand
|
145
|
+
desc "update", "Update tj and its dependencies"
|
146
|
+
#
|
147
|
+
# @return {Void}
|
148
|
+
#
|
149
|
+
def update
|
150
|
+
@io.error "Not implemented"
|
151
|
+
end
|
260
152
|
|
261
|
-
|
153
|
+
desc "watch [COMMANDS]", "Watch and compile assets"
|
154
|
+
#
|
155
|
+
# @return {Void}
|
156
|
+
#
|
157
|
+
def watch(*commands)
|
158
|
+
@config.watch *commands
|
159
|
+
end
|
262
160
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
161
|
+
desc "vendor [COMMANDS]", "Manage vendor dependencies"
|
162
|
+
#
|
163
|
+
# @return {Void}
|
164
|
+
#
|
165
|
+
def vendor(*commands)
|
166
|
+
@config.vendor *commands
|
167
|
+
end
|
269
168
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
169
|
+
desc "dist [COMMANDS]", "Package project for distribution"
|
170
|
+
#
|
171
|
+
# @return {Void}
|
172
|
+
#
|
173
|
+
def dist(*commands)
|
174
|
+
@config.dist *commands
|
175
|
+
end
|
276
176
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
# false
|
285
|
-
# else
|
286
|
-
# begin
|
287
|
-
# require "theme-juice-deploy"
|
288
|
-
# true
|
289
|
-
# rescue LoadError
|
290
|
-
# false
|
291
|
-
# end
|
292
|
-
# end
|
293
|
-
# end
|
177
|
+
desc "wp [COMMANDS]", "Manage WordPress installation"
|
178
|
+
#
|
179
|
+
# @return {Void}
|
180
|
+
#
|
181
|
+
def wp(*commands)
|
182
|
+
@config.wp *commands
|
183
|
+
end
|
294
184
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
@environment.vvv_path = File.expand_path("~/vagrant")
|
303
|
-
else
|
304
|
-
@environment.vvv_path = options[:vvv_path]
|
305
|
-
@interaction.notice "You're using a custom VVV path : (#{@environment.vvv_path})"
|
185
|
+
desc "backup [COMMANDS]", "Backup project"
|
186
|
+
#
|
187
|
+
# @return {Void}
|
188
|
+
#
|
189
|
+
def backup(*commands)
|
190
|
+
@config.backup *commands
|
191
|
+
end
|
306
192
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
193
|
+
desc "test [COMMANDS]", "Manage and run project tests"
|
194
|
+
#
|
195
|
+
# @return {Void}
|
196
|
+
#
|
197
|
+
def test(*commands)
|
198
|
+
@config.test *commands
|
199
|
+
end
|
311
200
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
201
|
+
desc "vm [COMMANDS]", "Manage development environment"
|
202
|
+
#
|
203
|
+
# @return {Void}
|
204
|
+
#
|
205
|
+
def vm(*commands)
|
206
|
+
@util.inside @env.vm_path do
|
207
|
+
@util.run "vagrant #{commands.join(" ")}", :verbose => @env.verbose
|
208
|
+
end
|
317
209
|
end
|
210
|
+
end
|
318
211
|
end
|