Parent

Object

Public Instance Methods

changed?(path) click to toggle source

have files of interest changed on this deployment?

# File lib/whiskey_disk/helpers.rb, line 9
def changed?(path)
  return true unless gc = git_changes
  cleaned = Regexp.escape(path.sub(%{/+$}, ''))
  [ gc, rsync_changes ].flatten.compact.any? { |p| p =~ %<^#{cleaned}(?:$|/)> }
end
changes_file_root() click to toggle source
# File lib/whiskey_disk/helpers.rb, line 39
def changes_file_root
  path = IO.popen("git rev-parse --show-toplevel").read
  path == '' ? Dir.pwd : path.chomp
end
git_changes() click to toggle source

list of changed paths, according to git

# File lib/whiskey_disk/helpers.rb, line 16
def git_changes
  changes = read_git_changes_file.split("\n").uniq
rescue Exception
  nil
end
git_changes_path() click to toggle source
# File lib/whiskey_disk/helpers.rb, line 44
def git_changes_path
  File.join(changes_file_root, '.whiskey_disk_git_changes')
end
read_git_changes_file() click to toggle source
# File lib/whiskey_disk/helpers.rb, line 31
def read_git_changes_file
  File.read(git_changes_path)
end
read_rsync_changes_file() click to toggle source
# File lib/whiskey_disk/helpers.rb, line 35
def read_rsync_changes_file
  File.read(rsync_changes_path)
end
role?(role) click to toggle source

is the current deployment domain in the specified role?

# File lib/whiskey_disk/helpers.rb, line 3
def role?(role)
  return false unless ENV['WD_ROLES'] and ENV['WD_ROLES'] != ''
  ENV['WD_ROLES'].split(':').include?(role.to_s)
end
rsync_changes() click to toggle source
# File lib/whiskey_disk/helpers.rb, line 22
def rsync_changes
  changes = read_rsync_changes_file.split("\n")
  changes.map {|c| c.sub(/^[^ ]* [^ ]* [^ ]* /, '') }.
          grep(/^[^ ]{9,} /).map {|c| c.sub(/^[^ ]{9,} /, '') }.
          map {|s| s.sub(%{/$}, '') } - ['.']
rescue Exception
  nil
end
rsync_changes_path() click to toggle source
# File lib/whiskey_disk/helpers.rb, line 48
def rsync_changes_path
  File.join(changes_file_root, '.whiskey_disk_rsync_changes')
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.