lib/ors/commands/deploy.rb in ors-0.2.10 vs lib/ors/commands/deploy.rb in ors-0.3.0
- old
+ new
@@ -1,23 +1,34 @@
-module ORS::Commands
+class ORS
+ module Commands
+ class Deploy < Base
- class Deploy < Base
+ def setup
+ parse_remote_and_or_branch
+ end
- def execute
- info "deploying #{name} #{environment}..."
+ def execute
+ info "deploying #{ORS.config[:name]} #{ORS.config[:environment]}..."
- [Update, Migrate].each {|command| run command }
+ [Update, Symlink, Migrate].each {|command| command.run_without_setup }
- if remote_deploy_hook
- execute_in_parallel(app_servers) do |server|
- execute_command server, prepare_environment, "RAILS_ENV=#{environment} #{remote_deploy_hook}"
+ if ORS.config[:remote_deploy_hook]
+ execute_in_parallel(ORS.config[:app_servers]) do |server|
+ execute_command server, prepare_environment, "RAILS_ENV=#{ORS.config[:environment]} #{ORS.config[:remote_deploy_hook]}"
+ end
end
- end
- run Restart
+ Restart.run_without_setup
- eval ERB.new(deploy_hook).result(binding) if deploy_hook
- end
+ eval ERB.new(ORS.config[:deploy_hook]).result(binding) if ORS.config[:deploy_hook]
+ end
- end
+ def usage
+ "./ors deploy [remote|remote/branch] [options]"
+ end
+ def description
+ "Deploys given branch (origin/environment by default) to given environment"
+ end
+ end # Deploy < Base
+ end
end