theme-juice 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -36
- data/lib/theme-juice/cli.rb +40 -3
- data/lib/theme-juice/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 589c9b478fb324e8d94907691538e3cbccca4df6
|
4
|
+
data.tar.gz: 5f1815da4dfb5eb4f4d77f64dbebc477b95695ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fa8a1775667214102b3284f07a1dc7d2474e6760326d455215cfebba38cc94d3e417d953f81f07d9c32b278eac6cf9d91dbf0ff72e2e059692b7412ee69507d
|
7
|
+
data.tar.gz: b781198d65b046cc2ef3d055448016426d403c3d3a20b97c6ce52574e97910dee37c0c7e3a75827e18956ebf55e7a4c484fb7b85a2f527ccf96f372fabd9db68
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
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 WordPress development command line utility that allows you to scaffold out entire Vagrant development environments in seconds (using [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV) as the VM), manage dependencies and build tools, and even handle deployments.
|
3
3
|
|
4
4
|
## Installation
|
5
5
|
* First, install [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) for local development.
|
@@ -7,6 +7,18 @@ What is it? Theme Juice is a command line tool that allows you to scaffold out a
|
|
7
7
|
* Finally, install with: `gem install theme-juice`
|
8
8
|
That`s it!
|
9
9
|
|
10
|
+
## Windows users
|
11
|
+
Since Windows doesn't support UTF-8 characters inside of the terminal, and is picky about colors, you'll have to run `tj` with a couple flags. What has worked for me on my Windows machine at home is to run all commands through [git-scm](http://git-scm.com/downloads) with the `--boring --no-landrush` flags. This disables all unicode characters and colors from being output, and disables [Landrush](https://github.com/phinze/landrush) which isn't supported fully on Windows. To set these globally via the `ENV`, run:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
export TJ_BORING=true
|
15
|
+
export TJ_NO_LANDRUSH=true
|
16
|
+
```
|
17
|
+
|
18
|
+
In addition to that, `tj` uses the [OS gem](https://github.com/rdp/os) to sniff out your OS and adjusts a few things accordingly. Windows users won't see any fancy select menus or anything like that to avoid crashing (since Windows doesn't support `stty`, which is what is used).
|
19
|
+
|
20
|
+
_If you encounter any bugs, please let me know through a **well-documented** issue and I'll try my best to get it resolved._
|
21
|
+
|
10
22
|
## Config
|
11
23
|
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
24
|
|
@@ -47,7 +59,7 @@ tj --version # Aliases: -v version
|
|
47
59
|
### Global flags:
|
48
60
|
| Flag | Type | Description |
|
49
61
|
|:---------------------- |:------ |:------------------------------------------ |
|
50
|
-
| `[--vm-path=PATH]` |
|
62
|
+
| `[--vm-path=PATH]` | Path | Force path to VM |
|
51
63
|
| `[--vm-ip=IP]` | String | Force IP address for VM |
|
52
64
|
| `[--vm-prefix=PREFIX]` | String | Force directory prefix for project in VM |
|
53
65
|
| `[--yolo]` | Bool | Say yes to anything and everything |
|
@@ -64,44 +76,44 @@ _Use `ENV` variables to set global flags. For example, by running `export TJ_VM_
|
|
64
76
|
### Creating a new development site:
|
65
77
|
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.
|
66
78
|
```bash
|
67
|
-
tj create # Aliases: mk new add
|
79
|
+
tj create # Aliases: mk make new add
|
68
80
|
```
|
69
81
|
|
70
82
|
#### Option flags:
|
71
|
-
| Flag
|
72
|
-
|
73
|
-
| `[-n, --name]`
|
74
|
-
| `[-l, --location]`
|
75
|
-
| `[-t, --theme]`
|
76
|
-
| `[-u, --url]`
|
77
|
-
| `[-r, --repository]`
|
78
|
-
| `[
|
79
|
-
| `[--bare]`
|
80
|
-
| `[--
|
81
|
-
| `[--
|
82
|
-
| `[--
|
83
|
-
| `[--
|
84
|
-
| `[--
|
83
|
+
| Flag | Type | Description |
|
84
|
+
|:----------------------------------- |:------ |:------------------------------------------------ |
|
85
|
+
| `[-n, --name=NAME]` | String | Name of the project |
|
86
|
+
| `[-l, --location=LOCATION]` | Path | Location of the local project |
|
87
|
+
| `[-t, --theme=THEME]` | URL | Starter theme to install |
|
88
|
+
| `[-u, --url=URL]` | URL | Development URL for the project |
|
89
|
+
| `[-r, --repository=REPO]` | URL | Initialize a new Git remote repository |
|
90
|
+
| `[-i, --import-db=DB]` | Path | Import an existing database |
|
91
|
+
| `[--bare]` | Bool | Create a project without a starter theme |
|
92
|
+
| `[--skip-repo]` | Bool | Skip repository prompts and use default settings |
|
93
|
+
| `[--skip-db]` | Bool | Skip database prompts and use default settings |
|
94
|
+
| `[--use-defaults]` | Bool | Skip all prompts and use default settings |
|
95
|
+
| `[--no-wp]` | Bool | New project is not a WordPress install |
|
96
|
+
| `[--no-db]` | Bool | New project does not need a database |
|
85
97
|
|
86
98
|
### Setting up an existing site:
|
87
99
|
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.
|
88
100
|
```bash
|
89
|
-
tj setup # Aliases: up prep init
|
101
|
+
tj setup # Aliases: up prep init
|
90
102
|
```
|
91
103
|
|
92
104
|
#### Option flags:
|
93
|
-
| Flag
|
94
|
-
|
95
|
-
| `[-n, --name]`
|
96
|
-
| `[-l, --location]`
|
97
|
-
| `[-u, --url]`
|
98
|
-
| `[-r, --repository]`
|
99
|
-
| `[-i, --import-db
|
100
|
-
| `[--
|
101
|
-
| `[--
|
102
|
-
| `[--
|
103
|
-
| `[--
|
104
|
-
| `[--
|
105
|
+
| Flag | Type | Description |
|
106
|
+
|:----------------------------------- |:------ |:------------------------------------------------ |
|
107
|
+
| `[-n, --name=NAME]` | String | Name of the project |
|
108
|
+
| `[-l, --location=LOCATION]` | Path | Location of the local project |
|
109
|
+
| `[-u, --url=URL]` | URL | Development URL for the project |
|
110
|
+
| `[-r, --repository=REPO]` | URL | Initialize a new Git remote repository |
|
111
|
+
| `[-i, --import-db=DB]` | Path | Import an existing database |
|
112
|
+
| `[--skip-repo]` | Bool | Skip repository prompts and use default settings |
|
113
|
+
| `[--skip-db]` | Bool | Skip database prompts and use default settings |
|
114
|
+
| `[--use-defaults]` | Bool | Skip all prompts and use default settings |
|
115
|
+
| `[--no-wp]` | Bool | New project is not a WordPress install |
|
116
|
+
| `[--no-db]` | Bool | New project does not need a database |
|
105
117
|
|
106
118
|
### Deleting a site from the VM: _(Does not remove your local site)_
|
107
119
|
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._
|
@@ -110,12 +122,12 @@ tj delete # Aliases: rm remove trash teardown
|
|
110
122
|
```
|
111
123
|
|
112
124
|
#### Option flags:
|
113
|
-
| Flag
|
114
|
-
|
115
|
-
| `[-n, --name]`
|
116
|
-
| `[-u, --url]`
|
117
|
-
| `[--
|
118
|
-
| `[--
|
125
|
+
| Flag | Type | Description |
|
126
|
+
|:------------------- |:------ |:------------------------------- |
|
127
|
+
| `[-n, --name=NAME]` | String | Name of the development project |
|
128
|
+
| `[-u, --url=URL]` | URL | Development URL for the project |
|
129
|
+
| `[--db-drop]` | Bool | Drop project's database |
|
130
|
+
| `[--vm-restart]` | Bool | Restart VM after deletion |
|
119
131
|
|
120
132
|
### Managing deployment and migration (coming soon):
|
121
133
|
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.
|
data/lib/theme-juice/cli.rb
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
+
#
|
4
|
+
# Monkey patch to not print out reverse bool options on --help
|
5
|
+
#
|
6
|
+
# @see https://github.com/erikhuda/thor/issues/417
|
7
|
+
#
|
8
|
+
class Thor
|
9
|
+
class Option < Argument
|
10
|
+
def usage(padding = 0)
|
11
|
+
sample = if banner && !banner.to_s.empty?
|
12
|
+
"#{switch_name}=#{banner}"
|
13
|
+
else
|
14
|
+
switch_name
|
15
|
+
end
|
16
|
+
|
17
|
+
sample = "[#{sample}]" unless required?
|
18
|
+
|
19
|
+
# if boolean?
|
20
|
+
# sample << ", [#{dasherize("no-" + human_name)}]" unless name == "force" or name.start_with?("no-")
|
21
|
+
# end
|
22
|
+
|
23
|
+
if aliases.empty?
|
24
|
+
(" " * padding) << sample
|
25
|
+
else
|
26
|
+
"#{aliases.join(', ')}, #{sample}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
VALID_TYPES.each do |type|
|
31
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
32
|
+
def #{type}?
|
33
|
+
self.type == #{type.inspect}
|
34
|
+
end
|
35
|
+
RUBY
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
3
40
|
module ThemeJuice
|
4
41
|
class CLI < Thor
|
5
42
|
|
@@ -30,8 +67,8 @@ module ThemeJuice
|
|
30
67
|
end
|
31
68
|
|
32
69
|
map %w[--version -v] => :version
|
33
|
-
map %w[mk new add]
|
34
|
-
map %w[up prep init
|
70
|
+
map %w[mk make new add] => :create
|
71
|
+
map %w[up prep init] => :setup
|
35
72
|
map %w[rm remove trash teardown] => :delete
|
36
73
|
map %w[ls projects apps sites] => :list
|
37
74
|
map %w[assets dev build] => :watch
|
@@ -69,7 +106,7 @@ module ThemeJuice
|
|
69
106
|
method_option :theme, :type => :string, :aliases => "-t", :default => nil, :desc => "Starter theme to install"
|
70
107
|
method_option :url, :type => :string, :aliases => "-u", :default => nil, :desc => "Development URL for the project"
|
71
108
|
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
|
109
|
+
method_option :db_import, :type => :string, :aliases => %w[-i --import-db], :desc => "Import an existing database"
|
73
110
|
method_option :bare, :type => :boolean, :desc => "Create a project without a starter theme"
|
74
111
|
method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use default settings"
|
75
112
|
method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use default settings"
|
data/lib/theme-juice/version.rb
CHANGED