Permalink
Browse files

Added symlinking defaults. Resolves #16

  • Loading branch information...
ajgon committed Apr 18, 2016
1 parent fbb07dc commit 4a1edd911527364132a0d932e0fcde725c24c115
Showing with 46 additions and 5 deletions.
  1. +13 −0 attributes/default.rb
  2. +7 −3 recipes/deploy.rb
  3. +15 −1 spec/fixtures/node.rb
  4. +11 −1 spec/unit/recipes/deploy_spec.rb
View
@@ -1,4 +1,17 @@
# frozen_string_literal: true
# deploy
default['defaults']['deploy']['symlinks'] = {
'system' => 'public/system',
'assets' => 'public/assets',
'cache' => 'tmp/cache',
'pids' => 'tmp/pids',
'log' => 'log'
}
default['defaults']['deploy']['create_dirs_before_symlink'] =
%w(tmp public config ../../shared/cache ../../shared/assets)
default['defaults']['deploy']['purge_before_symlink'] = %w(log tmp/cache tmp/pids public/system public/assets)
# ruby
default['build-essential']['compile_time'] = true
View
@@ -24,11 +24,15 @@
rollback_on_error true
environment framework.out[:deploy_environment]
create_dirs_before_symlink deploy[:create_dirs_before_symlink]
keep_releases deploy[:keep_releases]
purge_before_symlink deploy[:purge_before_symlink] if deploy[:purge_before_symlink]
create_dirs_before_symlink(
(node['defaults']['deploy']['create_dirs_before_symlink'] + Array.wrap(deploy[:create_dirs_before_symlink])).uniq
)
purge_before_symlink(
(node['defaults']['deploy']['purge_before_symlink'] + Array.wrap(deploy[:purge_before_symlink])).uniq
)
symlink_before_migrate deploy[:symlink_before_migrate]
symlinks deploy[:symlinks] if deploy[:symlinks]
symlinks(node['defaults']['deploy']['symlinks'].merge(deploy[:symlinks] || {}))
scm.out.each do |scm_key, scm_value|
send(scm_key, scm_value)
View
@@ -42,10 +42,24 @@ def node(override = {})
framework: {
adapter: 'rails',
migrate: false
}
},
create_dirs_before_symlink: %(../shared/test),
purge_before_symlink: %w(public/test),
symlinks: { 'test' => 'public/test' }
}
},
defaults: {
deploy: {
symlinks: {
system: 'public/system',
assets: 'public/assets',
cache: 'tmp/cache',
pids: 'tmp/pids',
log: 'log'
},
create_dirs_before_symlink: %w(tmp public config ../../shared/cache ../../shared/assets),
purge_before_symlink: %w(log tmp/cache tmp/pids public/system public/assets)
},
appserver: {
adapter: 'unicorn',
worker_processes: 8
@@ -43,7 +43,17 @@
revision: 'master',
scm_provider: Chef::Provider::Git,
enable_submodules: false,
ssh_wrapper: '/tmp/ssh-git-wrapper.sh'
ssh_wrapper: '/tmp/ssh-git-wrapper.sh',
symlinks: {
'system' => 'public/system',
'assets' => 'public/assets',
'cache' => 'tmp/cache',
'pids' => 'tmp/pids',
'log' => 'log',
'test' => 'public/test'
},
'create_dirs_before_symlink' => %w(tmp public config ../../shared/cache ../../shared/assets ../shared/test),
'purge_before_symlink' => %w(log tmp/cache tmp/pids public/system public/assets public/test)
)
expect(chef_run).to run_execute('stop unicorn')

0 comments on commit 4a1edd9

Please sign in to comment.