forked from keith/MD5Digest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.rb
More file actions
39 lines (28 loc) · 804 Bytes
/
Copy pathtest.rb
File metadata and controls
39 lines (28 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env ruby
require 'digest/md5'
# This name must match the one in the sample project
NAME = "Keith Smiley"
PROJECT_NAME = "DigestSample"
def folder_missing(path)
puts "#{ path } doesn't exist where it should."
exit
end
def release_path
"#{ PROJECT_NAME }/build/Release"
end
if !File.directory? PROJECT_NAME
folder_missing(PROJECT_NAME)
end
%x[cd "#{ PROJECT_NAME }"; xcodebuild > /dev/null]
if !File.directory? release_path
folder_missing(release_path)
end
Dir.chdir(release_path)
output = %x["./#{ PROJECT_NAME }"]
output_digest = (output.split('Digest: ')).last
ruby_digest = Digest::MD5.hexdigest(NAME)
if output_digest == ruby_digest
puts "SUCCESS: The generated digest matches Ruby's digest"
else
puts "ERROR: The generated digest does not match Ruby's digest"
end