Method: Train::File#sha256sum

Defined in:
lib/train/file.rb

#sha256sumObject



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/train/file.rb', line 156

def sha256sum
  # Skip processing rest of method if fallback method is selected
  return perform_checksum_ruby(:sha256) if defined?(@ruby_checksum_fallback)

  checksum = if @backend.os.family == "windows"
               perform_checksum_windows(:sha256)
             else
               @sha256_command ||= case @backend.os.family
                                   when "darwin", "hpux", "qnx"
                                     "shasum -a 256"
                                   when "solaris"
                                     "digest -a sha256"
                                   else
                                     "sha256sum"
                                   end

               perform_checksum_unix(@sha256_command)
             end

  checksum || perform_checksum_ruby(:sha256)
end