Permalink
Browse files

Added tests for config

Removed the defaults from the task definition. Added alerts if the config file does not set the values.
  • Loading branch information...
1 parent 34f3d95 commit a4e3eb79f5c4c84fda34b24766558617b3614a49 @alistairstead committed Mar 8, 2012
Showing with 17 additions and 23 deletions.
  1. +13 −5 lib/mage.rb
  2. +4 −18 lib/nonrails.rb
View
@@ -1,7 +1,15 @@
load Gem.find_files('nonrails.rb').last.to_s
-set :app_symlinks, ["/media", "/var", "/sitemaps", "/staging"]
-set :app_shared_dirs, ["/app/etc", "/sitemaps", "/media", "/var", "/staging"]
-set :app_shared_files, ["/app/etc/local.xml"]
+
+# =========================================================================
+# These variables MUST be set in the client capfiles. If they are not set,
+# the deploy will fail with an error.
+# =========================================================================
+
+_cset(:app_symlinks) {
+ abort "[error] Please specify an array of symlinks to shared resources, set :app_symlinks, ['/media', .. '/staging']"
+}
+_cset(:app_shared_dirs) { abort "[error] Please specify, set :app_shared_dirs" }
+_cset(:app_shared_files) { abort "[error] Please specify, set :app_shared_files" }
namespace :mage do
desc <<-DESC
@@ -18,10 +26,10 @@
DESC
task :setup, :roles => :web, :except => { :no_release => true } do
if app_shared_dirs
- app_shared_dirs.each { |link| run "#{try_sudo} mkdir -p #{shared_path}#{link} && chmod 777 #{shared_path}#{link}"}
+ app_shared_dirs.each { |link| run "#{try_sudo} mkdir -p #{shared_path}#{link} && chmod g+w #{shared_path}#{link}"}
end
if app_shared_files
- app_shared_files.each { |link| run "#{try_sudo} touch #{shared_path}#{link} && chmod 777 #{shared_path}#{link}" }
+ app_shared_files.each { |link| run "#{try_sudo} touch #{shared_path}#{link} && chmod g+w #{shared_path}#{link}" }
end
end
View
@@ -22,29 +22,29 @@
This method should be overridden to meet the requirements of your allocation.
DESC
task :finalize_update, :except => { :no_release => true } do
- #
+ # do nothing for non rails apps
end
desc <<-DESC
[Overload] Default actions cancelled
DESC
task :restart, :roles => :app, :except => { :no_release => true } do
- #
+ # do nothing for non rails apps
end
desc <<-DESC
[Overload] Default actions cancelled.
DESC
task :migrate, :roles => :db, :only => { :primary => true } do
- #
+ # do nothing for non rails apps
end
desc <<-DESC
[Overload] Default actions cancelled.
DESC
task :migrations do
set :migrate_target, :latest
- #
+ # // do nothing for non rails apps
end
desc <<-DESC
@@ -54,20 +54,6 @@
update
end
- desc <<-DESC
- [Overload] Default actions cancelled.
- DESC
- task :start, :roles => :app do
- #
- end
-
- desc <<-DESC
- [Overload] Default actions cancelled.
- DESC
- task :stop, :roles => :app do
- #
- end
-
namespace :web do
desc <<-DESC
Present a maintenance page to visitors. Disables your application's web \

0 comments on commit a4e3eb7

Please sign in to comment.