Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#remote_file_content_same_as?(full_path, content) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
# File 'lib/capistrano/node-deploy.rb', line 13

def remote_file_content_same_as?(full_path, content)
  results = []
  invoke_command("md5sum #{full_path} | awk '{ print $1 }'") do |ch, stream, out|
    results << (out == Digest::MD5.hexdigest(content))
  end
  results == [true]
end

#remote_file_differs?(full_path, content) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/capistrano/node-deploy.rb', line 21

def remote_file_differs?(full_path, content)
  exists = remote_file_exists?(full_path)
  !exists || exists && !remote_file_content_same_as?(full_path, content)
end

#remote_file_exists?(full_path) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
# File 'lib/capistrano/node-deploy.rb', line 5

def remote_file_exists?(full_path)
  results = []
  invoke_command("if [ -e '#{full_path}' ]; then echo -n 'true'; fi") do |ch, stream, out|
    results << (out == 'true')
  end
  results == [true]
end