fastlane-plugin-plist_surgeon 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +101 -0
- data/lib/fastlane/plugin/plist_surgeon/actions/entitlements_surgeon_action.rb +43 -0
- data/lib/fastlane/plugin/plist_surgeon/actions/plist_surgeon_action.rb +47 -0
- data/lib/fastlane/plugin/plist_surgeon/actions/privacy_surgeon_action.rb +43 -0
- data/lib/fastlane/plugin/plist_surgeon/helper/plist_surgeon_helper.rb +51 -0
- data/lib/fastlane/plugin/plist_surgeon/version.rb +5 -0
- data/lib/fastlane/plugin/plist_surgeon.rb +16 -0
- metadata +62 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 9a5bd9c8099f25d525594f7152adcfadfa2376e6be3beaade87899ad526d9609
|
|
4
|
+
data.tar.gz: c1459ef6a8ac23c538a4147e62b6bb89a1fa121e4e4c512bae56bef68963a63d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 189d851c3a93be5cca4cc4c8c68eebc27469d47aa1ad124484602b29b26c39718106d3b79ef58cd22b03fffb1f3bf15fac38ef962abb5e64dba074eeb19f8ca1
|
|
7
|
+
data.tar.gz: e80a97936aeff2105af0f323bb710b7a3359b0b8c7d2ecec91a4cc2ee13f8906fef1ed3fbb6e16bd4f22b459e15314dd72898688e049f55c6e5eea1076ba8f5b
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sourcetoad <info@sourcetoad.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# plist_surgeon plugin
|
|
2
|
+
_The all-in-one tool to edit iOS configuration files from one plugin._
|
|
3
|
+
|
|
4
|
+
[](https://rubygems.org/gems/fastlane-plugin-plist_surgeon)
|
|
5
|
+
|
|
6
|
+
## Getting Started
|
|
7
|
+
|
|
8
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-plist_surgeon`, add it to your project by running:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
fastlane add_plugin plist_surgeon
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## About plist_surgeon
|
|
15
|
+
|
|
16
|
+
Edit .plist, .entitlements or .xcprivacy files for any reason as part of your pipeline.
|
|
17
|
+
|
|
18
|
+
## Actions
|
|
19
|
+
|
|
20
|
+
### plist_surgeon
|
|
21
|
+
|
|
22
|
+
Edit a `.plist` file.
|
|
23
|
+
|
|
24
|
+
```rb
|
|
25
|
+
plist_surgeon(
|
|
26
|
+
path: "./Info.plist",
|
|
27
|
+
key: "CFBundleShortVersionString",
|
|
28
|
+
value: "1.2.3"
|
|
29
|
+
)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
| Parameter | Description | Required | Default |
|
|
33
|
+
|-----------|-----------------------------------------------------------|----------|---------|
|
|
34
|
+
| `path` | The path to the plist file | Yes | |
|
|
35
|
+
| `key` | The key to update (supports dot notation for nested keys) | Yes | |
|
|
36
|
+
| `value` | The value to set | Yes | |
|
|
37
|
+
|
|
38
|
+
### entitlements_surgeon
|
|
39
|
+
|
|
40
|
+
Edit an `.entitlements` file.
|
|
41
|
+
|
|
42
|
+
```rb
|
|
43
|
+
entitlements_surgeon(
|
|
44
|
+
path: "./App.entitlements",
|
|
45
|
+
key: "aps-environment",
|
|
46
|
+
value: "production"
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Parameter | Description | Required | Default |
|
|
51
|
+
|-----------|-----------------------------------------------------------|----------|---------|
|
|
52
|
+
| `path` | The path to the entitlements file | Yes | |
|
|
53
|
+
| `key` | The key to update (supports dot notation for nested keys) | Yes | |
|
|
54
|
+
| `value` | The value to set | Yes | |
|
|
55
|
+
|
|
56
|
+
### privacy_surgeon
|
|
57
|
+
|
|
58
|
+
Edit an `.xcprivacy` file.
|
|
59
|
+
|
|
60
|
+
```rb
|
|
61
|
+
privacy_surgeon(
|
|
62
|
+
path: "./PrivacyInfo.xcprivacy",
|
|
63
|
+
key: "NSPrivacyTracking",
|
|
64
|
+
value: false
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
| Parameter | Description | Required | Default |
|
|
69
|
+
|-----------|-----------------------------------------------------------|----------|---------|
|
|
70
|
+
| `path` | The path to the xcprivacy file | Yes | |
|
|
71
|
+
| `key` | The key to update (supports dot notation for nested keys) | Yes | |
|
|
72
|
+
| `value` | The value to set | Yes | |
|
|
73
|
+
|
|
74
|
+
### Run tests for this plugin
|
|
75
|
+
|
|
76
|
+
To run both the tests, and code style validation, run
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
rake
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
To automatically fix many of the styling issues, use
|
|
83
|
+
```
|
|
84
|
+
rubocop -a
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Issues and Feedback
|
|
88
|
+
|
|
89
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
|
90
|
+
|
|
91
|
+
### Troubleshooting
|
|
92
|
+
|
|
93
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
|
94
|
+
|
|
95
|
+
### Using _fastlane_ Plugins
|
|
96
|
+
|
|
97
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
|
98
|
+
|
|
99
|
+
### About _fastlane_
|
|
100
|
+
|
|
101
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/plist_surgeon_helper'
|
|
3
|
+
|
|
4
|
+
module Fastlane
|
|
5
|
+
module Actions
|
|
6
|
+
class EntitlementsSurgeonAction < Action
|
|
7
|
+
def self.run(params)
|
|
8
|
+
Helper::PlistSurgeonHelper.run(params[:path], params[:key], params[:value])
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.description
|
|
12
|
+
"Edit an .entitlements file."
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.authors
|
|
16
|
+
["Connor Tumbleson"]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.available_options
|
|
20
|
+
[
|
|
21
|
+
FastlaneCore::ConfigItem.new(key: :path,
|
|
22
|
+
env_name: "ENTITLEMENTS_SURGEON_PATH",
|
|
23
|
+
description: "The path to the entitlements file",
|
|
24
|
+
optional: false,
|
|
25
|
+
type: String),
|
|
26
|
+
FastlaneCore::ConfigItem.new(key: :key,
|
|
27
|
+
env_name: "ENTITLEMENTS_SURGEON_KEY",
|
|
28
|
+
description: "The key to update (supports dot notation for nested keys)",
|
|
29
|
+
optional: false,
|
|
30
|
+
type: String),
|
|
31
|
+
FastlaneCore::ConfigItem.new(key: :value,
|
|
32
|
+
env_name: "ENTITLEMENTS_SURGEON_VALUE",
|
|
33
|
+
description: "The value to set",
|
|
34
|
+
optional: false)
|
|
35
|
+
]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.is_supported?(platform)
|
|
39
|
+
[:ios, :mac].include?(platform)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/plist_surgeon_helper'
|
|
3
|
+
|
|
4
|
+
module Fastlane
|
|
5
|
+
module Actions
|
|
6
|
+
class PlistSurgeonAction < Action
|
|
7
|
+
def self.run(params)
|
|
8
|
+
Helper::PlistSurgeonHelper.run(params[:path], params[:key], params[:value])
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.description
|
|
12
|
+
"Edit a .plist file."
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.authors
|
|
16
|
+
["Connor Tumbleson"]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.available_options
|
|
20
|
+
[
|
|
21
|
+
FastlaneCore::ConfigItem.new(key: :path,
|
|
22
|
+
env_name: "PLIST_SURGEON_PATH",
|
|
23
|
+
description: "The path to the plist file",
|
|
24
|
+
optional: false,
|
|
25
|
+
type: String),
|
|
26
|
+
FastlaneCore::ConfigItem.new(key: :key,
|
|
27
|
+
env_name: "PLIST_SURGEON_KEY",
|
|
28
|
+
description: "The key to update (supports dot notation for nested keys)",
|
|
29
|
+
optional: false,
|
|
30
|
+
type: String),
|
|
31
|
+
FastlaneCore::ConfigItem.new(key: :value,
|
|
32
|
+
env_name: "PLIST_SURGEON_VALUE",
|
|
33
|
+
description: "The value to set",
|
|
34
|
+
optional: false)
|
|
35
|
+
]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.is_supported?(platform)
|
|
39
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
|
40
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
|
41
|
+
#
|
|
42
|
+
# [:ios, :mac, :android].include?(platform)
|
|
43
|
+
true
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/plist_surgeon_helper'
|
|
3
|
+
|
|
4
|
+
module Fastlane
|
|
5
|
+
module Actions
|
|
6
|
+
class PrivacySurgeonAction < Action
|
|
7
|
+
def self.run(params)
|
|
8
|
+
Helper::PlistSurgeonHelper.run(params[:path], params[:key], params[:value])
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.description
|
|
12
|
+
"Edit an .xcprivacy file."
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.authors
|
|
16
|
+
["Connor Tumbleson"]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.available_options
|
|
20
|
+
[
|
|
21
|
+
FastlaneCore::ConfigItem.new(key: :path,
|
|
22
|
+
env_name: "PRIVACY_SURGEON_PATH",
|
|
23
|
+
description: "The path to the xcprivacy file",
|
|
24
|
+
optional: false,
|
|
25
|
+
type: String),
|
|
26
|
+
FastlaneCore::ConfigItem.new(key: :key,
|
|
27
|
+
env_name: "PRIVACY_SURGEON_KEY",
|
|
28
|
+
description: "The key to update (supports dot notation for nested keys)",
|
|
29
|
+
optional: false,
|
|
30
|
+
type: String),
|
|
31
|
+
FastlaneCore::ConfigItem.new(key: :value,
|
|
32
|
+
env_name: "PRIVACY_SURGEON_VALUE",
|
|
33
|
+
description: "The value to set",
|
|
34
|
+
optional: false)
|
|
35
|
+
]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.is_supported?(platform)
|
|
39
|
+
[:ios, :mac].include?(platform)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
|
2
|
+
require 'plist'
|
|
3
|
+
|
|
4
|
+
module Fastlane
|
|
5
|
+
module Helper
|
|
6
|
+
class PlistSurgeonHelper
|
|
7
|
+
def self.run(path, key, value)
|
|
8
|
+
unless File.exist?(path)
|
|
9
|
+
FastlaneCore::UI.user_error!("File not found at path: #{path}")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
plist = Plist.parse_xml(path)
|
|
13
|
+
if plist.nil?
|
|
14
|
+
FastlaneCore::UI.user_error!("Failed to parse plist at path: #{path}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
set_value(plist, key, value)
|
|
18
|
+
|
|
19
|
+
File.write(path, plist.to_plist)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.set_value(plist, key, value)
|
|
23
|
+
if key.include?('.')
|
|
24
|
+
set_nested_value(plist, key, value)
|
|
25
|
+
else
|
|
26
|
+
plist[key] = value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.set_nested_value(plist, key, value)
|
|
31
|
+
keys = key.split('.')
|
|
32
|
+
last_key = keys.pop
|
|
33
|
+
current = plist
|
|
34
|
+
keys.each do |k|
|
|
35
|
+
if current.kind_of?(Array)
|
|
36
|
+
current = current[k.to_i]
|
|
37
|
+
else
|
|
38
|
+
current[k] ||= {}
|
|
39
|
+
current = current[k]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if current.kind_of?(Array)
|
|
44
|
+
current[last_key.to_i] = value
|
|
45
|
+
else
|
|
46
|
+
current[last_key] = value
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'fastlane/plugin/plist_surgeon/version'
|
|
2
|
+
|
|
3
|
+
module Fastlane
|
|
4
|
+
module PlistSurgeon
|
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
|
6
|
+
def self.all_classes
|
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# By default we want to import all available actions and helpers
|
|
13
|
+
# A plugin can contain any number of actions and plugins
|
|
14
|
+
Fastlane::PlistSurgeon.all_classes.each do |current|
|
|
15
|
+
require current
|
|
16
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fastlane-plugin-plist_surgeon
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Sourcetoad
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: plist
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '3.7'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '3.7'
|
|
26
|
+
email: info@sourcetoad.com
|
|
27
|
+
executables: []
|
|
28
|
+
extensions: []
|
|
29
|
+
extra_rdoc_files: []
|
|
30
|
+
files:
|
|
31
|
+
- LICENSE
|
|
32
|
+
- README.md
|
|
33
|
+
- lib/fastlane/plugin/plist_surgeon.rb
|
|
34
|
+
- lib/fastlane/plugin/plist_surgeon/actions/entitlements_surgeon_action.rb
|
|
35
|
+
- lib/fastlane/plugin/plist_surgeon/actions/plist_surgeon_action.rb
|
|
36
|
+
- lib/fastlane/plugin/plist_surgeon/actions/privacy_surgeon_action.rb
|
|
37
|
+
- lib/fastlane/plugin/plist_surgeon/helper/plist_surgeon_helper.rb
|
|
38
|
+
- lib/fastlane/plugin/plist_surgeon/version.rb
|
|
39
|
+
homepage: https://github.com/sourcetoad/fastlane-plugin-plist_surgeon
|
|
40
|
+
licenses:
|
|
41
|
+
- MIT
|
|
42
|
+
metadata:
|
|
43
|
+
rubygems_mfa_required: 'true'
|
|
44
|
+
rdoc_options: []
|
|
45
|
+
require_paths:
|
|
46
|
+
- lib
|
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
|
+
requirements:
|
|
49
|
+
- - ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '2.7'
|
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: '0'
|
|
57
|
+
requirements: []
|
|
58
|
+
rubygems_version: 3.6.9
|
|
59
|
+
specification_version: 4
|
|
60
|
+
summary: Edit .plist, .entitlements or .xcprivacy files for any reason as part of
|
|
61
|
+
your pipeline.
|
|
62
|
+
test_files: []
|