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
data/lib/theme-juice/project.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class Apache < Task
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
create_apache_file
|
13
|
+
end
|
14
|
+
|
15
|
+
def unexecute
|
16
|
+
remove_apache_file
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def apache_file
|
22
|
+
"#{@env.vm_path}/config/apache-config/sites/#{@project.name}.conf"
|
23
|
+
end
|
24
|
+
|
25
|
+
def apache_is_setup?
|
26
|
+
File.exist? apache_file
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_apache_file
|
30
|
+
unless apache_is_setup?
|
31
|
+
@io.log "Creating apache conf file"
|
32
|
+
@util.create_file apache_file, :verbose => @env.verbose do
|
33
|
+
%Q{<VirtualHost *:80>
|
34
|
+
DocumentRoot #{@project.vm_srv}
|
35
|
+
ServerName #{@project.url}
|
36
|
+
ServerAlias *.#{@project.url} #{@project.xip}.*.xip.io *.#{@project.xip}.*.xip.io
|
37
|
+
</VirtualHost>
|
38
|
+
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def remove_apache_file
|
45
|
+
@io.log "Removing apache conf file"
|
46
|
+
@util.remove_file apache_file, :verbose => @env.verbose
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -9,13 +9,22 @@ module ThemeJuice
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def execute
|
12
|
+
is_user_a_smarty_pants?
|
12
13
|
confirm
|
13
14
|
end
|
14
15
|
|
15
16
|
private
|
17
|
+
|
18
|
+
def is_user_a_smarty_pants?
|
19
|
+
if @env.yolo && @project.use_defaults
|
20
|
+
@io.say "Well, don't you just have everything all figured out?", {
|
21
|
+
:color => :blue, :icon => :general }
|
22
|
+
end
|
23
|
+
end
|
16
24
|
|
17
25
|
def confirm
|
18
26
|
@io.list "Your settings :", :yellow, settings
|
27
|
+
|
19
28
|
unless @io.agree? "Do these settings look correct?"
|
20
29
|
@io.error "Dang typos..."
|
21
30
|
end
|
@@ -9,10 +9,18 @@ module ThemeJuice
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def unexecute
|
12
|
+
boom?
|
12
13
|
confirm
|
13
14
|
end
|
14
15
|
|
15
16
|
private
|
17
|
+
|
18
|
+
def boom?
|
19
|
+
if @env.yolo
|
20
|
+
@io.say "Why in the world would you run this command with yolo? Anyways...", {
|
21
|
+
:color => :yellow, :icon => :general }
|
22
|
+
end
|
23
|
+
end
|
16
24
|
|
17
25
|
def confirm
|
18
26
|
unless @io.agree? "Are you sure you want to remove '#{@project.name}'?"
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module ThemeJuice
|
4
|
+
module Tasks
|
5
|
+
class ForwardPorts < Entry
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
super
|
9
|
+
|
10
|
+
@entry = {
|
11
|
+
:project => "ports",
|
12
|
+
:file => "#{@env.vm_path}/Customfile",
|
13
|
+
:name => "ports",
|
14
|
+
:id => "FP"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute
|
19
|
+
unless @env.no_port_forward
|
20
|
+
create_entry_file
|
21
|
+
create_entry do
|
22
|
+
%Q{#{forward_host_ports}config.vm.network "forwarded_port", guest: 80, host: 8080
|
23
|
+
config.vm.network "forwarded_port", guest: 443, host: 8443}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def unexecute
|
29
|
+
remove_entry
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
# @TODO I'd like to eventually support every OS. I'm only familiar with
|
35
|
+
# OSX, so that's why there's nothing else here
|
36
|
+
def forward_host_ports
|
37
|
+
if OS.osx?
|
38
|
+
%Q{if defined? VagrantPlugins::Triggers
|
39
|
+
config.trigger.after [:up, :reload, :provision], :stdout => true do
|
40
|
+
system \%Q{echo "
|
41
|
+
rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
|
42
|
+
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443
|
43
|
+
" | sudo pfctl -ef - >/dev/null 2>&1; echo "Forwarding ports (80 => 8080)\\nForwarding ports (443 => 8443)"}
|
44
|
+
end
|
45
|
+
config.trigger.after [:halt, :suspend, :destroy], :stdout => true do
|
46
|
+
system \%Q{sudo pfctl -F all -f /etc/pf.conf >/dev/null 2>&1; echo "Removing forwarded ports (80 => 8080)\\nRemoving forwarded ports (443 => 8443)"}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -19,7 +19,7 @@ module ThemeJuice
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def nginx_file
|
22
|
-
"#{@
|
22
|
+
"#{@env.vm_path}/config/nginx-config/sites/#{@project.name}.conf"
|
23
23
|
end
|
24
24
|
|
25
25
|
def nginx_is_setup?
|
@@ -28,22 +28,23 @@ module ThemeJuice
|
|
28
28
|
|
29
29
|
def create_nginx_file
|
30
30
|
unless nginx_is_setup?
|
31
|
-
@io.log "Creating nginx file"
|
31
|
+
@io.log "Creating nginx conf file"
|
32
32
|
@util.create_file nginx_file, :verbose => @env.verbose do
|
33
|
-
%Q
|
34
|
-
listen
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
%Q(server {
|
34
|
+
listen 80;
|
35
|
+
listen 443 ssl;
|
36
|
+
server_name .#{@project.url} ~(^|^[a-z0-9.-]*\\.)#{@project.xip}\\.\\d+\\.\\d+\\.\\d+\\.\\d+\\.xip\\.io$;
|
37
|
+
root #{@project.vm_srv};
|
38
|
+
include /etc/nginx/nginx-wp-common.conf;
|
40
39
|
}
|
40
|
+
|
41
|
+
)
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
46
|
def remove_nginx_file
|
46
|
-
@io.log "Removing nginx file"
|
47
|
+
@io.log "Removing nginx conf file"
|
47
48
|
@util.remove_file nginx_file, :verbose => @env.verbose
|
48
49
|
end
|
49
50
|
end
|
@@ -27,7 +27,7 @@ module ThemeJuice
|
|
27
27
|
|
28
28
|
@util.inside @env.vm_path do
|
29
29
|
res = @util.run("vagrant status --machine-readable", {
|
30
|
-
:verbose => @env.verbose, :capture => true}).include? "running"
|
30
|
+
:verbose => @env.verbose, :capture => true }).include? "running"
|
31
31
|
end
|
32
32
|
|
33
33
|
res
|
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.
|
4
|
+
version: 0.9.0
|
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-06-
|
11
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -53,78 +53,51 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.9'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '10.4'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ~>
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '10.4'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
56
|
+
name: capistrano
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
86
58
|
requirements:
|
87
59
|
- - ~>
|
88
60
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
90
|
-
type: :
|
61
|
+
version: '3.3'
|
62
|
+
type: :runtime
|
91
63
|
prerelease: false
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
93
65
|
requirements:
|
94
66
|
- - ~>
|
95
67
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
68
|
+
version: '3.3'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
70
|
+
name: bundler
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
100
72
|
requirements:
|
101
73
|
- - ~>
|
102
74
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
75
|
+
version: '1.0'
|
104
76
|
type: :development
|
105
77
|
prerelease: false
|
106
78
|
version_requirements: !ruby/object:Gem::Requirement
|
107
79
|
requirements:
|
108
80
|
- - ~>
|
109
81
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0
|
82
|
+
version: '1.0'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
84
|
+
name: rake
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
114
86
|
requirements:
|
115
87
|
- - ~>
|
116
88
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
89
|
+
version: '10.4'
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
93
|
requirements:
|
122
94
|
- - ~>
|
123
95
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
96
|
+
version: '10.4'
|
125
97
|
description: Theme Juice is a WordPress development command line utility that allows
|
126
|
-
you to scaffold out entire Vagrant development
|
127
|
-
|
98
|
+
you to scaffold out an entire Vagrant development environment in seconds (using
|
99
|
+
an Apache fork of VVV called VVV-Apache as the VM). It also helps you manage dependencies
|
100
|
+
and build tools, and can even handle your deployments.
|
128
101
|
email:
|
129
102
|
- ezekg@yahoo.com
|
130
103
|
executables:
|
@@ -149,12 +122,14 @@ files:
|
|
149
122
|
- lib/theme-juice/man/tj-create.txt
|
150
123
|
- lib/theme-juice/man/tj-delete
|
151
124
|
- lib/theme-juice/man/tj-delete.txt
|
125
|
+
- lib/theme-juice/man/tj-deploy
|
126
|
+
- lib/theme-juice/man/tj-deploy.txt
|
152
127
|
- lib/theme-juice/man/tj-setup
|
153
128
|
- lib/theme-juice/man/tj-setup.txt
|
154
129
|
- lib/theme-juice/man/tj.txt
|
155
|
-
- lib/theme-juice/patches/option.rb
|
156
130
|
- lib/theme-juice/project.rb
|
157
131
|
- lib/theme-juice/task.rb
|
132
|
+
- lib/theme-juice/tasks/apache.rb
|
158
133
|
- lib/theme-juice/tasks/create_confirm.rb
|
159
134
|
- lib/theme-juice/tasks/create_success.rb
|
160
135
|
- lib/theme-juice/tasks/database.rb
|
@@ -163,7 +138,7 @@ files:
|
|
163
138
|
- lib/theme-juice/tasks/dns.rb
|
164
139
|
- lib/theme-juice/tasks/dot_env.rb
|
165
140
|
- lib/theme-juice/tasks/entry.rb
|
166
|
-
- lib/theme-juice/tasks/
|
141
|
+
- lib/theme-juice/tasks/forward_ports.rb
|
167
142
|
- lib/theme-juice/tasks/import_database.rb
|
168
143
|
- lib/theme-juice/tasks/landrush.rb
|
169
144
|
- lib/theme-juice/tasks/list.rb
|
@@ -172,7 +147,7 @@ files:
|
|
172
147
|
- lib/theme-juice/tasks/repo.rb
|
173
148
|
- lib/theme-juice/tasks/synced_folder.rb
|
174
149
|
- lib/theme-juice/tasks/theme.rb
|
175
|
-
- lib/theme-juice/tasks/
|
150
|
+
- lib/theme-juice/tasks/vm_box.rb
|
176
151
|
- lib/theme-juice/tasks/vm_customfile.rb
|
177
152
|
- lib/theme-juice/tasks/vm_location.rb
|
178
153
|
- lib/theme-juice/tasks/vm_plugins.rb
|
@@ -183,7 +158,7 @@ files:
|
|
183
158
|
- lib/theme-juice/version.rb
|
184
159
|
homepage: https://themejuice.it
|
185
160
|
licenses:
|
186
|
-
-
|
161
|
+
- GNU
|
187
162
|
metadata: {}
|
188
163
|
post_install_message:
|
189
164
|
rdoc_options: []
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
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 aliases.empty?
|
20
|
-
(" " * padding) << sample
|
21
|
-
else
|
22
|
-
"#{aliases.join(', ')}, #{sample}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
VALID_TYPES.each do |type|
|
27
|
-
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
28
|
-
def #{type}?
|
29
|
-
self.type == #{type.inspect}
|
30
|
-
end
|
31
|
-
RUBY
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module ThemeJuice
|
4
|
-
module Tasks
|
5
|
-
class Hosts < Task
|
6
|
-
|
7
|
-
def initialize(opts = {})
|
8
|
-
super
|
9
|
-
end
|
10
|
-
|
11
|
-
def execute
|
12
|
-
create_hosts_file
|
13
|
-
end
|
14
|
-
|
15
|
-
def unexecute
|
16
|
-
remove_hosts_file
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def hosts_file
|
22
|
-
"#{@project.location}/vvv-hosts"
|
23
|
-
end
|
24
|
-
|
25
|
-
def hosts_is_setup?
|
26
|
-
File.exist? hosts_file
|
27
|
-
end
|
28
|
-
|
29
|
-
def create_hosts_file
|
30
|
-
unless hosts_is_setup?
|
31
|
-
@io.log "Creating hosts file"
|
32
|
-
@util.create_file hosts_file, "#{@project.url}",
|
33
|
-
:verbose => @env.verbose
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def remove_hosts_file
|
38
|
-
@io.log "Removing hosts file"
|
39
|
-
@util.remove_file hosts_file, :verbose => @env.verbose
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|