theme-juice 0.8.3 → 0.9.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 +141 -35
- data/lib/theme-juice.rb +3 -3
- data/lib/theme-juice/cli.rb +35 -31
- data/lib/theme-juice/commands/create.rb +28 -15
- data/lib/theme-juice/commands/delete.rb +13 -6
- data/lib/theme-juice/env.rb +13 -3
- data/lib/theme-juice/io.rb +82 -85
- data/lib/theme-juice/man/tj +154 -102
- data/lib/theme-juice/man/tj-create +13 -49
- data/lib/theme-juice/man/tj-create.txt +17 -29
- data/lib/theme-juice/man/tj-delete +5 -17
- data/lib/theme-juice/man/tj-delete.txt +6 -10
- data/lib/theme-juice/man/tj-deploy +13 -0
- data/lib/theme-juice/man/tj-deploy.txt +16 -0
- data/lib/theme-juice/man/tj-setup +10 -40
- data/lib/theme-juice/man/tj-setup.txt +10 -20
- data/lib/theme-juice/man/tj.txt +136 -53
- data/lib/theme-juice/project.rb +1 -0
- data/lib/theme-juice/tasks/apache.rb +50 -0
- data/lib/theme-juice/tasks/create_confirm.rb +9 -0
- data/lib/theme-juice/tasks/delete_confirm.rb +8 -0
- data/lib/theme-juice/tasks/forward_ports.rb +54 -0
- data/lib/theme-juice/tasks/list.rb +1 -1
- data/lib/theme-juice/tasks/nginx.rb +11 -10
- data/lib/theme-juice/tasks/{vm.rb → vm_box.rb} +1 -1
- data/lib/theme-juice/tasks/vm_provision.rb +1 -1
- data/lib/theme-juice/version.rb +1 -1
- metadata +21 -46
- data/lib/theme-juice/patches/option.rb +0 -34
- data/lib/theme-juice/tasks/hosts.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acf36f2a3870a2e63c713285fb91c7da4e9d2393
|
4
|
+
data.tar.gz: 194ed25293316904e6ac46137c044204fc904dd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b4bd5e07b172eb92e28d4a27c90c6855381e4ee5d3d37e1d6c9eb7e196bbf9d7e7afeb2373768016ca3f4c8bf80ba5054943a5f59cf0d0f7a3ccc120cf25384
|
7
|
+
data.tar.gz: 241be55eb0c498e64e49670404b0c96fb3700f294c00fcc9ff71568224eff6cbee2a119d397a1d61057b474e6cf5641c61a1b48485e5987763e2f95e4bb16809
|
data/README.md
CHANGED
@@ -1,36 +1,133 @@
|
|
1
|
-
# Theme Juice
|
2
|
-
[![Gem Version](http://img.shields.io/gem/v/theme-juice.svg)](https://rubygems.org/gems/theme-juice)
|
3
|
-
[![Travis](https://img.shields.io/travis/ezekg/theme-juice-cli.svg?style=flat-square)]()
|
4
|
-
[![Code Climate](https://img.shields.io/codeclimate/github/ezekg/theme-juice-cli.svg?style=flat-square)]()
|
5
|
-
[![Code Climate](https://img.shields.io/codeclimate/coverage/github/ezekg/theme-juice-cli.svg?style=flat-square)]()
|
1
|
+
# Theme Juice CLI
|
2
|
+
[![Gem Version](http://img.shields.io/gem/v/theme-juice.svg?style=flat-square)](https://rubygems.org/gems/theme-juice)
|
3
|
+
[![Travis](https://img.shields.io/travis/ezekg/theme-juice-cli.svg?style=flat-square)](https://travis-ci.org/ezekg/theme-juice-cli)
|
4
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/ezekg/theme-juice-cli.svg?style=flat-square)](https://codeclimate.com/github/ezekg/theme-juice-cli)
|
5
|
+
[![Code Climate](https://img.shields.io/codeclimate/coverage/github/ezekg/theme-juice-cli.svg?style=flat-square)](https://codeclimate.com/github/ezekg/theme-juice-cli)
|
6
6
|
[![GitHub license](https://img.shields.io/github/license/ezekg/theme-juice-cli.svg?style=flat-square)](https://github.com/ezekg/theme-juice-cli/blob/master/LICENSE)
|
7
7
|
|
8
|
-
_This project is currently under active development and will not be completely 'stable' per-say until we hit `1.0`. Everything here is subject to change without notice
|
8
|
+
_This project is currently under active development and will not be completely 'stable' per-say until we hit `1.0`. Everything here is subject to change without notice. (We will of course semantically version all of our releases, with the minor version being incremented with new features/breaking changes.) Feel free to contribute to the development with new features, ideas or bug fixes._
|
9
|
+
|
10
|
+
[View our contributing guidelines to get started!](#contributing)
|
9
11
|
|
10
12
|
## What is it?
|
11
|
-
Theme Juice is a WordPress development command line utility that allows you to scaffold out entire Vagrant development
|
13
|
+
**Theme Juice** is a WordPress development command line utility that allows you to scaffold out an entire Vagrant development environment in seconds (using an Apache fork of [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV) called [VVV-Apache](https://github.com/ericmann/vvv-apache.git) as the VM). It also helps you manage dependencies and build tools, and can even handle your deployments.
|
14
|
+
|
15
|
+
## Requirements
|
16
|
+
**`tj` requires [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) to be able to create virtual machines for local development. Please download and install both of these before getting started.**
|
17
|
+
|
18
|
+
I recommend one of the latest versions of Ruby MRI (2.2, 2.1, 2.0). `tj` requires at least MRI 1.9.3. For the full report, check out the [Travis CI build status](https://travis-ci.org/ezekg/theme-juice-cli), where I test against an array of Ruby interpreters.
|
12
19
|
|
13
20
|
## Installation
|
14
|
-
|
15
|
-
|
16
|
-
|
21
|
+
```
|
22
|
+
gem install theme-juice
|
23
|
+
```
|
24
|
+
|
25
|
+
## Getting Started
|
26
|
+
|
27
|
+
#### Create a new project
|
28
|
+
This will lead you through a series of prompts to set up required project information, such as name, location, theme, database info, etc. Using the specified information, it will run the installation process and set up a local development environment, if it hasn't already been set up. It will sync your local project location with the project
|
29
|
+
location within the VM, so you can run this from anywhere on your local system.
|
30
|
+
|
31
|
+
```
|
32
|
+
tj create
|
33
|
+
```
|
34
|
+
|
35
|
+
#### Set up an existing project
|
36
|
+
This sets up an existing local project within the development environment. You will go through a series of prompts to create the necessary files. This command is essentially an alias for `tj create --bare`.
|
17
37
|
|
18
|
-
|
19
|
-
|
38
|
+
```
|
39
|
+
tj setup
|
40
|
+
```
|
41
|
+
|
42
|
+
#### Removing a project
|
43
|
+
This will remove a project from your development environment. This will only remove files that were generated by `tj` i.e. the database setup, DNS setup, and the project's shared directories.
|
20
44
|
|
21
|
-
|
45
|
+
It will not touch your local folders that were synced to the VM.
|
46
|
+
|
47
|
+
```
|
48
|
+
tj delete
|
49
|
+
```
|
50
|
+
|
51
|
+
#### Want More?
|
52
|
+
Want to check out all of the various flags and features `tj` offers? Just ask `tj` for help, and you'll be greeted with a nice `man` page full of information about how to use just about everything.
|
53
|
+
|
54
|
+
```
|
55
|
+
tj help
|
56
|
+
```
|
57
|
+
|
58
|
+
Or, check out [themejuice.it](http://themejuice.it) for a pretty website chock-full of documentation.
|
59
|
+
|
60
|
+
## FAQ
|
61
|
+
|
62
|
+
1. [Is Windows Supported?](#is-windows-supported)
|
63
|
+
1. [Can I use the original VVV instead of VVV-Apache?](#can-i-use-the-original-vvv-instead-of-vvv-apache)
|
64
|
+
1. [So, does that mean I can use any Vagrant box?](#so-does-that-mean-i-can-use-any-vagrant-box)
|
65
|
+
1. [What is a `Customfile`?](#what-is-a-customfile)
|
66
|
+
1. [What is a `Juicefile`?](#what-is-a-juicefile)
|
67
|
+
1. [Does `tj` handle deployments?](#does-tj-handle-deployments)
|
68
|
+
1. [Can I access a project from another device (i.e. mobile)?](#can-i-access-a-project-from-another-device-ie-mobile)
|
69
|
+
1. [Help! It won't let me `git clone` anything!](#help-it-wont-let-me-git-clone-anything)
|
70
|
+
1. [Can I add my starter theme, ________?](#can-i-add-my-starter-theme-________)
|
71
|
+
|
72
|
+
#### Is Windows supported?
|
73
|
+
Yes! But, since Windows doesn't support UTF-8 characters inside of the terminal, and is picky about ASCII colors, you'll probably have to run `tj` with a couple flags.
|
74
|
+
|
75
|
+
Something that has worked for me on one of my Windows machines is to run all commands through [git-scm](http://git-scm.com/downloads) with the `--boring --no-landrush` flags. This will disable all unicode characters and colors from being output, and will also disable [Landrush](https://github.com/phinze/landrush), which isn't fully supported on Windows.
|
76
|
+
|
77
|
+
To set these globally via the `ENV`, set the following environment variables or run the commands below in your terminal:
|
22
78
|
|
23
79
|
```bash
|
24
80
|
export TJ_BORING=true
|
25
81
|
export TJ_NO_LANDRUSH=true
|
26
82
|
```
|
27
83
|
|
28
|
-
In addition to that, `tj` uses the [OS gem](https://github.com/rdp/os) to sniff out your OS and
|
84
|
+
In addition to that, `tj` uses the [OS gem](https://github.com/rdp/os) to sniff out your OS and it'll adjust a few things accordingly to make sure that nothing breaks.
|
85
|
+
|
86
|
+
_I don't regularly develop on Windows, so if you encounter any bugs, please let me know through a **well-documented** issue and I'll try my best to get it resolved._
|
87
|
+
|
88
|
+
#### Can I use the original VVV instead of VVV-Apache?
|
89
|
+
Definitely. If you want to use `tj` with Nginx and the [original VVV](https://github.com/Varying-Vagrant-Vagrants/VVV), it's as simple as running `tj` with a few flags:
|
90
|
+
|
91
|
+
```bash
|
92
|
+
tj new --vm-box git@github.com:Varying-Vagrant-Vagrants/VVV.git --nginx
|
93
|
+
```
|
29
94
|
|
30
|
-
|
31
|
-
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.
|
95
|
+
To use these permanently, set the appropriate `ENV` variables through your `.bashrc` or similar, i.e. `export TJ_VM_BOX=git@github.com:Varying-Vagrant-Vagrants/VVV.git` and `export TJ_NGINX=true`.
|
32
96
|
|
33
|
-
|
97
|
+
_Note: Before running this, you might want to either choose a new `vm-path`, or destroy any existing VMs inside of your `~/vagrant` directory. If `tj` detects a VM already installed, it will skip installing the new box._
|
98
|
+
|
99
|
+
#### So, does that mean I can use any Vagrant box?
|
100
|
+
Yes and no; in order for `tj` to properly create a project, the Vagrant box needs to follow the same directory structure as VVV, and include a `Customfile`. Here is the required structure that `tj` needs in order to be able to create new projects:
|
101
|
+
|
102
|
+
```
|
103
|
+
├── config/
|
104
|
+
| |
|
105
|
+
| ├── {apache,nginx}-config/
|
106
|
+
| | |
|
107
|
+
| | ├── site-1.conf
|
108
|
+
| | ├── site-2.conf
|
109
|
+
| | ..
|
110
|
+
| ..
|
111
|
+
├── www/
|
112
|
+
| |
|
113
|
+
| ├── site-1/
|
114
|
+
| | |
|
115
|
+
| | ├── index.php
|
116
|
+
| | ..
|
117
|
+
| ├── site-2/
|
118
|
+
| | |
|
119
|
+
| | ├── index.php
|
120
|
+
| | ..
|
121
|
+
| ..
|
122
|
+
├── Customfile
|
123
|
+
...
|
124
|
+
```
|
125
|
+
|
126
|
+
#### What is a `Customfile`?
|
127
|
+
[It's a file that contains custom rules to add into the main `Vagrantfile`, without actually having to modify it](https://github.com/Varying-Vagrant-Vagrants/VVV/blob/develop/Vagrantfile#L208-L218). This allows us to easily modify the Vagrant box without causing merge conflicts if you were to update the VM source via `git pull`.
|
128
|
+
|
129
|
+
#### What is a `Juicefile`?
|
130
|
+
A YAML configuration file (`Juicefile`) can be used to store commonly-used build scripts. Each command block sequence can be mapped to an individual project's build tool, allowing a streamlined set of commands to be used across multiple projects that utilize different tools. In the near-future, this will also house your deployment configuration.
|
34
131
|
|
35
132
|
Below is the config that comes baked into [our starter theme](https://github.com/ezekg/theme-juice-starter):
|
36
133
|
|
@@ -54,7 +151,7 @@ commands:
|
|
54
151
|
- tar -zcvf dist.tar.gz .
|
55
152
|
```
|
56
153
|
|
57
|
-
Each
|
154
|
+
Each command sequence is run within a single execution, with all `%args%`/`%argN%` being replaced by the passed command. Here's a few example scenarios:
|
58
155
|
```bash
|
59
156
|
# Will contain all arguments stitched together by a space
|
60
157
|
cmd1 %args%
|
@@ -64,28 +161,37 @@ cmd2 '%arg1% %arg2% %arg3%'
|
|
64
161
|
cmd3 "%arg4%"
|
65
162
|
```
|
66
163
|
|
67
|
-
You can specify an unlimited number of commands with an unlimited number of arguments; however, should be careful with how this is used. Don't
|
164
|
+
You can specify an unlimited number of commands with an unlimited number of arguments; however, you should be careful with how this is used. Don't go including `sudo rm -rf %arg1%` in a command, while passing `/` 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.
|
165
|
+
|
166
|
+
#### Does `tj` handle deployments?
|
167
|
+
Eventually, yes. It's not currently production-ready, but as soon as it is, we'll have detailed instructions on how to configure and deploy applications using `tj`. Right now, I'm leaning towards integrating an automated Capistrano workflow, but am open to other options. [Have an idea and want to contribute?](#contributing)
|
168
|
+
|
169
|
+
#### Can I access a project from another device (i.e. mobile)?
|
170
|
+
Yes! Every project created with `tj` will automatically be set up to support using [xip.io](http://xip.io/). If you're using OSX, then everything should work out of the box. If you're not using OSX, then you'll need to point port `80` on your host machine to `8080`; Vagrant cannot do this by default for security reasons.
|
68
171
|
|
69
|
-
|
172
|
+
Once everything is good to go, you can access a project from another device on the same network by going to `<project-name>.<your-hosts-ip-address>.xip.io` e.g. `themejuice.192.168.1.1.xip.io`.
|
70
173
|
|
71
|
-
|
174
|
+
#### Help! It won't let me `git clone` anything!
|
175
|
+
You most likely don't have [SSH-keys for GitHub set up correctly (if even at all)](https://help.github.com/articles/error-permission-denied-publickey/). Either set that up, or manually run `tj` with the appropriate flags corresponding to the problem-repository, swapping out `git@github.com:` for `https://github.com/`:
|
72
176
|
|
73
177
|
```
|
74
|
-
tj
|
75
|
-
tj -h
|
76
|
-
tj help
|
77
|
-
tj --help
|
178
|
+
tj create --theme https://github.com/theme/repository.git --vm-box https://github.com/vm-box/repository.git
|
78
179
|
```
|
79
180
|
|
80
|
-
|
81
|
-
|
82
|
-
## Can I add my starter theme, ________?
|
83
|
-
Yes! Just update the `THEMES` constant inside [commands/create.rb](https://github.com/ezekg/theme-juice-cli/blob/master/lib/theme-juice/commands/create.rb#L7-L11) and make a pull request. I'll verify that the theme includes a `Juicefile` (not required, but preferred to automate build steps), and that everything looks solid. Until then (or if your theme is private), just run `tj create --theme https://your.repo/link/goes.here` to clone your theme.
|
181
|
+
#### Can I add my starter theme, ________?
|
182
|
+
Yes! Just update the `THEMES` constant inside [commands/create.rb](https://github.com/ezekg/theme-juice-cli/blob/master/lib/theme-juice/commands/create.rb#L7-L12) and make a pull request. I'll verify that the theme includes a `Juicefile` (not required, but preferred to automate build steps), and that everything looks solid. Until then (or if your theme is private), just run `tj create --theme https://your.repo/link/goes.here` to clone your theme.
|
84
183
|
|
85
184
|
## Contributing
|
86
|
-
1. First, create a _well documented_ [issue](https://github.com/ezekg/theme-juice-cli/issues) for your proposed feature/bug fix
|
87
|
-
1. [
|
88
|
-
1. Create a new feature branch
|
89
|
-
1.
|
90
|
-
1.
|
91
|
-
1.
|
185
|
+
1. First, create a _well documented_ [issue](https://github.com/ezekg/theme-juice-cli/issues) for your proposed feature/bug fix
|
186
|
+
1. After getting approval for the new feature, [fork the repository](https://github.com/ezekg/theme-juice-cli/fork)
|
187
|
+
1. Create a new feature branch (`git checkout -b my-new-feature`)
|
188
|
+
1. Write tests before pushing your changes, then run Rspec (`rake`)
|
189
|
+
1. Commit your changes (`git commit -am 'add some feature'`)
|
190
|
+
1. Push to the new branch (`git push origin my-new-feature`)
|
191
|
+
1. Create a new Pull Request
|
192
|
+
|
193
|
+
## License
|
194
|
+
Please see [LICENSE](https://github.com/ezekg/theme-juice-cli/blob/master/LICENSE) for licensing details.
|
195
|
+
|
196
|
+
## Author
|
197
|
+
Ezekiel Gabrielse, [@ezekkkg](https://twitter.com/ezekkkg), [http://ezekielg.com](http://ezekielg.com)
|
data/lib/theme-juice.rb
CHANGED
@@ -9,7 +9,6 @@ module ThemeJuice
|
|
9
9
|
end
|
10
10
|
|
11
11
|
require "theme-juice/version"
|
12
|
-
require "theme-juice/patches/option"
|
13
12
|
require "theme-juice/helpers/singleton_helper"
|
14
13
|
require "theme-juice/env"
|
15
14
|
require "theme-juice/project"
|
@@ -18,15 +17,16 @@ require "theme-juice/io"
|
|
18
17
|
require "theme-juice/config"
|
19
18
|
require "theme-juice/task"
|
20
19
|
require "theme-juice/tasks/entry"
|
21
|
-
require "theme-juice/tasks/
|
20
|
+
require "theme-juice/tasks/vm_box"
|
22
21
|
require "theme-juice/tasks/create_confirm"
|
23
22
|
require "theme-juice/tasks/delete_confirm"
|
24
23
|
require "theme-juice/tasks/location"
|
25
24
|
require "theme-juice/tasks/theme"
|
26
25
|
require "theme-juice/tasks/repo"
|
27
26
|
require "theme-juice/tasks/dot_env"
|
28
|
-
require "theme-juice/tasks/
|
27
|
+
require "theme-juice/tasks/forward_ports"
|
29
28
|
require "theme-juice/tasks/nginx"
|
29
|
+
require "theme-juice/tasks/apache"
|
30
30
|
require "theme-juice/tasks/vm_plugins"
|
31
31
|
require "theme-juice/tasks/vm_location"
|
32
32
|
require "theme-juice/tasks/vm_customfile"
|
data/lib/theme-juice/cli.rb
CHANGED
@@ -22,22 +22,24 @@ module ThemeJuice
|
|
22
22
|
|
23
23
|
no_commands do
|
24
24
|
def init_env
|
25
|
-
@env.vm_box
|
26
|
-
@env.vm_path
|
27
|
-
@env.vm_ip
|
28
|
-
@env.vm_prefix
|
29
|
-
@env.yolo
|
30
|
-
@env.boring
|
31
|
-
@env.no_unicode
|
32
|
-
@env.no_colors
|
33
|
-
@env.no_animations
|
34
|
-
@env.no_landrush
|
35
|
-
@env.
|
36
|
-
@env.
|
25
|
+
@env.vm_box = options[:vm_box]
|
26
|
+
@env.vm_path = options[:vm_path]
|
27
|
+
@env.vm_ip = options[:vm_ip]
|
28
|
+
@env.vm_prefix = options[:vm_prefix]
|
29
|
+
@env.yolo = options[:yolo]
|
30
|
+
@env.boring = options[:boring]
|
31
|
+
@env.no_unicode = options[:no_unicode]
|
32
|
+
@env.no_colors = options[:no_colors]
|
33
|
+
@env.no_animations = options[:no_animations]
|
34
|
+
@env.no_landrush = options[:no_landrush]
|
35
|
+
@env.no_port_forward = options[:no_port_forward]
|
36
|
+
@env.verbose = options[:verbose]
|
37
|
+
@env.dryrun = options[:dryrun]
|
38
|
+
@env.nginx = options[:nginx]
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
|
-
map %w[man
|
42
|
+
map %w[man doc docs] => :help
|
41
43
|
map %w[--version -v] => :version
|
42
44
|
map %w[mk new] => :create
|
43
45
|
map %w[up init] => :setup
|
@@ -52,19 +54,21 @@ module ThemeJuice
|
|
52
54
|
map %w[tests spec specs] => :test
|
53
55
|
map %w[server remote] => :deploy
|
54
56
|
map %w[vagrant vvv] => :vm
|
55
|
-
|
56
|
-
class_option :vm_box,
|
57
|
-
class_option :vm_path,
|
58
|
-
class_option :vm_ip,
|
59
|
-
class_option :vm_prefix,
|
60
|
-
class_option :yolo,
|
61
|
-
class_option :boring,
|
62
|
-
class_option :no_unicode,
|
63
|
-
class_option :no_colors,
|
64
|
-
class_option :no_animations,
|
65
|
-
class_option :no_landrush,
|
66
|
-
class_option :
|
67
|
-
class_option :
|
57
|
+
|
58
|
+
class_option :vm_box, :type => :string, :default => nil, :desc => "Force Vagrant box for use as VM"
|
59
|
+
class_option :vm_path, :type => :string, :default => nil, :desc => "Force path to VM"
|
60
|
+
class_option :vm_ip, :type => :string, :default => nil, :desc => "Force IP address of VM"
|
61
|
+
class_option :vm_prefix, :type => :string, :default => nil, :desc => "Force directory prefix for project in VM"
|
62
|
+
class_option :yolo, :type => :boolean, :desc => "Say yes to anything and everything (try it)"
|
63
|
+
class_option :boring, :type => :boolean, :desc => "Prints all output without anything fancy"
|
64
|
+
class_option :no_unicode, :type => :boolean, :desc => "Prints all output without unicode characters"
|
65
|
+
class_option :no_colors, :type => :boolean, :aliases => "--no-color", :desc => "Prints all output without color"
|
66
|
+
class_option :no_animations, :type => :boolean, :desc => "Prints all output without animations"
|
67
|
+
class_option :no_landrush, :type => :boolean, :desc => "Disable landrush for DNS"
|
68
|
+
class_option :no_port_forward, :type => :boolean, :aliases => "--no-port-forwarding", :desc => "Disable automatic port forwarding"
|
69
|
+
class_option :verbose, :type => :boolean, :desc => "Prints out additional logging information"
|
70
|
+
class_option :dryrun, :type => :boolean, :aliases => "--dry-run", :desc => "Run a command without actually executing anything"
|
71
|
+
class_option :nginx, :type => :boolean, :aliases => "--no-apache", :desc => "Create conf files for nginx instead of apache"
|
68
72
|
|
69
73
|
desc "--help, -h", "View man page"
|
70
74
|
def help(command = nil)
|
@@ -73,12 +77,12 @@ module ThemeJuice
|
|
73
77
|
begin
|
74
78
|
if File.exist? "#{root}/#{man}"
|
75
79
|
if OS.windows?
|
76
|
-
@io.
|
80
|
+
@io.say File.read "#{root}/#{man}.txt", :color => :white
|
77
81
|
else
|
78
82
|
@util.run "man #{root}/#{man}", :verbose => @env.verbose
|
79
83
|
end
|
80
84
|
else
|
81
|
-
@io.
|
85
|
+
@io.say "No man page available for '#{command}'", :color => :red
|
82
86
|
end
|
83
87
|
rescue
|
84
88
|
super
|
@@ -87,7 +91,7 @@ module ThemeJuice
|
|
87
91
|
|
88
92
|
desc "--version, -v", "Print current version"
|
89
93
|
def version
|
90
|
-
@io.
|
94
|
+
@io.say @version, :color => :green
|
91
95
|
end
|
92
96
|
|
93
97
|
desc "create", "Create new project"
|
@@ -133,7 +137,7 @@ module ThemeJuice
|
|
133
137
|
@delete.new(options).unexecute
|
134
138
|
end
|
135
139
|
|
136
|
-
desc "deploy", "
|
140
|
+
desc "deploy", "Deploy a project"
|
137
141
|
def deploy
|
138
142
|
@deploy.new(options).execute
|
139
143
|
end
|
@@ -148,7 +152,7 @@ module ThemeJuice
|
|
148
152
|
@io.error "Not implemented"
|
149
153
|
end
|
150
154
|
|
151
|
-
desc "install", "Run installation
|
155
|
+
desc "install", "Run theme installation"
|
152
156
|
def install(*commands)
|
153
157
|
@config.install commands
|
154
158
|
end
|
@@ -5,8 +5,8 @@ module ThemeJuice
|
|
5
5
|
class Create < Command
|
6
6
|
|
7
7
|
THEMES = {
|
8
|
-
"theme-juice/trellis" => "
|
9
|
-
"wordpress/wordpress" => "
|
8
|
+
"theme-juice/trellis" => "git@github.com:ezekg/theme-juice-starter.git",
|
9
|
+
"wordpress/wordpress" => "git@github.com:WordPress/WordPress.git",
|
10
10
|
"other (specify)" => nil,
|
11
11
|
"none" => false
|
12
12
|
}
|
@@ -20,15 +20,19 @@ module ThemeJuice
|
|
20
20
|
tasks << Tasks::CreateConfirm.new
|
21
21
|
tasks << Tasks::Location.new
|
22
22
|
tasks << Tasks::Theme.new
|
23
|
-
tasks << Tasks::
|
23
|
+
tasks << Tasks::VMBox.new
|
24
24
|
tasks << Tasks::VMPlugins.new
|
25
25
|
tasks << Tasks::VMLocation.new
|
26
26
|
tasks << Tasks::VMCustomfile.new
|
27
|
-
tasks << Tasks::Hosts.new
|
28
27
|
tasks << Tasks::Database.new
|
29
|
-
|
28
|
+
if @env.nginx
|
29
|
+
tasks << Tasks::Nginx.new
|
30
|
+
else
|
31
|
+
tasks << Tasks::Apache.new
|
32
|
+
end
|
30
33
|
tasks << Tasks::DotEnv.new
|
31
34
|
tasks << Tasks::Landrush.new
|
35
|
+
tasks << Tasks::ForwardPorts.new
|
32
36
|
tasks << Tasks::SyncedFolder.new
|
33
37
|
tasks << Tasks::DNS.new
|
34
38
|
tasks << Tasks::WPCLI.new
|
@@ -51,6 +55,7 @@ module ThemeJuice
|
|
51
55
|
@project.name = @opts.fetch("name") { name }
|
52
56
|
@project.location = @opts.fetch("location") { location }
|
53
57
|
@project.url = @opts.fetch("url") { url }
|
58
|
+
@project.xip = @opts.fetch("xip") { xip }
|
54
59
|
@project.theme = @opts.fetch("theme") { theme }
|
55
60
|
@project.repository = @opts.fetch("repository") { repository }
|
56
61
|
@project.db_host = @opts.fetch("db_host") { db_host }
|
@@ -64,7 +69,7 @@ module ThemeJuice
|
|
64
69
|
if @env.yolo
|
65
70
|
name = Faker::Internet.domain_word
|
66
71
|
else
|
67
|
-
name = @io.
|
72
|
+
name = @io.ask "What's the project name? (letters, numbers and dashes only)"
|
68
73
|
end
|
69
74
|
|
70
75
|
valid_name? name
|
@@ -94,7 +99,7 @@ module ThemeJuice
|
|
94
99
|
if @project.use_defaults
|
95
100
|
location = File.expand_path path + @project.name
|
96
101
|
else
|
97
|
-
location = File.expand_path @io.
|
102
|
+
location = File.expand_path @io.ask("Where do you want to setup the project?", :default => path, :path => true)
|
98
103
|
end
|
99
104
|
|
100
105
|
location
|
@@ -104,7 +109,7 @@ module ThemeJuice
|
|
104
109
|
if @project.use_defaults
|
105
110
|
url = "#{@project.name}.dev"
|
106
111
|
else
|
107
|
-
url = @io.
|
112
|
+
url = @io.ask "What do you want the development url to be? (this should end in '.dev')", :default => "#{@project.name}.dev"
|
108
113
|
end
|
109
114
|
|
110
115
|
valid_url? url
|
@@ -120,6 +125,12 @@ module ThemeJuice
|
|
120
125
|
true
|
121
126
|
end
|
122
127
|
|
128
|
+
def xip
|
129
|
+
xip = @project.url.gsub /\.dev$/, ""
|
130
|
+
|
131
|
+
xip
|
132
|
+
end
|
133
|
+
|
123
134
|
def theme
|
124
135
|
return false if @project.bare
|
125
136
|
|
@@ -130,14 +141,16 @@ module ThemeJuice
|
|
130
141
|
|
131
142
|
case choice
|
132
143
|
when /(theme-juice)/
|
133
|
-
@io.
|
144
|
+
@io.say "Awesome choice!", :color => :green, :icon => :success
|
134
145
|
when /(wordpress)/
|
135
|
-
@io.
|
146
|
+
@io.say "This is a stock WordPress install, so things such as the '.env' file will not be set up. You'll need to input your database information manually after the setup.", {
|
147
|
+
:color => :yellow, :icon => :notice }
|
136
148
|
when /(other)/
|
137
|
-
THEMES[choice] = @io.
|
149
|
+
THEMES[choice] = @io.ask "What is the repository URL for the starter theme that you would like to clone?"
|
138
150
|
when /(none)/
|
139
|
-
@io.notice "Next time you need to create a project without a starter theme, you can just run the 'setup' command instead."
|
140
151
|
@project.bare = true
|
152
|
+
@io.say "Next time you need to create a project without a starter theme, you can just run the 'setup' command instead.", {
|
153
|
+
:color => :yellow, :icon => :notice }
|
141
154
|
end
|
142
155
|
|
143
156
|
theme = THEMES[choice]
|
@@ -150,7 +163,7 @@ module ThemeJuice
|
|
150
163
|
return false if @project.skip_repo || @project.use_defaults
|
151
164
|
|
152
165
|
if @io.agree? "Would you like to initialize a new Git repository?"
|
153
|
-
repo = @io.
|
166
|
+
repo = @io.ask "What is the repository URL?", :indent => 2
|
154
167
|
else
|
155
168
|
repo = false
|
156
169
|
end
|
@@ -172,7 +185,7 @@ module ThemeJuice
|
|
172
185
|
if @project.skip_db || @project.use_defaults
|
173
186
|
res = default
|
174
187
|
else
|
175
|
-
res = @io.
|
188
|
+
res = @io.ask "Database #{task}", :default => default
|
176
189
|
end
|
177
190
|
|
178
191
|
res
|
@@ -183,7 +196,7 @@ module ThemeJuice
|
|
183
196
|
return false if @project.no_db || @project.no_wp || @project.use_defaults
|
184
197
|
|
185
198
|
if @io.agree? "Would you like to import an existing database?"
|
186
|
-
db = @io.
|
199
|
+
db = @io.ask "Where is the database file?", {
|
187
200
|
:indent => 2, :path => true }
|
188
201
|
else
|
189
202
|
db = false
|