theme-juice 0.6.12 → 0.6.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/theme-juice/cli.rb +12 -12
- data/lib/theme-juice/command.rb +5 -0
- data/lib/theme-juice/commands/create.rb +0 -1
- data/lib/theme-juice/commands/delete.rb +0 -1
- data/lib/theme-juice/commands/install.rb +0 -1
- data/lib/theme-juice/commands/list.rb +0 -1
- data/lib/theme-juice/commands/subcommand.rb +1 -2
- data/lib/theme-juice/interaction.rb +0 -1
- data/lib/theme-juice/interactions/create.rb +226 -236
- data/lib/theme-juice/interactions/delete.rb +37 -47
- data/lib/theme-juice/interactions/teejay.rb +4 -8
- data/lib/theme-juice/services/create.rb +9 -9
- data/lib/theme-juice/services/delete.rb +1 -2
- data/lib/theme-juice/version.rb +1 -1
- data/lib/theme-juice.rb +0 -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: b1ec1d079ea72b80319db439459fd0a7d5ab0dbe
|
4
|
+
data.tar.gz: 129075f275d74a94cf237a44fc878c67c560a286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227ab16e983253316a6b8c665c20f5755fa8ec4e604e8d17e7b40517756409a2c7901bc5d9b86cd3179caa1f525fb3e424acb05e050d8230e473aa981eac5b71
|
7
|
+
data.tar.gz: c7ca67087eca3df42cdc681b941e57dc9ebffa76c34980beabb2b0d0959be85c23787ca2f0d4ce6bbe52c94237a30b7fec3ec1cdeebfd9fb295fcb5795ae3502
|
data/lib/theme-juice/cli.rb
CHANGED
@@ -6,15 +6,15 @@ module ThemeJuice
|
|
6
6
|
#
|
7
7
|
# Command aliases
|
8
8
|
#
|
9
|
-
map %w[--version -v]
|
10
|
-
map %w[new, add, build, make]
|
11
|
-
map %w[prep]
|
12
|
-
map %w[remove, trash, teardown]
|
13
|
-
map %w[sites, show]
|
14
|
-
map %w[assets, dev]
|
15
|
-
map %w[dependencies, deps]
|
16
|
-
map %w[deploy, remote]
|
17
|
-
map %w[vagrant, vvv]
|
9
|
+
map %w[--version -v] => :version
|
10
|
+
map %w[new, add, build, make] => :create
|
11
|
+
map %w[prep] => :setup
|
12
|
+
map %w[remove, trash, teardown] => :delete
|
13
|
+
map %w[sites, show] => :list
|
14
|
+
map %w[assets, dev] => :watch
|
15
|
+
map %w[dependencies, deps] => :vendor
|
16
|
+
map %w[deploy, remote] => :server
|
17
|
+
map %w[vagrant, vvv] => :vm
|
18
18
|
|
19
19
|
#
|
20
20
|
# Class options
|
@@ -41,12 +41,12 @@ module ThemeJuice
|
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "create [NAME]", "Create new site and setup VVV environment"
|
44
|
-
method_option :bare, :type => :boolean, :aliases => "-b", :desc => "Create a VVV site without a starter theme"
|
45
44
|
method_option :name, :type => :string, :aliases => "-n", :default => false, :desc => "Name of the development site"
|
46
45
|
method_option :location, :type => :string, :aliases => "-l", :default => false, :desc => "Location of the local site"
|
47
46
|
method_option :theme, :type => :string, :aliases => "-t", :default => false, :desc => "Starter theme to install"
|
48
47
|
method_option :url, :type => :string, :aliases => "-u", :default => false, :desc => "Development URL of the site"
|
49
48
|
method_option :repository, :type => :string, :aliases => "-r", :desc => "Initialize a new Git remote repository"
|
49
|
+
method_option :bare, :type => :boolean, :desc => "Create a VVV site without a starter theme"
|
50
50
|
method_option :skip_repo, :type => :boolean, :desc => "Skip repository prompts and use defaults"
|
51
51
|
method_option :skip_db, :type => :boolean, :desc => "Skip database prompts and use defaults"
|
52
52
|
method_option :use_defaults, :type => :boolean, :desc => "Skip all prompts and use default settings"
|
@@ -63,13 +63,13 @@ module ThemeJuice
|
|
63
63
|
@interaction.hello
|
64
64
|
|
65
65
|
opts = {
|
66
|
-
:site_bare => options[:bare],
|
67
66
|
:site_name => name || options[:name],
|
68
67
|
:site_location => options[:location],
|
69
68
|
:site_starter_theme => options[:theme],
|
70
69
|
:site_dev_location => nil,
|
71
70
|
:site_dev_url => options[:url],
|
72
71
|
:site_repository => options[:repository],
|
72
|
+
:site_bare => options[:bare],
|
73
73
|
:skip_repo => options[:skip_repo],
|
74
74
|
:skip_db => options[:skip_db],
|
75
75
|
:use_defaults => options[:use_defaults]
|
@@ -99,13 +99,13 @@ module ThemeJuice
|
|
99
99
|
@interaction.hello
|
100
100
|
|
101
101
|
opts = {
|
102
|
-
:site_bare => true,
|
103
102
|
:site_name => name || options[:name],
|
104
103
|
:site_location => options[:location],
|
105
104
|
:site_starter_theme => false,
|
106
105
|
:site_dev_location => nil,
|
107
106
|
:site_dev_url => options[:url],
|
108
107
|
:site_repository => options[:repository],
|
108
|
+
:site_bare => true,
|
109
109
|
:skip_repo => options[:skip_repo],
|
110
110
|
:skip_db => options[:skip_db],
|
111
111
|
:use_defaults => options[:use_defaults]
|
data/lib/theme-juice/command.rb
CHANGED
@@ -1,287 +1,277 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module ThemeJuice
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
# Set up interactions and environment
|
8
|
-
#
|
9
|
-
# @return {Void}
|
10
|
-
#
|
11
|
-
def initialize
|
12
|
-
@environment = ::ThemeJuice::Environment
|
13
|
-
@interaction = ::ThemeJuice::Interaction
|
14
|
-
end
|
4
|
+
module Interaction::Create
|
15
5
|
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
# @param {Hash} opts
|
20
|
-
#
|
21
|
-
# @return {Hash}
|
22
|
-
#
|
23
|
-
def setup_site_options(opts = {})
|
24
|
-
@opts = opts
|
25
|
-
|
26
|
-
if @environment.yolo
|
27
|
-
@opts[:use_defaults] = true
|
28
|
-
end
|
6
|
+
@environment = ::ThemeJuice::Environment
|
7
|
+
@interaction = ::ThemeJuice::Interaction
|
29
8
|
|
30
|
-
|
31
|
-
:site_name,
|
32
|
-
:site_name_clean,
|
33
|
-
:site_location,
|
34
|
-
:site_starter_theme,
|
35
|
-
:site_dev_location,
|
36
|
-
:site_dev_url,
|
37
|
-
:site_repository,
|
38
|
-
:site_db_host,
|
39
|
-
:site_db_name,
|
40
|
-
:site_db_user,
|
41
|
-
:site_db_pass
|
42
|
-
]
|
43
|
-
|
44
|
-
required_opts.each do |opt|
|
45
|
-
@opts[opt] = self.send "setup_#{opt}" unless @opts[opt]
|
46
|
-
end
|
9
|
+
class << self
|
47
10
|
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
"Database name: #{@opts[:site_db_name]}",
|
58
|
-
"Database username: #{@opts[:site_db_user]}",
|
59
|
-
"Database password: #{@opts[:site_db_pass]}"
|
60
|
-
]
|
61
|
-
|
62
|
-
unless @interaction.agree? "Do the options above look correct?"
|
63
|
-
@interaction.error "Dang typos... aborting mission."
|
64
|
-
end
|
11
|
+
#
|
12
|
+
# Set up needed site options
|
13
|
+
#
|
14
|
+
# @param {Hash} opts
|
15
|
+
#
|
16
|
+
# @return {Hash}
|
17
|
+
#
|
18
|
+
def setup_site_options(opts = {})
|
19
|
+
@opts = opts
|
65
20
|
|
66
|
-
|
67
|
-
|
21
|
+
if @environment.yolo
|
22
|
+
@opts[:use_defaults] = true
|
23
|
+
end
|
68
24
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
25
|
+
@opts[:site_name] ||= setup_site_name
|
26
|
+
@opts[:site_name_clean] ||= setup_site_name_clean
|
27
|
+
@opts[:site_location] ||= setup_site_location
|
28
|
+
@opts[:site_starter_theme] ||= setup_site_starter_theme
|
29
|
+
@opts[:site_dev_location] ||= setup_site_dev_location
|
30
|
+
@opts[:site_dev_url] ||= setup_site_dev_url
|
31
|
+
@opts[:site_repository] ||= setup_site_repository
|
32
|
+
@opts[:site_db_host] ||= setup_site_db_host
|
33
|
+
@opts[:site_db_name] ||= setup_site_db_name
|
34
|
+
@opts[:site_db_user] ||= setup_site_db_user
|
35
|
+
@opts[:site_db_pass] ||= setup_site_db_pass
|
36
|
+
|
37
|
+
# Verify that all the options are correct
|
38
|
+
@interaction.list "Your settings :", :yellow, [
|
39
|
+
"Site name: #{@opts[:site_name]}",
|
40
|
+
"Site location: #{@opts[:site_location]}",
|
41
|
+
"Starter theme: #{@opts[:site_starter_theme]}",
|
42
|
+
"Development location: #{@opts[:site_dev_location]}",
|
43
|
+
"Development url: http://#{@opts[:site_dev_url]}",
|
44
|
+
"Initialized repository: #{@opts[:site_repository]}",
|
45
|
+
"Database host: #{@opts[:site_db_host]}",
|
46
|
+
"Database name: #{@opts[:site_db_name]}",
|
47
|
+
"Database username: #{@opts[:site_db_user]}",
|
48
|
+
"Database password: #{@opts[:site_db_pass]}"
|
49
|
+
]
|
50
|
+
|
51
|
+
unless @interaction.agree? "Do the options above look correct?"
|
52
|
+
@interaction.error "Dang typos... aborting mission."
|
53
|
+
end
|
54
|
+
|
55
|
+
@opts
|
81
56
|
end
|
82
57
|
|
83
|
-
|
58
|
+
private
|
84
59
|
|
85
|
-
|
86
|
-
|
60
|
+
#
|
61
|
+
# Site name
|
62
|
+
#
|
63
|
+
# @return {String}
|
64
|
+
#
|
65
|
+
def setup_site_name
|
66
|
+
if @environment.yolo
|
67
|
+
name = Faker::Company.bs.split(" ").sample.downcase
|
68
|
+
else
|
69
|
+
name = @interaction.prompt "What's the site name? (letters, numbers and dashes only)"
|
70
|
+
end
|
87
71
|
|
88
|
-
|
89
|
-
# Clean site name
|
90
|
-
#
|
91
|
-
# @return {String}
|
92
|
-
#
|
93
|
-
def setup_site_name_clean
|
94
|
-
"#{@opts[:site_name]}".gsub(/[^\w]/, "_")[0..10]
|
95
|
-
end
|
72
|
+
validate_site_name name
|
96
73
|
|
97
|
-
|
98
|
-
# Site local location
|
99
|
-
#
|
100
|
-
# @return {String}
|
101
|
-
#
|
102
|
-
def setup_site_location
|
103
|
-
path = "#{Dir.pwd}/"
|
104
|
-
|
105
|
-
if @opts[:use_defaults]
|
106
|
-
location = File.expand_path(path)
|
107
|
-
else
|
108
|
-
location = File.expand_path(@interaction.prompt "Where do you want to setup the site?", :default => path, :path => true)
|
74
|
+
name
|
109
75
|
end
|
110
76
|
|
111
|
-
|
112
|
-
|
77
|
+
#
|
78
|
+
# Clean site name for database naming
|
79
|
+
#
|
80
|
+
# @return {String}
|
81
|
+
#
|
82
|
+
def setup_site_name_clean
|
83
|
+
"#{@opts[:site_name]}".gsub(/[^\w]/, "_")[0..10]
|
84
|
+
end
|
113
85
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
theme = false
|
122
|
-
else
|
123
|
-
themes = {
|
124
|
-
"theme-juice/theme-juice-starter" => "https://github.com/ezekg/theme-juice-starter.git",
|
125
|
-
"other" => nil,
|
126
|
-
"none" => false
|
127
|
-
}
|
86
|
+
#
|
87
|
+
# Site local location
|
88
|
+
#
|
89
|
+
# @return {String}
|
90
|
+
#
|
91
|
+
def setup_site_location
|
92
|
+
path = "#{Dir.pwd}/"
|
128
93
|
|
129
94
|
if @opts[:use_defaults]
|
130
|
-
|
95
|
+
location = File.expand_path(path)
|
96
|
+
else
|
97
|
+
location = File.expand_path(@interaction.prompt "Where do you want to setup the site?", :default => path, :path => true)
|
131
98
|
end
|
132
99
|
|
133
|
-
|
100
|
+
location
|
101
|
+
end
|
134
102
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
103
|
+
#
|
104
|
+
# Site starter theme
|
105
|
+
#
|
106
|
+
# @return {String}
|
107
|
+
#
|
108
|
+
def setup_site_starter_theme
|
109
|
+
if @opts[:site_bare]
|
110
|
+
theme = false
|
111
|
+
else
|
112
|
+
themes = {
|
113
|
+
"theme-juice/theme-juice-starter" => "https://github.com/ezekg/theme-juice-starter.git",
|
114
|
+
"other" => nil,
|
115
|
+
"none" => false
|
116
|
+
}
|
117
|
+
|
118
|
+
if @opts[:use_defaults]
|
119
|
+
return themes["theme-juice/theme-juice-starter"]
|
120
|
+
end
|
121
|
+
|
122
|
+
choice = @interaction.choose "Which starter theme would you like to use?", :blue, themes.keys
|
123
|
+
|
124
|
+
case choice
|
125
|
+
when "theme-juice/theme-juice-starter"
|
126
|
+
@interaction.success "Awesome choice!"
|
127
|
+
when "other"
|
128
|
+
themes[choice] = @interaction.prompt "What is the repository URL for the starter theme that you would like to clone?"
|
129
|
+
when "none"
|
130
|
+
@interaction.notice "Next time you need to create a site without a starter theme, you can just run the 'setup' command instead."
|
131
|
+
@opts[:site_bare] = true
|
132
|
+
end
|
133
|
+
|
134
|
+
theme = themes[choice]
|
143
135
|
end
|
144
136
|
|
145
|
-
theme
|
137
|
+
theme
|
146
138
|
end
|
147
139
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
#
|
156
|
-
def setup_site_dev_location
|
157
|
-
dev_location = File.expand_path("#{@environment.vvv_path}/www/tj-#{@opts[:site_name]}")
|
158
|
-
end
|
159
|
-
|
160
|
-
#
|
161
|
-
# Site development url
|
162
|
-
#
|
163
|
-
# @return {String}
|
164
|
-
#
|
165
|
-
def setup_site_dev_url
|
166
|
-
if @opts[:use_defaults]
|
167
|
-
url = "#{@opts[:site_name]}.dev"
|
168
|
-
else
|
169
|
-
url = @interaction.prompt "What do you want the development url to be? (this should end in '.dev')", :default => "#{@opts[:site_name]}.dev"
|
140
|
+
#
|
141
|
+
# Site development location
|
142
|
+
#
|
143
|
+
# @return {String}
|
144
|
+
#
|
145
|
+
def setup_site_dev_location
|
146
|
+
dev_location = File.expand_path("#{@environment.vvv_path}/www/tj-#{@opts[:site_name]}")
|
170
147
|
end
|
171
148
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
# @return {String}
|
181
|
-
#
|
182
|
-
def setup_site_repository
|
183
|
-
if @opts[:use_defaults] || @opts[:skip_repo]
|
184
|
-
repo = false
|
185
|
-
else
|
186
|
-
if @interaction.agree? "Would you like to initialize a new Git repository?"
|
187
|
-
repo = @interaction.prompt "What is the repository's URL?", :indent => 2
|
149
|
+
#
|
150
|
+
# Site development url
|
151
|
+
#
|
152
|
+
# @return {String}
|
153
|
+
#
|
154
|
+
def setup_site_dev_url
|
155
|
+
if @opts[:use_defaults]
|
156
|
+
url = "#{@opts[:site_name]}.dev"
|
188
157
|
else
|
189
|
-
|
158
|
+
url = @interaction.prompt "What do you want the development url to be? (this should end in '.dev')", :default => "#{@opts[:site_name]}.dev"
|
190
159
|
end
|
160
|
+
|
161
|
+
validate_site_dev_url url
|
162
|
+
|
163
|
+
url
|
191
164
|
end
|
192
165
|
|
193
|
-
|
194
|
-
|
166
|
+
#
|
167
|
+
# Site repository
|
168
|
+
#
|
169
|
+
# @return {String}
|
170
|
+
#
|
171
|
+
def setup_site_repository
|
172
|
+
if @opts[:use_defaults] || @opts[:skip_repo]
|
173
|
+
repo = false
|
174
|
+
else
|
175
|
+
if @interaction.agree? "Would you like to initialize a new Git repository?"
|
176
|
+
repo = @interaction.prompt "What is the repository's URL?", :indent => 2
|
177
|
+
else
|
178
|
+
repo = false
|
179
|
+
end
|
180
|
+
end
|
195
181
|
|
196
|
-
|
197
|
-
# Database host
|
198
|
-
#
|
199
|
-
# @return {String}
|
200
|
-
#
|
201
|
-
def setup_site_db_host
|
202
|
-
if @opts[:use_defaults] || @opts[:skip_db]
|
203
|
-
db_host = "vvv"
|
204
|
-
else
|
205
|
-
db_host = @interaction.prompt "Database host", :default => "vvv"
|
182
|
+
repo
|
206
183
|
end
|
207
184
|
|
208
|
-
|
209
|
-
|
185
|
+
#
|
186
|
+
# Database host
|
187
|
+
#
|
188
|
+
# @return {String}
|
189
|
+
#
|
190
|
+
def setup_site_db_host
|
191
|
+
if @opts[:use_defaults] || @opts[:skip_db]
|
192
|
+
db_host = "vvv"
|
193
|
+
else
|
194
|
+
db_host = @interaction.prompt "Database host", :default => "vvv"
|
195
|
+
end
|
210
196
|
|
211
|
-
|
212
|
-
# Database name
|
213
|
-
#
|
214
|
-
# @return {String}
|
215
|
-
#
|
216
|
-
def setup_site_db_name
|
217
|
-
if @opts[:use_defaults] || @opts[:skip_db]
|
218
|
-
db_name = "#{@opts[:site_name_clean]}_db"
|
219
|
-
else
|
220
|
-
db_name = @interaction.prompt "Database name", :default => "#{@opts[:site_name_clean]}_db"
|
197
|
+
db_host
|
221
198
|
end
|
222
199
|
|
223
|
-
|
224
|
-
|
200
|
+
#
|
201
|
+
# Database name
|
202
|
+
#
|
203
|
+
# @return {String}
|
204
|
+
#
|
205
|
+
def setup_site_db_name
|
206
|
+
if @opts[:use_defaults] || @opts[:skip_db]
|
207
|
+
db_name = "#{@opts[:site_name_clean]}_db"
|
208
|
+
else
|
209
|
+
db_name = @interaction.prompt "Database name", :default => "#{@opts[:site_name_clean]}_db"
|
210
|
+
end
|
225
211
|
|
226
|
-
|
227
|
-
# Database username
|
228
|
-
#
|
229
|
-
# @return {String}
|
230
|
-
#
|
231
|
-
def setup_site_db_user
|
232
|
-
if @opts[:use_defaults] || @opts[:skip_db]
|
233
|
-
db_user = "#{@opts[:site_name_clean]}_user"
|
234
|
-
else
|
235
|
-
db_user = @interaction.prompt "Database username", :default => "#{@opts[:site_name_clean]}_user"
|
212
|
+
db_name
|
236
213
|
end
|
237
214
|
|
238
|
-
|
239
|
-
|
215
|
+
#
|
216
|
+
# Database username
|
217
|
+
#
|
218
|
+
# @return {String}
|
219
|
+
#
|
220
|
+
def setup_site_db_user
|
221
|
+
if @opts[:use_defaults] || @opts[:skip_db]
|
222
|
+
db_user = "#{@opts[:site_name_clean]}_user"
|
223
|
+
else
|
224
|
+
db_user = @interaction.prompt "Database username", :default => "#{@opts[:site_name_clean]}_user"
|
225
|
+
end
|
240
226
|
|
241
|
-
|
242
|
-
# Database password
|
243
|
-
#
|
244
|
-
# @return {String}
|
245
|
-
#
|
246
|
-
def setup_site_db_pass
|
247
|
-
pass = Faker::Internet.password 24
|
248
|
-
|
249
|
-
if @opts[:use_defaults] || @opts[:skip_db]
|
250
|
-
db_pass = pass
|
251
|
-
else
|
252
|
-
db_pass = @interaction.prompt "Database password", :default => pass
|
227
|
+
db_user
|
253
228
|
end
|
254
229
|
|
255
|
-
|
256
|
-
|
230
|
+
#
|
231
|
+
# Database password
|
232
|
+
#
|
233
|
+
# @return {String}
|
234
|
+
#
|
235
|
+
def setup_site_db_pass
|
236
|
+
pass = Faker::Internet.password 24
|
237
|
+
|
238
|
+
if @opts[:use_defaults] || @opts[:skip_db]
|
239
|
+
db_pass = pass
|
240
|
+
else
|
241
|
+
db_pass = @interaction.prompt "Database password", :default => pass
|
242
|
+
end
|
257
243
|
|
258
|
-
|
259
|
-
# Validate site name
|
260
|
-
#
|
261
|
-
# @param {String} name
|
262
|
-
#
|
263
|
-
# @return {Void}
|
264
|
-
#
|
265
|
-
def validate_site_name(name)
|
266
|
-
if name.empty?
|
267
|
-
@interaction.error "Site name '#{name}' is invalid or empty. Aborting mission."
|
244
|
+
db_pass
|
268
245
|
end
|
269
246
|
|
270
|
-
|
271
|
-
|
247
|
+
#
|
248
|
+
# Validate site name
|
249
|
+
#
|
250
|
+
# @param {String} name
|
251
|
+
#
|
252
|
+
# @return {Void}
|
253
|
+
#
|
254
|
+
def validate_site_name(name)
|
255
|
+
if name.empty?
|
256
|
+
@interaction.error "Site name '#{name}' is invalid or empty. Aborting mission."
|
257
|
+
end
|
258
|
+
|
259
|
+
"#{name}".match /[^0-9A-Za-z.\-]/ do |char|
|
260
|
+
@interaction.error "Site name contains an invalid character '#{char}'. This name is used for creating directories, so that's not gonna work. Aborting mission."
|
261
|
+
end
|
272
262
|
end
|
273
|
-
end
|
274
263
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
264
|
+
#
|
265
|
+
# Validate site url
|
266
|
+
#
|
267
|
+
# @param {String} url
|
268
|
+
#
|
269
|
+
# @return {Void}
|
270
|
+
#
|
271
|
+
def validate_site_dev_url(url)
|
272
|
+
unless "#{url}".match /(.dev)$/
|
273
|
+
@interaction.error "Your development url '#{url}' doesn't end with '.dev'. This is used internally by Landrush, so that's not gonna work. Aborting mission."
|
274
|
+
end
|
285
275
|
end
|
286
276
|
end
|
287
277
|
end
|
@@ -1,58 +1,48 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module ThemeJuice
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
# Set up interactions and environment
|
8
|
-
#
|
9
|
-
# @return {Void}
|
10
|
-
#
|
11
|
-
def initialize
|
12
|
-
@environment = ::ThemeJuice::Environment
|
13
|
-
@interaction = ::ThemeJuice::Interaction
|
14
|
-
end
|
4
|
+
module Interaction::Delete
|
15
5
|
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
# @param {Hash} opts
|
20
|
-
#
|
21
|
-
# @return {Hash}
|
22
|
-
#
|
23
|
-
def get_site_options(opts = {})
|
24
|
-
@opts = opts
|
25
|
-
|
26
|
-
required_opts = [
|
27
|
-
:site_name,
|
28
|
-
:site_dev_location
|
29
|
-
]
|
30
|
-
|
31
|
-
required_opts.each do |opt|
|
32
|
-
@opts[opt] = self.send "get_#{opt}" unless @opts[opt]
|
33
|
-
end
|
6
|
+
@environment = ::ThemeJuice::Environment
|
7
|
+
@interaction = ::ThemeJuice::Interaction
|
34
8
|
|
35
|
-
|
36
|
-
end
|
9
|
+
class << self
|
37
10
|
|
38
|
-
|
11
|
+
#
|
12
|
+
# Get needed site options
|
13
|
+
#
|
14
|
+
# @param {Hash} opts
|
15
|
+
#
|
16
|
+
# @return {Hash}
|
17
|
+
#
|
18
|
+
def get_site_options(opts = {})
|
19
|
+
@opts = opts
|
39
20
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
21
|
+
@opts[:site_name] ||= get_site_name
|
22
|
+
@opts[:site_dev_location] ||= get_site_dev_location
|
23
|
+
|
24
|
+
@opts
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
48
28
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
29
|
+
#
|
30
|
+
# Site name
|
31
|
+
#
|
32
|
+
# @return {String}
|
33
|
+
#
|
34
|
+
def get_site_name
|
35
|
+
name = @interaction.choose "Which site would you like to delete?", :red, ::ThemeJuice::Service::List.new.get_sites
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Site development location
|
40
|
+
#
|
41
|
+
# @return {String}
|
42
|
+
#
|
43
|
+
def get_site_dev_location
|
44
|
+
dev_location = File.expand_path("#{@environment.vvv_path}/www/tj-#{@opts[:site_name]}")
|
45
|
+
end
|
56
46
|
end
|
57
47
|
end
|
58
48
|
end
|
@@ -3,14 +3,10 @@
|
|
3
3
|
module ThemeJuice
|
4
4
|
class Interaction::TeeJay
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
def initialize
|
12
|
-
@environment = ::ThemeJuice::Environment
|
13
|
-
@interaction = ::ThemeJuice::Interaction
|
6
|
+
@environment = ::ThemeJuice::Environment
|
7
|
+
@interaction = ::ThemeJuice::Interaction
|
8
|
+
|
9
|
+
class << self
|
14
10
|
end
|
15
11
|
end
|
16
12
|
end
|
@@ -7,8 +7,7 @@ module ThemeJuice
|
|
7
7
|
# @param {Hash} opts
|
8
8
|
#
|
9
9
|
def initialize(opts = {})
|
10
|
-
opts = ::ThemeJuice::Interaction::Create.
|
11
|
-
|
10
|
+
opts = ::ThemeJuice::Interaction::Create.setup_site_options(opts)
|
12
11
|
super
|
13
12
|
end
|
14
13
|
|
@@ -60,13 +59,14 @@ module ThemeJuice
|
|
60
59
|
"Database password: #{@opts[:site_db_pass]}"
|
61
60
|
]
|
62
61
|
|
63
|
-
|
64
|
-
|
62
|
+
@interaction.speak "Do you want to open up your new site 'http://#{@opts[:site_dev_url]}' now? (y/N)", {
|
63
|
+
:color => [:black, :on_blue],
|
64
|
+
:icon => :restart,
|
65
|
+
:row => true
|
66
|
+
}
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
:simple => true
|
69
|
-
}
|
68
|
+
if @interaction.agree? "", { :simple => true }
|
69
|
+
run ["open http://#{@opts[:site_dev_url]}"]
|
70
70
|
end
|
71
71
|
end
|
72
72
|
else
|
@@ -75,7 +75,7 @@ module ThemeJuice
|
|
75
75
|
end
|
76
76
|
else
|
77
77
|
@interaction.error "Setup failed. Running cleanup" do
|
78
|
-
::ThemeJuice::Service::Delete.new({ site_name
|
78
|
+
::ThemeJuice::Service::Delete.new({ :site_name => @opts[:site_name], :restart => false }).delete
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
data/lib/theme-juice/version.rb
CHANGED
data/lib/theme-juice.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.6.
|
4
|
+
version: 0.6.13
|
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-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faker
|