forked from fastlane/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_global_value.rb
64 lines (54 loc) · 1.74 KB
/
get_global_value.rb
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
54
55
56
57
58
59
60
61
62
63
64
module Fastlane
module Actions
module SharedValues
GET_GLOBAL_VALUE_CUSTOM_VALUE = :GET_GLOBAL_VALUE_CUSTOM_VALUE
end
class GetGlobalValueAction < Action
def self.run(params)
key = params[:key]
Actions.lane_context[SharedValues::GET_GLOBAL_VALUE_CUSTOM_VALUE] = self.projectKey(key)
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"A short description with <= 80 characters of what this action does"
end
def self.available_options
# Define all options your action supports.
# The environment variable (last parameters) is optional, remove it if you don't need it
# You can add as many parameters as you want
[
['key', 'The key for which to find a value'],
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['GET_GLOBAL_VALUE_CUSTOM_VALUE', 'A description of what this value contains']
]
end
def self.author
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
'duemunk'
end
def self.is_supported?(platform)
true
end
def self.projectKey(aKey)
projectKey = ''
filename = "./BeMyEyes/Source/BMEGlobal.h"
File.open(filename, "r:UTF-8") do |f|
contents = f.read
contents.scan(/\#define\s([^\s]*)\s@\"([^\"]*)\"/) do |key, value|
if key == aKey
projectKey = value
end
end
end
return projectKey
end
end
end
end