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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 236d1860b3a9b9570d92de72d33415e9f518509f
4
- data.tar.gz: 8adc03ca3f6e57a2e5bb0488fb50c1f183dac5c9
3
+ metadata.gz: b1ec1d079ea72b80319db439459fd0a7d5ab0dbe
4
+ data.tar.gz: 129075f275d74a94cf237a44fc878c67c560a286
5
5
  SHA512:
6
- metadata.gz: 271ce4f26c47d41c7854e4b3a70b3f302581431c8a802f4fc6bc53522781833cb2f8cd7251d426a2c8f28e7d82450152421889d9de7697f362fd30ce74e766ef
7
- data.tar.gz: 71246886e711f558117cac03c12b6dc83a74efc6d302c3a5e4a6571c43d01063fd4c5fb109382a7230a204e3ea6d9f8f453469e3e9388c5cc7ed284015d1438a
6
+ metadata.gz: 227ab16e983253316a6b8c665c20f5755fa8ec4e604e8d17e7b40517756409a2c7901bc5d9b86cd3179caa1f525fb3e424acb05e050d8230e473aa981eac5b71
7
+ data.tar.gz: c7ca67087eca3df42cdc681b941e57dc9ebffa76c34980beabb2b0d0959be85c23787ca2f0d4ce6bbe52c94237a30b7fec3ec1cdeebfd9fb295fcb5795ae3502
@@ -6,15 +6,15 @@ module ThemeJuice
6
6
  #
7
7
  # Command aliases
8
8
  #
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
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]
@@ -5,6 +5,11 @@ module ThemeJuice
5
5
  include ::Thor::Actions
6
6
  include ::Thor::Shell
7
7
 
8
+ #
9
+ # @param {Hash} opts
10
+ #
11
+ # @return {Void}
12
+ #
8
13
  def initialize(opts = {})
9
14
  @environment = ::ThemeJuice::Environment
10
15
  @interaction = ::ThemeJuice::Interaction
@@ -10,7 +10,6 @@ module ThemeJuice
10
10
  #
11
11
  def initialize(opts = {})
12
12
  super
13
-
14
13
  ::ThemeJuice::Service::Create.new(@opts).create
15
14
  end
16
15
  end
@@ -10,7 +10,6 @@ module ThemeJuice
10
10
  #
11
11
  def initialize(opts = {})
12
12
  super
13
-
14
13
  ::ThemeJuice::Service::Delete.new(@opts).delete
15
14
  end
16
15
  end
@@ -10,7 +10,6 @@ module ThemeJuice
10
10
  #
11
11
  def initialize(opts = {})
12
12
  super
13
-
14
13
  ::ThemeJuice::Service::Config.new.install
15
14
  end
16
15
  end
@@ -10,7 +10,6 @@ module ThemeJuice
10
10
  #
11
11
  def initialize(opts = {})
12
12
  super
13
-
14
13
  ::ThemeJuice::Service::List.new.list
15
14
  end
16
15
  end
@@ -10,8 +10,7 @@ module ThemeJuice
10
10
  #
11
11
  def initialize(opts = {})
12
12
  super
13
-
14
- ::ThemeJuice::Service::Config.new.subcommand @opts[:subcommand], @opts[:commands]
13
+ ::ThemeJuice::Service::Config.new.subcommand(@opts[:subcommand], @opts[:commands])
15
14
  end
16
15
  end
17
16
  end
@@ -102,7 +102,6 @@ module ThemeJuice
102
102
  # @return {Bool}
103
103
  #
104
104
  def agree?(question, opts = {})
105
-
106
105
  format_message question, {
107
106
  :color => opts[:color] || :blue,
108
107
  :icon => :question
@@ -1,287 +1,277 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module ThemeJuice
4
- class Interaction::Create
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
- # Set up needed site options
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
- required_opts = [
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
- # Verify that all the options are correct
49
- @interaction.list "Your settings :", :yellow, [
50
- "Site name: #{@opts[:site_name]}",
51
- "Site location: #{@opts[:site_location]}",
52
- "Starter theme: #{@opts[:site_starter_theme]}",
53
- "Development location: #{@opts[:site_dev_location]}",
54
- "Development url: http://#{@opts[:site_dev_url]}",
55
- "Initialized repository: #{@opts[:site_repository]}",
56
- "Database host: #{@opts[:site_db_host]}",
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
- @opts
67
- end
21
+ if @environment.yolo
22
+ @opts[:use_defaults] = true
23
+ end
68
24
 
69
- private
70
-
71
- #
72
- # Site name
73
- #
74
- # @return {String}
75
- #
76
- def setup_site_name
77
- if @environment.yolo
78
- name = Faker::Company.bs.split(" ").sample.downcase
79
- else
80
- name = @interaction.prompt "What's the site name? (letters, numbers and dashes only)"
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
- validate_site_name name
58
+ private
84
59
 
85
- name
86
- end
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
- location
112
- end
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
- # Site starter theme
116
- #
117
- # @return {String}
118
- #
119
- def setup_site_starter_theme
120
- if @opts[:site_bare]
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
- return themes["theme-juice/theme-juice-starter"]
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
- choice = @interaction.choose "Which starter theme would you like to use?", :blue, themes.keys
100
+ location
101
+ end
134
102
 
135
- case choice
136
- when "theme-juice/theme-juice-starter"
137
- @interaction.success "Awesome choice!"
138
- when "other"
139
- themes[choice] = @interaction.prompt "What is the repository URL for the starter theme that you would like to clone?"
140
- when "none"
141
- @interaction.notice "Next time you need to create a site without a starter theme, you can just run the 'setup' command instead."
142
- @opts[:site_bare] = true
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 = themes[choice]
137
+ theme
146
138
  end
147
139
 
148
- theme
149
- end
150
-
151
- #
152
- # Site development location
153
- #
154
- # @return {String}
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
- validate_site_dev_url url
173
-
174
- url
175
- end
176
-
177
- #
178
- # Site repository
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
- repo = false
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
- repo
194
- end
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
- db_host
209
- end
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
- db_name
224
- end
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
- db_user
239
- end
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
- db_pass
256
- end
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
- "#{name}".match /[^0-9A-Za-z.\-]/ do |char|
271
- @interaction.error "Site name contains an invalid character '#{char}'. This name is used for creating directories, so that's not gonna work. Aborting mission."
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
- # Validate site url
277
- #
278
- # @param {String} url
279
- #
280
- # @return {Void}
281
- #
282
- def validate_site_dev_url(url)
283
- unless "#{url}".match /(.dev)$/
284
- @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."
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
- class Interaction::Delete
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
- # Get needed site options
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
- @opts
36
- end
9
+ class << self
37
10
 
38
- private
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
- # Site name
42
- #
43
- # @return {String}
44
- #
45
- def get_site_name
46
- name = @interaction.choose "Which site would you like to delete?", :red, ::ThemeJuice::Service::List.new.get_sites
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
- # Site development location
51
- #
52
- # @return {String}
53
- #
54
- def get_site_dev_location
55
- dev_location = File.expand_path("#{@environment.vvv_path}/www/tj-#{@opts[:site_name]}")
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
- # Set up interactions and environment
8
- #
9
- # @return {Void}
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.new.setup_site_options(opts)
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
- unless OS.windows?
64
- @interaction.notice "Do you want to open up your new site 'http://#{@opts[:site_dev_url]}' now? (y/N)"
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
- run ["open http://#{@opts[:site_dev_url]}"] if @interaction.agree? "", {
67
- :color => :yellow,
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: @opts[:site_name], :restart => false }).delete
78
+ ::ThemeJuice::Service::Delete.new({ :site_name => @opts[:site_name], :restart => false }).delete
79
79
  end
80
80
  end
81
81
  end
@@ -7,8 +7,7 @@ module ThemeJuice
7
7
  # @param {Hash} opts
8
8
  #
9
9
  def initialize(opts)
10
- opts = ThemeJuice::Interaction::Delete.new.get_site_options(opts)
11
-
10
+ opts = ThemeJuice::Interaction::Delete.get_site_options(opts)
12
11
  super
13
12
  end
14
13
 
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module ThemeJuice
4
- VERSION = "0.6.12"
4
+ VERSION = "0.6.13"
5
5
  end
data/lib/theme-juice.rb CHANGED
@@ -6,7 +6,6 @@ require "fileutils"
6
6
  require "pathname"
7
7
  require "tempfile"
8
8
  require "yaml"
9
- require "os"
10
9
 
11
10
  module ThemeJuice
12
11
  end
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.12
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-16 00:00:00.000000000 Z
11
+ date: 2015-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faker