Class: MoonshadowSetupManifest

Inherits:
ShadowPuppet::Manifest
  • Object
show all
Defined in:
lib/moonshine_setup_manifest.rb

Overview

Running cap deploy:setup or cap moonshadow:bootstrap in uploads your <p>config/moonshadow.yml</p> to /tmp/moonshadow.yml on your server and applies this manifest.

Requires these three variables in a YAML config/moonshadow.yml:

application: your_app_name
user: rails
deploy_to: /srv/your_app_name

Instance Method Summary collapse

Instance Method Details

#directoriesObject

Essentially replicates the deploy:setup command from capistrano, but sets up permissions correctly



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/moonshine_setup_manifest.rb', line 19

def directories
  deploy_to_array = configuration[:deploy_to].split('/')
  deploy_to_array.each_with_index do |dir, index|
    next if index == 0 || index >= (deploy_to_array.size-1)
    file '/'+deploy_to_array[1..index].join('/'), :ensure => :directory
  end
  dirs = [
    "#{configuration[:deploy_to]}",
    "#{configuration[:deploy_to]}/shared",
    "#{configuration[:deploy_to]}/shared/config",
    "#{configuration[:deploy_to]}/releases"
  ]
  dirs.each do |dir|
    file dir,
    :ensure => :directory,
    :owner => configuration[:user],
    :group => configuration[:group] || configuration[:user],
    :mode => '775'
  end
end