Class: Fastlane::Actions::SetInfoPlistValueAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, author, deprecated_notes, details, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
72
73
74
|
# File 'fastlane/lib/fastlane/actions/set_info_plist_value.rb', line 72
def self.authors
["kohtenko", "uwehollatz"]
end
|
.available_options ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'fastlane/lib/fastlane/actions/set_info_plist_value.rb', line 43
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :key,
env_name: "FL_SET_INFO_PLIST_PARAM_NAME",
description: "Name of key in plist",
optional: false),
FastlaneCore::ConfigItem.new(key: :subkey,
env_name: "FL_SET_INFO_PLIST_SUBPARAM_NAME",
description: "Name of subkey in plist",
optional: true),
FastlaneCore::ConfigItem.new(key: :value,
env_name: "FL_SET_INFO_PLIST_PARAM_VALUE",
description: "Value to setup",
skip_type_validation: true, optional: false),
FastlaneCore::ConfigItem.new(key: :path,
env_name: "FL_SET_INFO_PLIST_PATH",
description: "Path to plist file you want to update",
optional: false,
verify_block: proc do |value|
UI.user_error!("Couldn't find plist file at path '#{value}'") unless File.exist?(value)
end),
FastlaneCore::ConfigItem.new(key: :output_file_name,
env_name: "FL_SET_INFO_PLIST_OUTPUT_FILE_NAME",
description: "Path to the output file you want to generate",
optional: true)
]
end
|
.category ⇒ Object
87
88
89
|
# File 'fastlane/lib/fastlane/actions/set_info_plist_value.rb', line 87
def self.category
:project
end
|
.description ⇒ Object
39
40
41
|
# File 'fastlane/lib/fastlane/actions/set_info_plist_value.rb', line 39
def self.description
"Sets value to Info.plist of your project as native Ruby data structures"
end
|
.example_code ⇒ Object
80
81
82
83
84
85
|
# File 'fastlane/lib/fastlane/actions/set_info_plist_value.rb', line 80
def self.example_code
[
'set_info_plist_value(path: "./Info.plist", key: "CFBundleIdentifier", value: "com.krausefx.app.beta")',
'set_info_plist_value(path: "./MyApp-Info.plist", key: "NSAppTransportSecurity", subkey: "NSAllowsArbitraryLoads", value: true, output_file_name: "./Info.plist")'
]
end
|
.is_supported?(platform) ⇒ Boolean
76
77
78
|
# File 'fastlane/lib/fastlane/actions/set_info_plist_value.rb', line 76
def self.is_supported?(platform)
[:ios, :mac].include?(platform)
end
|
.run(params) ⇒ Object
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
|
# File 'fastlane/lib/fastlane/actions/set_info_plist_value.rb', line 7
def self.run(params)
require "plist"
begin
path = File.expand_path(params[:path])
plist = Plist.parse_xml(path)
if params[:subkey]
if plist[params[:key]]
plist[params[:key]][params[:subkey]] = params[:value]
else
UI.message("Key doesn't exist, going to create new one ...")
plist[params[:key]] = { params[:subkey] => params[:value] }
end
else
plist[params[:key]] = params[:value]
end
new_plist = Plist::Emit.dump(plist)
if params[:output_file_name]
output = params[:output_file_name]
FileUtils.mkdir_p(File.expand_path("..", output))
File.write(File.expand_path(output), new_plist)
else
File.write(path, new_plist)
end
return params[:value]
rescue => ex
UI.error(ex)
UI.user_error!("Unable to set value to plist file at '#{path}'")
end
end
|