-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore
53 lines (44 loc) · 1.06 KB
/
core
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def bitrise_env (var_name, value)
envman = `which envman`
unless (envman.empty?)
sh("envman", "add", "--key", var_name, "--value", value)
end
end
def output_path ()
return ENV.key?('APP_OUTPUT_PATH') ? ENV['APP_OUTPUT_PATH'] : './deploy'
end
def requirements (options)
UI.success "check requirements"
end
lane :gpg_decrypt do |options|
file = options[:file]
extension = file[-4..-1]
output = file
split = output.split("->")
isGpg = false
if (split.length > 2)
UI.user_error!("Invalid file.")
end
if (split.length === 2)
output = split[1].strip
file = split[0].strip
isGpg = true
elsif (extension == '.gpg')
isGpg = true
output = output[0..-5]
end
if (!isGpg)
return output
end
passphrase = options[:passphrase]
gpg_cmd = `which gpg`
if (gpg_cmd.empty?)
UI.user_error!("'gpg' command not found")
else
Dir.chdir ".." do
sh("gpg", "--batch", "--yes", "--passphrase", passphrase, "--output", output, "--decrypt", file, log: false)
end
UI.success "GPG Decrypt OK"
end
output
end