diff options
Diffstat (limited to 'chef/lib/chef/resource/deploy.rb')
-rw-r--r-- | chef/lib/chef/resource/deploy.rb | 97 |
1 files changed, 52 insertions, 45 deletions
diff --git a/chef/lib/chef/resource/deploy.rb b/chef/lib/chef/resource/deploy.rb index 327f9425c8..a513b16411 100644 --- a/chef/lib/chef/resource/deploy.rb +++ b/chef/lib/chef/resource/deploy.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,20 +38,20 @@ require "chef/resource/scm" class Chef class Resource - + # Deploy: Deploy apps from a source control repository. # # Callbacks: # Callbacks can be a block or a string. If given a block, the code # is evaluated as an embedded recipe, and run at the specified # point in the deploy process. If given a string, the string is taken as - # a path to a callback file/recipe. Paths are evaluated relative to the + # a path to a callback file/recipe. Paths are evaluated relative to the # release directory. Callback files can contain chef code (resources, etc.) # class Deploy < Chef::Resource - + provider_base Chef::Provider::Deploy - + def initialize(name, collection=nil, node=nil) super(name, collection, node) @resource_name = :deploy @@ -74,26 +74,26 @@ class Chef @provider = Chef::Provider::Deploy::Timestamped @allowed_actions.push(:force_deploy, :deploy, :rollback) end - + # where the checked out/cloned code goes def destination @destination ||= shared_path + "/#{@repository_cache}" end - + # where shared stuff goes, i.e., logs, tmp, etc. goes here def shared_path @shared_path ||= @deploy_to + "/shared" end - + # where the deployed version of your code goes def current_path @current_path ||= @deploy_to + "/current" end - + def depth @shallow_clone ? "5" : nil end - + # note: deploy_to is your application "meta-root." def deploy_to(arg=nil) set_or_return( @@ -102,7 +102,7 @@ class Chef :kind_of => [ String ] ) end - + def repo(arg=nil) set_or_return( :repo, @@ -111,7 +111,7 @@ class Chef ) end alias :repository :repo - + def remote(arg=nil) set_or_return( :remote, @@ -119,7 +119,7 @@ class Chef :kind_of => [ String ] ) end - + def role(arg=nil) set_or_return( :role, @@ -127,7 +127,7 @@ class Chef :kind_of => [ String ] ) end - + def restart_command(arg=nil, &block) arg ||= block set_or_return( @@ -137,7 +137,7 @@ class Chef ) end alias :restart :restart_command - + def migrate(arg=nil) set_or_return( :migrate, @@ -145,7 +145,7 @@ class Chef :kind_of => [ TrueClass, FalseClass ] ) end - + def migration_command(arg=nil) set_or_return( :migration_command, @@ -153,7 +153,7 @@ class Chef :kind_of => [ String ] ) end - + def user(arg=nil) set_or_return( :user, @@ -161,15 +161,15 @@ class Chef :kind_of => [ String ] ) end - + def group(arg=nil) set_or_return( :group, arg, :kind_of => [ String ] ) - end - + end + def enable_submodules(arg=nil) set_or_return( :enable_submodules, @@ -177,7 +177,7 @@ class Chef :kind_of => [ TrueClass, FalseClass ] ) end - + def shallow_clone(arg=nil) set_or_return( :shallow_clone, @@ -193,7 +193,7 @@ class Chef :kind_of => [ String ] ) end - + def copy_exclude(arg=nil) set_or_return( :copy_exclude, @@ -201,7 +201,7 @@ class Chef :kind_of => [ String ] ) end - + def revision(arg=nil) set_or_return( :revision, @@ -210,7 +210,7 @@ class Chef ) end alias :branch :revision - + def git_ssh_wrapper(arg=nil) set_or_return( :git_ssh_wrapper, @@ -219,7 +219,7 @@ class Chef ) end alias :ssh_wrapper :git_ssh_wrapper - + def svn_username(arg=nil) set_or_return( :svn_username, @@ -227,7 +227,7 @@ class Chef :kind_of => [ String ] ) end - + def svn_password(arg=nil) set_or_return( :svn_password, @@ -235,7 +235,7 @@ class Chef :kind_of => [ String ] ) end - + def svn_arguments(arg=nil) set_or_return( :svn_arguments, @@ -243,7 +243,14 @@ class Chef :kind_of => [ String ] ) end - + + def svn_info_args(arg=nil) + set_or_return( + :svn_arguments, + arg, + :kind_of => [ String ]) + end + def scm_provider(arg=nil) klass = if arg.kind_of?(String) || arg.kind_of?(Symbol) lookup_provider_constant(arg) @@ -256,7 +263,7 @@ class Chef :kind_of => [ Class ] ) end - + def svn_force_export(arg=nil) set_or_return( :svn_force_export, @@ -264,7 +271,7 @@ class Chef :kind_of => [ TrueClass, FalseClass ] ) end - + def environment(arg=nil) if arg.is_a?(String) Chef::Log.info "Setting RAILS_ENV, RACK_ENV, and MERB_ENV to `#{arg}'" @@ -277,8 +284,8 @@ class Chef :kind_of => [ Hash ] ) end - - # An array of paths, relative to your app's root, to be purged from a + + # An array of paths, relative to your app's root, to be purged from a # SCM clone/checkout before symlinking. Use this to get rid of files and # directories you want to be shared between releases. # Default: ["log", "tmp/pids", "public/system"] @@ -289,12 +296,12 @@ class Chef :kind_of => Array ) end - + # An array of paths, relative to your app's root, where you expect dirs to # exist before symlinking. This runs after #purge_before_symlink, so you # can use this to recreate dirs that you had previously purged. - # For example, if you plan to use a shared directory for pids, and you - # want it to be located in $APP_ROOT/tmp/pids, you could purge tmp, + # For example, if you plan to use a shared directory for pids, and you + # want it to be located in $APP_ROOT/tmp/pids, you could purge tmp, # then specify tmp here so that the tmp directory will exist when you # symlink the pids directory in to the current release. # Default: ["tmp", "public", "config"] @@ -305,10 +312,10 @@ class Chef :kind_of => Array ) end - + # A Hash of shared/dir/path => release/dir/path. This attribute determines # which files and dirs in the shared directory get symlinked to the current - # release directory, and where they go. If you have a directory + # release directory, and where they go. If you have a directory # $shared/pids that you would like to symlink as $current_release/tmp/pids # you specify it as "pids" => "tmp/pids" # Default {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"} @@ -319,8 +326,8 @@ class Chef :kind_of => Hash ) end - - # A Hash of shared/dir/path => release/dir/path. This attribute determines + + # A Hash of shared/dir/path => release/dir/path. This attribute determines # which files in the shared directory get symlinked to the current release # directory and where they go. Unlike map_shared_files, these are symlinked # *before* any migration is run. @@ -334,31 +341,31 @@ class Chef :kind_of => Hash ) end - + # Callback fires before migration is run. def before_migrate(arg=nil, &block) arg ||= block set_or_return(:before_migrate, arg, :kind_of => [Proc, String]) end - + # Callback fires before symlinking def before_symlink(arg=nil, &block) arg ||= block set_or_return(:before_symlink, arg, :kind_of => [Proc, String]) end - + # Callback fires before restart def before_restart(arg=nil, &block) arg ||= block set_or_return(:before_restart, arg, :kind_of => [Proc, String]) end - + # Callback fires after restart def after_restart(arg=nil, &block) arg ||= block set_or_return(:after_restart, arg, :kind_of => [Proc, String]) end - + end end end |