Module: PersistantDirectory

Defined in:
lib/fingercap/persistant_directory.rb

Instance Method Summary collapse

Instance Method Details

#create(*args) ⇒ Object

Create persistant directories in /deploy/to/shared

Create /deploy/to/shared/public/assets

PersistantDirectory.create('public/assets')

Create multiple directories at once

PersistantDirectory.create('public/icons', 'public/files')

13
14
15
16
17
18
19
# File 'lib/fingercap/persistant_directory.rb', line 13

def create(*args)
  args.each do |directory|
    sudo "mkdir -p #{shared_path}/#{directory}"
    sudo "chown -R #{fetch(:runner, "app")}:wheel #{shared_path}"
    sudo "chmod -R 775 #{shared_path}"
  end
end

Symlink shared persistant directories to the current deployment directory

Symlink /deploy/to/shared/public/assets to /deploy/to/current/public/assets

PersistantDirectory.symlink('public/assets')

Symlink multiple directories at once

PersistantDirectory.symlink('public/icons', 'public/files')

30
31
32
33
# File 'lib/fingercap/persistant_directory.rb', line 30

def symlink(*args)
  directory = args.first
  run "ln -s #{shared_path}/#{directory} #{current_path}/#{directory}"
end