obbistrano 1.1.96 → 1.1.98

Sign up to get free protection for your applications and to get access to all the features.
@@ -109,10 +109,12 @@ Capistrano::Configuration.instance(:must_exist).load do
109
109
 
110
110
  task :git_deploy, :roles =>[:web] do
111
111
  logger.level = 2
112
+ pretty_print "Application being updated on branch #{branch}"
112
113
 
113
114
  set :local_branch, $1 if `git branch` =~ /\* (\S+)\s/m
114
115
  if !local_branch.eql? branch
115
116
  logger.info "You are on branch #{local_branch}, not #{branch}, please check out there before deploying to be able to combine the correct js and css files."
117
+ puts_fail
116
118
  exit
117
119
  end
118
120
 
@@ -124,10 +126,12 @@ Capistrano::Configuration.instance(:must_exist).load do
124
126
  logger.level = -1
125
127
  begin
126
128
  run "ls #{deploy_to}/.git"
129
+ puts_ok
127
130
  rescue
128
131
  run "mkdir -p #{deploy_to}"
129
132
  run "cd #{deploy_to} && git init"
130
133
  run "cd #{deploy_to} && git remote add origin #{repository}"
134
+ puts_ok
131
135
  end
132
136
  logger.level = 2
133
137
 
@@ -143,7 +147,6 @@ Capistrano::Configuration.instance(:must_exist).load do
143
147
  end
144
148
  end
145
149
 
146
- logger.info "Application has been updated on branch #{branch}"
147
150
  end
148
151
 
149
152
  task :svn_deploy, :roles =>[:web] do
@@ -152,6 +155,8 @@ Capistrano::Configuration.instance(:must_exist).load do
152
155
 
153
156
  task :cms_deploy, :roles =>[:web] do
154
157
  logger.level = -1
158
+ pretty_print "--> Updating Wildfire CMS on branch #{cms}"
159
+
155
160
  run "mkdir -p #{deploy_to}/plugins/cms"
156
161
  begin
157
162
  run "ls #{deploy_to}/plugins/cms/.git/"
@@ -170,13 +175,14 @@ Capistrano::Configuration.instance(:must_exist).load do
170
175
  run "cd #{deploy_to}/plugins/cms && git checkout #{cms}"
171
176
  end
172
177
  run "cd #{deploy_to}/plugins/cms && git pull origin #{cms}"
178
+ puts_ok
173
179
  logger.level = 2
174
- logger.info "Wildfire CMS has been updated on branch #{cms}"
175
180
  end
176
181
 
177
182
 
178
183
  task :php_wax_deploy, :roles =>[:web] do
179
184
  logger.level = -1
185
+ pretty_print "--> Updating PHP Wax has been updated on branch #{phpwax}"
180
186
  run "mkdir -p #{deploy_to}/wax"
181
187
  begin
182
188
  run "ls #{deploy_to}/wax/.git/"
@@ -191,12 +197,12 @@ Capistrano::Configuration.instance(:must_exist).load do
191
197
  logger.level = -1
192
198
  begin
193
199
  run "cd #{deploy_to}/wax && git checkout -b #{phpwax} origin/#{phpwax}"
200
+ puts_ok
194
201
  rescue
195
202
  run "cd #{deploy_to}/wax && git checkout #{phpwax}"
196
203
  end
197
204
  run "cd #{deploy_to}/wax && git pull origin #{phpwax}"
198
205
  logger.level = 3
199
- logger.info "PHP Wax has been updated on branch #{phpwax}"
200
206
  end
201
207
 
202
208
 
@@ -206,7 +212,13 @@ Capistrano::Configuration.instance(:must_exist).load do
206
212
 
207
213
  desc "Clears the application's cache files from tmp/cache."
208
214
  task :clearcache, :roles =>[:web] do
209
- run "cd #{deploy_to} && find tmp/cache -type f -exec rm -f \"{}\" \\;"
215
+ pretty_print "--> Clearing application cache directory"
216
+ begin
217
+ run "cd #{deploy_to} && find tmp/cache -type f -exec rm -f \"{}\" \\;"
218
+ puts_ok
219
+ rescue
220
+ puts_fail
221
+ end
210
222
  end
211
223
 
212
224
  desc "Clears the application's log files from tmp/log."
@@ -342,14 +354,17 @@ Capistrano::Configuration.instance(:must_exist).load do
342
354
  needs_root
343
355
  set :user_to_add, "#{user}"
344
356
  set :passwd_to_add, "#{password}"
357
+ pretty_print "--> Creating mysql user"
345
358
  with_user("root", "#{root_pass}") do
346
359
  "#{databases}".each do |db|
347
360
  begin
348
361
  run "mysql -uroot -p#{root_pass} -e \"CREATE USER '#{user_to_add}'@'localhost' IDENTIFIED BY '#{passwd_to_add}';\""
349
362
  run "mysql -uroot -p#{root_pass} -e 'CREATE DATABASE #{db}'"
350
363
  run "mysql -uroot -p#{root_pass} -e \"GRANT ALL PRIVILEGES ON #{db}.* TO '#{user_to_add}'@'localhost' IDENTIFIED BY '#{passwd_to_add}';\""
364
+ puts_ok
351
365
  rescue
352
366
  logger.info "Database #{db} already exists"
367
+ puts_fail
353
368
  end
354
369
  end
355
370
  end
@@ -388,7 +403,8 @@ Capistrano::Configuration.instance(:must_exist).load do
388
403
  end
389
404
 
390
405
  task :needs_root do
391
- puts "==> This operation needs root access - Please set a root password inside your /etc/capistrano.conf file".red if !defined? "#{root_pass}"
406
+ pretty_print "--> This operation needs root access - Please set a root password inside your /etc/capistrano.conf file".red if !defined? "#{root_pass}"
407
+ puts_fail if !defined? "#{root_pass}"
392
408
  exit if !defined? "#{root_pass}"
393
409
  config_check
394
410
  end
@@ -397,11 +413,13 @@ Capistrano::Configuration.instance(:must_exist).load do
397
413
  config_check
398
414
  begin
399
415
  run "ls"
400
- puts "Logged in ok"
416
+ pretty_print "Logged in ok"
417
+ puts_ok
401
418
  rescue
402
419
  print "==== The user does not yet exist. Would you like to create? [Y/N]"
403
420
  line = STDIN.gets.upcase.strip
404
421
  puts "==> Could not continue as the login does not exist" if line !="Y".red
422
+ puts_fail
405
423
  exit if line != "Y"
406
424
  setup_user
407
425
  end
@@ -483,18 +501,16 @@ Capistrano::Configuration.instance(:must_exist).load do
483
501
  if defined? "#{newdeploy}" then
484
502
  if defined? "#{plugins}"
485
503
  plugins.each do |plugin|
486
- print "plugin: #{plugin}\n"
504
+ pretty_print "--> plugin: #{plugin}\n"
487
505
  paths << "#{build_to}/plugins/#{plugin}/resources/public/stylesheets"
488
506
  end
489
507
  end
490
- puts "--"
491
508
  paths.each do |path|
492
- puts "folders: #{path}\n"
509
+ pretty_print "--> folders: #{path}\n"
493
510
  end
494
511
  Dir.mkdir("#{build_to}/public/stylesheets/build") rescue ""
495
512
  paths.each do |bundle_directory|
496
- puts "--"
497
- puts "directory: #{bundle_directory}"
513
+ pretty_print "--> directory: #{bundle_directory}"
498
514
  bundle_name = bundle_directory.gsub("#{build_to}/", "").gsub("plugins/", "").gsub("/resources/public/stylesheets", "").gsub("public/stylesheets/", "")
499
515
  puts " bundle name: #{bundle_name}"
500
516
  next if bundle_name.empty?
@@ -512,7 +528,7 @@ Capistrano::Configuration.instance(:must_exist).load do
512
528
  paths << "#{build_to}/public/stylesheets/"
513
529
  Dir.mkdir("#{build_to}/public/stylesheets/build") rescue ""
514
530
  paths.each do |bundle_directory|
515
- puts bundle_directory
531
+ pretty_print bundle_directory
516
532
  bundle_name = if bundle_directory.index("plugins") then bundle_directory.gsub("#{build_to}/plugins/cms/resources/public/stylesheets", "") else bundle_directory.gsub("#{build_to}/public/stylesheets/", "") end
517
533
  bundle_name = if bundle_name.index("/") then bundle_name[0..bundle_name.index("/")-1] else bundle_name end
518
534
  next if bundle_name.empty?
@@ -533,7 +549,7 @@ Capistrano::Configuration.instance(:must_exist).load do
533
549
  if defined? "#{newdeploy}" then
534
550
  if defined? "#{plugins}"
535
551
  plugins.each do |plugin|
536
- puts "plugin: #{plugin}\n".green
552
+ pretty_print "--> plugin: #{plugin}\n"
537
553
  paths << "#{build_to}/plugins/#{plugin}/resources/public/javascripts"
538
554
  end
539
555
  end
@@ -543,10 +559,9 @@ Capistrano::Configuration.instance(:must_exist).load do
543
559
  end
544
560
  Dir.mkdir("#{build_to}/public/javascripts/build") rescue ""
545
561
  paths.each do |bundle_directory|
546
- puts "--"
547
- puts "directory: #{bundle_directory}"
562
+ pretty_print "--> directory: #{bundle_directory}"
548
563
  bundle_name = bundle_directory.gsub("#{build_to}/", "").gsub("plugins/", "").gsub("/resources/public/javascripts", "").gsub("public/javascripts/", "")
549
- puts " bundle name: #{bundle_name}"
564
+ pretty_print "--> bundle name: #{bundle_name}"
550
565
  next if bundle_name.empty?
551
566
  files = recursive_file_list(bundle_directory, ".js")
552
567
  next if files.empty? || bundle_name == 'dev'
@@ -611,12 +626,20 @@ Capistrano::Configuration.instance(:must_exist).load do
611
626
  task :get, :roles => :web, :except => { :no_release => true } do
612
627
  if !remote_file_exists?("#{deploy_to}/composer.phar")
613
628
  pretty_print "--> Downloading Composer"
614
-
615
- run "sh -c 'cd #{deploy_to} && curl -s http://getcomposer.org/installer | #{php_bin}'"
629
+ begin
630
+ run "sh -c 'cd #{deploy_to} && curl -s http://getcomposer.org/installer | #{php_bin}'"
631
+ puts_ok
632
+ rescue
633
+ puts_fail
634
+ end
616
635
  else
617
636
  pretty_print "--> Updating Composer"
618
-
619
- run "sh -c 'cd #{deploy_to} && #{php_bin} composer.phar self-update'"
637
+ begin
638
+ run "sh -c 'cd #{deploy_to} && #{php_bin} composer.phar self-update'"
639
+ puts_ok
640
+ rescue
641
+ puts_fail
642
+ end
620
643
  end
621
644
  puts_ok
622
645
  end
@@ -624,8 +647,12 @@ Capistrano::Configuration.instance(:must_exist).load do
624
647
  desc "Updates composer"
625
648
  task :self_update, :roles => :web, :except => { :no_release => true } do
626
649
  pretty_print "--> Updating Composer"
627
- run "sh -c 'cd #{deploy_to} && #{composer_bin} self-update'"
628
- puts_ok
650
+ begin
651
+ run "sh -c 'cd #{deploy_to} && #{composer_bin} self-update'"
652
+ puts_ok
653
+ rescue
654
+ puts_fail
655
+ end
629
656
  end
630
657
 
631
658
  desc "Runs composer to install vendors from composer.lock file"
@@ -638,8 +665,12 @@ Capistrano::Configuration.instance(:must_exist).load do
638
665
  end
639
666
 
640
667
  pretty_print "--> Installing Composer dependencies"
641
- run "sh -c 'cd #{deploy_to} && #{composer_bin} install #{composer_options}'"
642
- puts_ok
668
+ begin
669
+ run "sh -c 'cd #{deploy_to} && #{composer_bin} install #{composer_options}'"
670
+ puts_ok
671
+ rescue
672
+ puts_fail
673
+ end
643
674
  end
644
675
 
645
676
  desc "Runs composer to update vendors, and composer.lock file"
@@ -652,8 +683,12 @@ Capistrano::Configuration.instance(:must_exist).load do
652
683
  end
653
684
 
654
685
  pretty_print "--> Updating Composer dependencies"
655
- run "sh -c 'cd #{deploy_to} && #{composer_bin} update #{composer_options}'"
656
- puts_ok
686
+ begin
687
+ run "sh -c 'cd #{deploy_to} && #{composer_bin} update #{composer_options}'"
688
+ puts_ok
689
+ rescue
690
+ puts_fail
691
+ end
657
692
  end
658
693
 
659
694
  desc "Dumps an optimized autoloader"
@@ -671,17 +706,10 @@ Capistrano::Configuration.instance(:must_exist).load do
671
706
  puts_ok
672
707
  rescue
673
708
  puts_fail
674
- end
675
-
709
+ end
676
710
 
677
711
  end
678
712
 
679
- task :copy_vendors, :except => { :no_release => true } do
680
- pretty_print "--> Copying vendors from previous release"
681
-
682
- run "vendorDir=#{current_path}/vendor; if [ -d $vendorDir ] || [ -h $vendorDir ]; then cp -a $vendorDir #{deploy_to}/vendor; fi;"
683
- puts_ok
684
- end
685
713
  end
686
714
 
687
715
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{obbistrano}
5
- s.version = "1.1.96"
5
+ s.version = "1.1.98"
6
6
  s.authors = ["Ross Riley", "One Black Bear"]
7
7
  s.date = Time.now
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 96
9
- version: 1.1.96
8
+ - 98
9
+ version: 1.1.98
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ross Riley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-06 00:00:00 +00:00
18
+ date: 2013-01-07 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency