theme-juice 0.1.7 → 0.1.8

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: 059ce849fd1f2d505d1e6daedf3985ad7600a99e
4
- data.tar.gz: cf312295ddf93aceba229ed411c473c033f94e4b
3
+ metadata.gz: a53e76ff764ee9274d0607d7fd2095100260df47
4
+ data.tar.gz: 4185a029dd165675c3bd7d36173b7760babe5de3
5
5
  SHA512:
6
- metadata.gz: fb0e8d619dcf9c11bbe1b99b5b18dc0f321a48b7fbb28d86fc2289e71ab6d49f3f994278662befa81be3532877b7730912ce9156007aad6ca0b6c0738b364335
7
- data.tar.gz: 412a4434a2388fc22985ea52f61cb28ff4f8cad134d0883560412375cc91ddb8aee1298a5b240f721e3276bee8efea60460d21744775300d63a77788dc2e7ac4
6
+ metadata.gz: 0d96f30c99459f8e173e7422e336506f32b397dbf60a0f67d5fc21d8fa33e80a5a96c93ec79a2d9c36452880912cbfd9a40f27d6d2cb0025c405009921917526
7
+ data.tar.gz: b6fcb290f8770f46b55bc943402832ade82e9efcea9c9ca83278e62aeb11dc0006080f2161d8eb8e7a664f96366904c67fe7a1f6509dbd8cc68f89368659d886
@@ -63,7 +63,7 @@ module ThemeJuice
63
63
  end
64
64
 
65
65
  # ask for the Site name if not passed directly
66
- site ||= ask "What's the site name? (only ascii characters are allowed) :", :green
66
+ site ||= ask "What's the site name? (only ascii characters are allowed) :", :blue
67
67
 
68
68
  if site.match /[^0-9A-Za-z.\-]/
69
69
  say "Site name contains invalid non-ascii characters. This name is used for creating directories, so that's not gonna work. Aborting mission.", :red
@@ -80,7 +80,7 @@ module ThemeJuice
80
80
  ###
81
81
  # Location of site installation
82
82
  ###
83
- site_location = ask "Where do you want to setup the site? :", :green,
83
+ site_location = ask "Where do you want to setup the site? :", :blue,
84
84
  default: "#{Dir.pwd}/",
85
85
  path: true
86
86
 
@@ -92,7 +92,7 @@ module ThemeJuice
92
92
 
93
93
  starter_theme = nil
94
94
 
95
- say "Which starter theme would you like to use? :", :green
95
+ say "Which starter theme would you like to use? :", :blue
96
96
  choose do |menu|
97
97
  menu.index_suffix = ") "
98
98
 
@@ -102,7 +102,7 @@ module ThemeJuice
102
102
  end
103
103
 
104
104
  menu.choice "other" do
105
- starter_theme = ask "What is the user/repository of the starter theme you would like to clone? :", :green
105
+ starter_theme = ask "What is the user/repository of the starter theme you would like to clone? :", :blue
106
106
  end
107
107
 
108
108
  menu.choice "none" do |c|
@@ -115,7 +115,7 @@ module ThemeJuice
115
115
  ###
116
116
  # Development url
117
117
  ###
118
- dev_url = ask "What do you want the development url to be? (this should end in '.dev') :", :green,
118
+ dev_url = ask "What do you want the development url to be? (this should end in '.dev') :", :blue,
119
119
  default: "#{site}.dev"
120
120
 
121
121
  unless dev_url.match /(.dev)$/
@@ -126,8 +126,8 @@ module ThemeJuice
126
126
  ###
127
127
  # Initialize a git repository on setup
128
128
  ###
129
- if yes? "Would you like to initialize a new Git repository? (y/N) :", :green
130
- repository = ask "Remote URL :", :green
129
+ if yes? "Would you like to initialize a new Git repository? (y/N) :", :blue
130
+ repository = ask "What is the repository's URL? :", :blue
131
131
  else
132
132
  repository = false
133
133
  end
@@ -135,25 +135,25 @@ module ThemeJuice
135
135
  ###
136
136
  # Database host
137
137
  ###
138
- db_host = ask "Database host :", :green,
138
+ db_host = ask "Database host :", :blue,
139
139
  default: "vvv"
140
140
 
141
141
  ###
142
142
  # Database name
143
143
  ###
144
- db_name = ask "Database name :", :green,
144
+ db_name = ask "Database name :", :blue,
145
145
  default: "#{clean_site_name}_db"
146
146
 
147
147
  ###
148
148
  # Database username
149
149
  ###
150
- db_user = ask "Database username :", :green,
150
+ db_user = ask "Database username :", :blue,
151
151
  default: "#{clean_site_name}_user"
152
152
 
153
153
  ###
154
154
  # Database password
155
155
  ###
156
- db_pass = ask "Database password :", :green,
156
+ db_pass = ask "Database password :", :blue,
157
157
  default: SecureRandom.base64
158
158
 
159
159
  ###
@@ -88,16 +88,16 @@ module ThemeJuice
88
88
 
89
89
  # Output setup info
90
90
  say "Here's your installation info:", :yellow
91
- say "Site name: #{@opts[:site_name]}", :green
92
- say "Site location: #{@opts[:site_location]}", :green
93
- say "Starter theme: #{@opts[:starter_theme]}", :green
94
- say "Development location: #{@opts[:dev_location]}", :green
95
- say "Development url: http://#{@opts[:dev_url]}", :green
96
- say "Initialized repository: #{@opts[:repository]}", :green
97
- say "Database host: #{@opts[:db_host]}", :green
98
- say "Database name: #{@opts[:db_name]}", :green
99
- say "Database username: #{@opts[:db_user]}", :green
100
- say "Database password: #{@opts[:db_pass]}", :green
91
+ say "Site name: #{@opts[:site_name]}", :blue
92
+ say "Site location: #{@opts[:site_location]}", :blue
93
+ say "Starter theme: #{@opts[:starter_theme]}", :blue
94
+ say "Development location: #{@opts[:dev_location]}", :blue
95
+ say "Development url: http://#{@opts[:dev_url]}", :blue
96
+ say "Initialized repository: #{@opts[:repository]}", :blue
97
+ say "Database host: #{@opts[:db_host]}", :blue
98
+ say "Database name: #{@opts[:db_name]}", :blue
99
+ say "Database username: #{@opts[:db_user]}", :blue
100
+ say "Database password: #{@opts[:db_pass]}", :blue
101
101
  end
102
102
  else
103
103
  say "Setup failed. Running cleanup...", :red
@@ -176,6 +176,21 @@ module ThemeJuice
176
176
 
177
177
  private
178
178
 
179
+ ###
180
+ # Run system commands
181
+ #
182
+ # @param {Array} commands
183
+ # Array of commands to run
184
+ # @param {Bool} silent (true)
185
+ # Silence all output from command
186
+ #
187
+ # @return {Void}
188
+ ###
189
+ def run(commands = [], silent = true)
190
+ commands.map! { |cmd| cmd.to_s + " > /dev/null 2>&1" } if silent
191
+ system commands.join "&&"
192
+ end
193
+
179
194
  ###
180
195
  # Restart Vagrant
181
196
  #
@@ -186,11 +201,11 @@ module ThemeJuice
186
201
  # @return {Void}
187
202
  ###
188
203
  def restart_vagrant
189
- system [
204
+ run [
190
205
  "cd ~/vagrant",
191
206
  "vagrant halt",
192
- "vagrant up --provision"
193
- ].join " && "
207
+ "vagrant up --provision",
208
+ ], false
194
209
  end
195
210
 
196
211
  ###
@@ -285,19 +300,19 @@ module ThemeJuice
285
300
  end
286
301
 
287
302
  ###
288
- # Install plugins and clone VVV
303
+ # Install Vagrant plugins and clone VVV
289
304
  #
290
305
  # @return {Void}
291
306
  ###
292
307
  def setup_vvv
293
308
  say "Installing VVV into '#{File.expand_path("~/vagrant")}'...", :yellow
294
- system [
309
+ run [
295
310
  "vagrant plugin install vagrant-hostsupdater",
296
311
  "vagrant plugin install vagrant-triggers",
297
312
  "vagrant plugin install landrush",
298
313
  "git clone https://github.com/Varying-Vagrant-Vagrants/VVV.git ~/vagrant",
299
314
  "cd ~/vagrant/database && touch init-custom.sql"
300
- ].join " && "
315
+ ]
301
316
 
302
317
  setup_wildcard_subdomains
303
318
  end
@@ -334,10 +349,10 @@ module ThemeJuice
334
349
  ###
335
350
  def setup_dev_site
336
351
  say "Setting up new development site at '#{@opts[:dev_location]}'...", :yellow
337
- system [
352
+ run [
338
353
  "cd ~/vagrant/www",
339
- "mkdir tj-#{@opts[:site_name]}"
340
- ].join " && "
354
+ "mkdir tj-#{@opts[:site_name]}",
355
+ ]
341
356
  end
342
357
 
343
358
  ###
@@ -436,15 +451,27 @@ module ThemeJuice
436
451
  say "Setting up WordPress...", :yellow
437
452
 
438
453
  if @opts[:bare_setup]
454
+
439
455
  # Create theme dir
440
- system "mkdir -p #{@opts[:site_location]}"
456
+ run [
457
+ "mkdir -p #{@opts[:site_location]}",
458
+ ]
459
+
441
460
  else
442
- # Clone starter, install WP
443
- system [
444
- "mkdir -p #{@opts[:site_location]} && cd $_",
461
+
462
+ # Clone starter theme
463
+ run [
464
+ "mkdir -p #{@opts[:site_location]}",
465
+ "cd #{@opts[:site_location]}",
445
466
  "git clone --depth 1 https://github.com/#{@opts[:starter_theme]}.git .",
467
+ ]
468
+
469
+ # Install composer dependencies
470
+ run [
471
+ "cd #{@opts[:site_location]}",
446
472
  "composer install",
447
- ].join " && "
473
+ ], false
474
+
448
475
  end
449
476
  end
450
477
 
@@ -479,17 +506,17 @@ module ThemeJuice
479
506
  say "Setting up Git repository at '#{@opts[:repository]}'...", :yellow
480
507
 
481
508
  if repo_is_setup?
482
- system [
509
+ run [
483
510
  "cd #{@opts[:site_location]}",
484
511
  "rm -rf .git",
485
- ].join " && "
512
+ ]
486
513
  end
487
514
 
488
- system [
515
+ run [
489
516
  "cd #{@opts[:site_location]}",
490
517
  "git init",
491
- "git remote add origin #{@opts[:repository]}"
492
- ].join " && "
518
+ "git remote add origin #{@opts[:repository]}",
519
+ ]
493
520
  end
494
521
 
495
522
  ##
@@ -518,7 +545,7 @@ module ThemeJuice
518
545
  ###
519
546
  def remove_dev_site
520
547
  if system "rm -rf #{@opts[:dev_location]}"
521
- say "VVV installation for '#{@opts[:site_name]}' successfully removed.", :green
548
+ say "VVV installation for '#{@opts[:site_name]}' successfully removed.", :yellow
522
549
  else
523
550
  say "Theme '#{@opts[:site_name]}' could not be removed. Make sure you have write capabilities.", :red
524
551
  end
@@ -531,7 +558,7 @@ module ThemeJuice
531
558
  ###
532
559
  def remove_database
533
560
  if remove_traces_from_file "~/vagrant/database/init-custom.sql"
534
- say "Database for '#{@opts[:site_name]}' successfully removed.", :green
561
+ say "Database for '#{@opts[:site_name]}' successfully removed.", :yellow
535
562
  end
536
563
  end
537
564
 
@@ -542,7 +569,7 @@ module ThemeJuice
542
569
  ###
543
570
  def remove_synced_folder
544
571
  if remove_traces_from_file "~/vagrant/Vagrantfile"
545
- say "Synced folders for '#{@opts[:site_name]}' successfully removed.", :green
572
+ say "Synced folders for '#{@opts[:site_name]}' successfully removed.", :yellow
546
573
  end
547
574
  end
548
575
 
@@ -1,3 +1,3 @@
1
1
  module ThemeJuice
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  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.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezekiel Gabrielse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-12 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor