theme-juice 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -13
- data/lib/theme-juice/cli.rb +59 -46
- data/lib/theme-juice/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 520eb3831077f97fbcf1a4469178bfe86e399c0e
|
4
|
+
data.tar.gz: b15d8d8f8043ace8c6c1cf7a1d4112892cde0d38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 265defc28090617635b3374cd1802e6d985bbb2b70ea7a08be57632d8f73c34e74541fe0881b3161bbece095dc2240b88d1ca14285348499b069dc539b995db9
|
7
|
+
data.tar.gz: e2f1e7adaf39dfd45c140d94e62b1e80e66d9ae2d6da6020c97087658676b2f79ca664b86ed9a5c128b3fa4348e02cc5b57772650b0332ef8af7364866baa360
|
data/README.md
CHANGED
@@ -18,7 +18,6 @@ server: bundle exec cap
|
|
18
18
|
vendor: composer
|
19
19
|
install:
|
20
20
|
- composer install
|
21
|
-
|
22
21
|
```
|
23
22
|
|
24
23
|
_Note: If you use a starter theme that doesn't have a `tj-config.yml` file, you'll be prompted through a series of steps in order to create one._
|
@@ -53,20 +52,21 @@ tj --version # Aliases: -v, version
|
|
53
52
|
### Creating a new development site:
|
54
53
|
Use this to create a new development site. It will automagically set up your entire development environment, including a local development site at `http://<sites-dev-url>.dev` with WordPress installed and a fresh WP database. It will sync up your local site installation with the Vagrant VM. This task will also install and configure Vagrant/VVV into your `~/` directory if it has not already been installed. Site name is optional, as it will be asked for if not given.
|
55
54
|
```bash
|
56
|
-
tj create [<SITE-NAME>] # Aliases: new, build, make
|
55
|
+
tj create [<SITE-NAME>] # Aliases: new, add, build, make
|
57
56
|
```
|
58
57
|
|
59
58
|
#### Option flags:
|
60
|
-
| Flag
|
61
|
-
|
62
|
-
| `-b, [--bare]
|
63
|
-
| `-s, [--site=SITE]`
|
64
|
-
| `-l, [--location=LOCATION]`
|
65
|
-
| `-t, [--theme=THEME]`
|
66
|
-
| `-u, [--url=URL]`
|
67
|
-
| `-r, [--repository]`
|
68
|
-
| `[--skip-repo]
|
69
|
-
| `[--skip-db]
|
59
|
+
| Flag | Type | Description |
|
60
|
+
|:--------------------------- |:------ |:------------------------------------------------ |
|
61
|
+
| `-b, [--bare]` | Bool | Create a VVV site without a starter theme |
|
62
|
+
| `-s, [--site=SITE]` | String | Name of the development site |
|
63
|
+
| `-l, [--location=LOCATION]` | Path | Location of the local site |
|
64
|
+
| `-t, [--theme=THEME]` | URL | Starter theme to install (can use `none`) |
|
65
|
+
| `-u, [--url=URL]` | URL | Development URL of the site (must end in `.dev`) |
|
66
|
+
| `-r, [--repository]` | String | Initialize a new Git remote repository |
|
67
|
+
| `[--skip-repo]` | Bool | Skip repository prompts and set to `none` |
|
68
|
+
| `[--skip-db]` | Bool | Skip database prompts and use defaults |
|
69
|
+
| `[--use-defaults]` | Bool | Skip all prompts and use defaults |
|
70
70
|
|
71
71
|
### Setting up an existing site:
|
72
72
|
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). Site name is optional, as it will be asked for if not given.
|
@@ -77,7 +77,7 @@ tj setup [<SITE-NAME>] # Aliases: init, prep
|
|
77
77
|
### Deleting a site from the VM: _(Does not remove your local site)_
|
78
78
|
Use this to remove a site from your development environment. This is only remove files that were generated by `tj`. including the database setup, development url, and shared directories. _It will not touch your local files._
|
79
79
|
```bash
|
80
|
-
tj delete <SITE-NAME> # Aliases: remove, teardown
|
80
|
+
tj delete <SITE-NAME> # Aliases: remove, trash, teardown
|
81
81
|
```
|
82
82
|
|
83
83
|
### Listing all `tj` sites in the VM:
|
data/lib/theme-juice/cli.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module ThemeJuice
|
2
2
|
class CLI < ::Thor
|
3
3
|
|
4
|
-
map %w[--version -v]
|
5
|
-
map %w[new, build, make]
|
6
|
-
map %w[setup, init, prep]
|
7
|
-
map %w[remove, teardown] => :delete
|
8
|
-
map %w[sites, show]
|
9
|
-
map %w[dev]
|
10
|
-
map %w[dep, deps]
|
11
|
-
map %w[deploy]
|
12
|
-
map %w[vagrant, vvv]
|
4
|
+
map %w[--version -v] => :version
|
5
|
+
map %w[new, add, build, make] => :create
|
6
|
+
map %w[setup, init, prep] => :create
|
7
|
+
map %w[remove, trash, teardown] => :delete
|
8
|
+
map %w[sites, show] => :list
|
9
|
+
map %w[dev] => :watch
|
10
|
+
map %w[dep, deps] => :vendor
|
11
|
+
map %w[deploy] => :server
|
12
|
+
map %w[vagrant, vvv] => :vm
|
13
13
|
|
14
14
|
class_option :vvv_path, type: :string, alias: "-fp", default: nil, desc: "Force path to VVV installation"
|
15
15
|
|
@@ -53,14 +53,15 @@ module ThemeJuice
|
|
53
53
|
# @return {Void}
|
54
54
|
###
|
55
55
|
desc "create [SITE]", "Create new SITE and setup the VVV development environment"
|
56
|
-
method_option :bare,
|
57
|
-
method_option :site,
|
58
|
-
method_option :location,
|
59
|
-
method_option :theme,
|
60
|
-
method_option :url,
|
61
|
-
method_option :repository,
|
62
|
-
method_option :skip_repo,
|
63
|
-
method_option :skip_db,
|
56
|
+
method_option :bare, type: :boolean, aliases: "-b", desc: "Create a VVV site without a starter theme"
|
57
|
+
method_option :site, type: :string, aliases: "-s", default: false, desc: "Name of the development site"
|
58
|
+
method_option :location, type: :string, aliases: "-l", default: false, desc: "Location of the local site"
|
59
|
+
method_option :theme, type: :string, aliases: "-t", default: false, desc: "Starter theme to install"
|
60
|
+
method_option :url, type: :string, aliases: "-u", default: false, desc: "Development URL of the site"
|
61
|
+
method_option :repository, type: :string, aliases: "-r", desc: "Initialize a new Git remote repository"
|
62
|
+
method_option :skip_repo, type: :boolean, desc: "Skip repository prompts and use defaults"
|
63
|
+
method_option :skip_db, type: :boolean, desc: "Skip database prompts and use defaults"
|
64
|
+
method_option :use_defaults, type: :boolean, desc: "Skip all promps and use default settings"
|
64
65
|
def create(site = nil)
|
65
66
|
self.force_vvv_path?
|
66
67
|
|
@@ -71,7 +72,7 @@ module ThemeJuice
|
|
71
72
|
end
|
72
73
|
|
73
74
|
# Check if user passed all required options through flags
|
74
|
-
if options.length >= 6
|
75
|
+
if options.length >= 6 || options[:use_defaults]
|
75
76
|
say " → Well... looks like you just have everything all figured out, huh?".ljust(terminal_width), [:black, :on_green]
|
76
77
|
elsif site.nil?
|
77
78
|
say " → Just a few questions before we begin...".ljust(terminal_width), [:black, :on_green]
|
@@ -96,10 +97,14 @@ module ThemeJuice
|
|
96
97
|
clean_site_name = site.gsub(/[^\w]/, "_")[0..10]
|
97
98
|
|
98
99
|
# Location of site installation
|
99
|
-
if options[:
|
100
|
-
site_location =
|
100
|
+
if options[:use_defaults]
|
101
|
+
site_location = "#{Dir.pwd}/"
|
101
102
|
else
|
102
|
-
|
103
|
+
if options[:location]
|
104
|
+
site_location = options[:location]
|
105
|
+
else
|
106
|
+
site_location = ask " ○ Where do you want to setup the site? :", :blue, default: "#{Dir.pwd}/", path: true
|
107
|
+
end
|
103
108
|
end
|
104
109
|
|
105
110
|
# Starter theme to clone
|
@@ -117,39 +122,47 @@ module ThemeJuice
|
|
117
122
|
"theme-juice/theme-juice-starter" => "https://github.com/ezekg/theme-juice-starter.git"
|
118
123
|
}
|
119
124
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
125
|
+
if options[:use_defaults]
|
126
|
+
theme = themes["theme-juice/theme-juice-starter"]
|
127
|
+
else
|
128
|
+
say " ○ Which starter theme would you like to use? (partial name is acceptable)", :blue
|
129
|
+
choose do |menu|
|
130
|
+
menu.index = " ○"
|
131
|
+
menu.prompt = set_color " → Choose one :".ljust(16), :blue
|
132
|
+
|
133
|
+
themes.each do |theme, repo|
|
134
|
+
menu.choice theme do
|
124
135
|
|
125
|
-
|
126
|
-
|
136
|
+
if theme == "theme-juice/theme-juice-starter"
|
137
|
+
say " ↑ Awesome choice!", :green
|
138
|
+
end
|
127
139
|
|
128
|
-
|
129
|
-
say " ↑ Awesome choice!", :green
|
140
|
+
starter_theme = repo
|
130
141
|
end
|
131
|
-
|
132
|
-
starter_theme = repo
|
133
142
|
end
|
134
|
-
end
|
135
143
|
|
136
|
-
|
137
|
-
|
138
|
-
|
144
|
+
menu.choice "other" do
|
145
|
+
starter_theme = ask " ○ What is the repository URL for the starter theme you would like to clone? :", :blue
|
146
|
+
end
|
139
147
|
|
140
|
-
|
141
|
-
|
142
|
-
|
148
|
+
menu.choice "none" do |opt|
|
149
|
+
say " → Next time you need to create a site without a starter theme, you can just run the 'setup' command instead.".ljust(terminal_width), [:black, :on_yellow]
|
150
|
+
starter_theme, bare_setup = opt, true
|
151
|
+
end
|
143
152
|
end
|
144
153
|
end
|
145
154
|
end
|
146
155
|
end
|
147
156
|
|
148
157
|
# Development url
|
149
|
-
if options[:
|
150
|
-
dev_url =
|
158
|
+
if options[:use_defaults]
|
159
|
+
dev_url = "#{site}.dev"
|
151
160
|
else
|
152
|
-
|
161
|
+
if options[:url]
|
162
|
+
dev_url = options[:url]
|
163
|
+
else
|
164
|
+
dev_url = ask " ○ What do you want the development url to be? (this should end in '.dev') :", :blue, default: "#{site}.dev"
|
165
|
+
end
|
153
166
|
end
|
154
167
|
|
155
168
|
unless dev_url.match /(.dev)$/
|
@@ -158,7 +171,7 @@ module ThemeJuice
|
|
158
171
|
end
|
159
172
|
|
160
173
|
# Initialize a git repository on setup
|
161
|
-
if options[:skip_repo]
|
174
|
+
if options[:use_defaults] || options[:skip_repo]
|
162
175
|
repository = false
|
163
176
|
else
|
164
177
|
if options[:repository]
|
@@ -173,28 +186,28 @@ module ThemeJuice
|
|
173
186
|
end
|
174
187
|
|
175
188
|
# Database host
|
176
|
-
if options[:skip_db]
|
189
|
+
if options[:use_defaults] || options[:skip_db]
|
177
190
|
db_host = "vvv"
|
178
191
|
else
|
179
192
|
db_host = ask " ○ Database host :", :blue, default: "vvv"
|
180
193
|
end
|
181
194
|
|
182
195
|
# Database name
|
183
|
-
if options[:skip_db]
|
196
|
+
if options[:use_defaults] || options[:skip_db]
|
184
197
|
db_name = "#{clean_site_name}_db"
|
185
198
|
else
|
186
199
|
db_name = ask " ○ Database name :", :blue, default: "#{clean_site_name}_db"
|
187
200
|
end
|
188
201
|
|
189
202
|
# Database username
|
190
|
-
if options[:skip_db]
|
203
|
+
if options[:use_defaults] || options[:skip_db]
|
191
204
|
db_user = "#{clean_site_name}_user"
|
192
205
|
else
|
193
206
|
db_user = ask " ○ Database username :", :blue, default: "#{clean_site_name}_user"
|
194
207
|
end
|
195
208
|
|
196
209
|
# Database password
|
197
|
-
if options[:skip_db]
|
210
|
+
if options[:use_defaults] || options[:skip_db]
|
198
211
|
db_pass = SecureRandom.base64
|
199
212
|
else
|
200
213
|
db_pass = ask " ○ Database password :", :blue, default: SecureRandom.base64
|
data/lib/theme-juice/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: theme-juice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezekiel Gabrielse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|