Top Level Namespace

Defined Under Namespace

Modules: Capistrano, Ratchetify

Instance Method Summary collapse

Instance Method Details

#abort_red(msg) ⇒ Object



4
5
6
# File 'lib/ratchetify/base.rb', line 4

def abort_red(msg)
  abort "  * \e[#{1};31mERROR: #{msg}\e[0m"
end

#branch?(full_path) ⇒ Boolean

working with git

Returns:

  • (Boolean)


63
64
65
# File 'lib/ratchetify/helpers.rb', line 63

def branch?(full_path)
  capture("cd #{full_path} && git branch | grep '*'")
end

#conf_dirObject



21
22
23
# File 'lib/ratchetify/helpers.rb', line 21

def conf_dir
  "/home/#{user}/aconf"
end

#create_dir(full_path, owner = nil) ⇒ Object



41
42
43
44
45
46
# File 'lib/ratchetify/helpers.rb', line 41

def create_dir(full_path, owner=nil)
  run "mkdir #{full_path} -p"
  if owner
    run "chown #{owner} #{full_path}"
  end
end

#daemon_serviceObject



25
26
27
# File 'lib/ratchetify/helpers.rb', line 25

def daemon_service
  "run-#{application}"
end

#delete_dir(full_path) ⇒ Object



48
49
50
51
52
# File 'lib/ratchetify/helpers.rb', line 48

def delete_dir(full_path)
  if dir_exists? full_path
    run "rm -Rf #{full_path}"
  end
end

#delete_file(full_path) ⇒ Object



54
55
56
57
58
# File 'lib/ratchetify/helpers.rb', line 54

def delete_file(full_path)
  if file_exists? full_path 
    run "rm #{full_path}"
  end
end

#deploy_dirObject



17
18
19
# File 'lib/ratchetify/helpers.rb', line 17

def deploy_dir
  "#{deploy_root}/#{application}"
end

#deploy_rootObject



13
14
15
# File 'lib/ratchetify/helpers.rb', line 13

def deploy_root
  "#{webroot_dir}/apps"
end

#dir_exists?(full_path) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/ratchetify/helpers.rb', line 37

def dir_exists?(full_path)
  'true' ==  capture("if [ -d #{full_path} ]; then echo 'true'; fi").strip
end

#file_exists?(full_path) ⇒ Boolean

file and dir handling

Returns:

  • (Boolean)


33
34
35
# File 'lib/ratchetify/helpers.rb', line 33

def file_exists?(full_path)
  'true' ==  capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
end

#on_branch?(full_path, branch) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/ratchetify/helpers.rb', line 67

def on_branch?(full_path, branch)
  branch?(full_path).include? branch
end

#webroot_dirObject

dirs and other constants



9
10
11
# File 'lib/ratchetify/helpers.rb', line 9

def webroot_dir
  "/var/www/virtual/#{user}"
end