fastlane-plugin-xcconfig 0.0.1
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 +66 -0
- data/lib/fastlane/plugin/xcconfig.rb +16 -0
- data/lib/fastlane/plugin/xcconfig/actions/get_xcconfig_value_action.rb +54 -0
- data/lib/fastlane/plugin/xcconfig/actions/set_xcconfig_value_action.rb +76 -0
- data/lib/fastlane/plugin/xcconfig/helper/xcconfig_helper.rb +24 -0
- data/lib/fastlane/plugin/xcconfig/version.rb +5 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d528b48f5b25a5679ddb3de9e140ebe1500c216b3e05edbb468c63131fd4ebd2
|
4
|
+
data.tar.gz: 92786f71f81007fde6dfdcfd4cf066cbc7b9dde4e432bf0a1584f6632d178d8a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a52c67036cab08c0cdb680383f8149eabbb86d3bceb7580619e8a02f49e332801a63490b91e82487f1a3a9eda3091db9994066ae1fba55235dc24b93b8c3a7cf
|
7
|
+
data.tar.gz: 3e78ae4517d0f933cfa37566ce85eadd3b9c03b4353b1a70eb3323a89578af0e3ae61e36160f0527f3f6e6d4c68aad59654eb1ce8f304a04d1625b819599c053
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Sergii Ovcharenko <sergii@sovcharenko.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,66 @@
|
|
1
|
+
# xcconfig plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-xcconfig)[](https://travis-ci.org/sovcharenko/fastlane-plugin-xcconfig)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-xcconfig`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin xcconfig
|
11
|
+
```
|
12
|
+
|
13
|
+
## About xcconfig
|
14
|
+
Adds 2 actions to fastlane to read and update xcconfig files.
|
15
|
+
|
16
|
+
|
17
|
+
## Example
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
lane :test do
|
21
|
+
|
22
|
+
# Read PRODUCT_BUNDLE_IDENTIFIER value from Configs/Release.xcconfig
|
23
|
+
bundle_id = get_xcconfig_value(
|
24
|
+
path: 'fastlane/Configs/Release.xcconfig',
|
25
|
+
name: 'PRODUCT_BUNDLE_IDENTIFIER'
|
26
|
+
)
|
27
|
+
|
28
|
+
# Sets PRODUCT_BUNDLE_IDENTIFIER value to 'com.sovcharenko.App-beta' in Configs/Release.xcconfig
|
29
|
+
set_xcconfig_value(
|
30
|
+
path: 'fastlane/Configs/Release.xcconfig',
|
31
|
+
name: 'PRODUCT_BUNDLE_IDENTIFIER',
|
32
|
+
value: 'com.sovcharenko.App-beta'
|
33
|
+
)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
## Run tests for this plugin
|
40
|
+
|
41
|
+
To run both the tests, and code style validation, run
|
42
|
+
|
43
|
+
```
|
44
|
+
rake
|
45
|
+
```
|
46
|
+
|
47
|
+
To automatically fix many of the styling issues, use
|
48
|
+
```
|
49
|
+
rubocop -a
|
50
|
+
```
|
51
|
+
|
52
|
+
## Issues and Feedback
|
53
|
+
|
54
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
55
|
+
|
56
|
+
## Troubleshooting
|
57
|
+
|
58
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
59
|
+
|
60
|
+
## Using _fastlane_ Plugins
|
61
|
+
|
62
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
63
|
+
|
64
|
+
## About _fastlane_
|
65
|
+
|
66
|
+
_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,16 @@
|
|
1
|
+
require 'fastlane/plugin/xcconfig/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Xcconfig
|
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::Xcconfig.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/xcconfig_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class GetXcconfigValueAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
path = File.expand_path(params[:path])
|
9
|
+
File.read(path).lines.each do |line|
|
10
|
+
name, value = Helper::XcconfigHelper.parse_xcconfig_name_value_line(line)
|
11
|
+
return value if name == params[:name]
|
12
|
+
end
|
13
|
+
|
14
|
+
Fastlane::UI.user_error!("Couldn't read '#{params[:name]}' from #{params[:path]}.")
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.description
|
18
|
+
'Reads a value of a setting from xcconfig file.'
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.authors
|
22
|
+
['Sergii Ovcharenko']
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.return_value
|
26
|
+
'Value of a setting.'
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.details
|
30
|
+
'This action reads the value of a given setting from a given xcconfig file. Will throw an error if specified setting doesn\'t exist'
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.available_options
|
34
|
+
[
|
35
|
+
FastlaneCore::ConfigItem.new(key: :name,
|
36
|
+
env_name: "XCCP_GET_VALUE_PARAM_NAME",
|
37
|
+
description: "Name of key in xcconfig file",
|
38
|
+
optional: false),
|
39
|
+
FastlaneCore::ConfigItem.new(key: :path,
|
40
|
+
env_name: "XCCP_GET_VALUE_PARAM_PATH",
|
41
|
+
description: "Path to plist file you want to update",
|
42
|
+
optional: false,
|
43
|
+
verify_block: proc do |value|
|
44
|
+
UI.user_error!("Couldn't find xcconfig file at path '#{value}'") unless File.exist?(File.expand_path(value))
|
45
|
+
end)
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.is_supported?(platform)
|
50
|
+
true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/xcconfig_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class SetXcconfigValueAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
path = File.expand_path(params[:path])
|
9
|
+
|
10
|
+
tmp_file = path + '.updated'
|
11
|
+
|
12
|
+
begin
|
13
|
+
updated = false
|
14
|
+
|
15
|
+
File.open(tmp_file, 'w') do |file|
|
16
|
+
File.open(path).each do |line|
|
17
|
+
name, = Helper::XcconfigHelper.parse_xcconfig_name_value_line(line)
|
18
|
+
if name == params[:name]
|
19
|
+
file.write(name + ' = ' + params[:value] + "\n")
|
20
|
+
updated = true
|
21
|
+
else
|
22
|
+
file.write(line)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
Fastlane::UI.user_error!("Couldn't find '#{params[:name]}' in #{params[:path]}.") unless updated
|
28
|
+
|
29
|
+
FileUtils.cp(tmp_file, path)
|
30
|
+
ensure
|
31
|
+
File.delete(tmp_file)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.description
|
36
|
+
'Updates value of a setting in xcconfig file.'
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.authors
|
40
|
+
["Sergii Ovcharenko"]
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.return_value
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.details
|
48
|
+
'This action updates the value of a given setting in a given xcconfig file. Will throw an error if specified setting doesn\'t exist'
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.available_options
|
52
|
+
[
|
53
|
+
FastlaneCore::ConfigItem.new(key: :name,
|
54
|
+
env_name: "XCCP_SET_VALUE_PARAM_NAME",
|
55
|
+
description: "Name of key in xcconfig file",
|
56
|
+
optional: false),
|
57
|
+
FastlaneCore::ConfigItem.new(key: :value,
|
58
|
+
env_name: "XCCP_SET_VALUE_PARAM_VALUE",
|
59
|
+
description: "Value to set",
|
60
|
+
optional: false),
|
61
|
+
FastlaneCore::ConfigItem.new(key: :path,
|
62
|
+
env_name: "XCCP_SET_VALUE_PARAM_PATH",
|
63
|
+
description: "Path to plist file you want to update",
|
64
|
+
optional: false,
|
65
|
+
verify_block: proc do |value|
|
66
|
+
UI.user_error!("Couldn't find xcconfig file at path '#{value}'") unless File.exist?(File.expand_path(value))
|
67
|
+
end)
|
68
|
+
]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.is_supported?(platform)
|
72
|
+
true
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
class XcconfigHelper
|
8
|
+
# https://pewpewthespells.com/blog/xcconfig_guide.html
|
9
|
+
NAME_VALUE_PATTERN = /^\s*([_a-zA-Z]+[_a-zA-Z0-9]*(?:\[[^\]]*(?:=[^\]]*)?\])*)\s*=\s*(.*)/x
|
10
|
+
|
11
|
+
def self.parse_xcconfig_name_value_line(line)
|
12
|
+
# Strip comment and match
|
13
|
+
match = line.partition('//').first.match(NAME_VALUE_PATTERN)
|
14
|
+
if match
|
15
|
+
key = match[1]
|
16
|
+
value = match[2]
|
17
|
+
[key.strip, value.strip]
|
18
|
+
else
|
19
|
+
[]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-xcconfig
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergii Ovcharenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-require_tools
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fastlane
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.81.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.81.0
|
139
|
+
description:
|
140
|
+
email: sergii@sovcharenko.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- lib/fastlane/plugin/xcconfig.rb
|
148
|
+
- lib/fastlane/plugin/xcconfig/actions/get_xcconfig_value_action.rb
|
149
|
+
- lib/fastlane/plugin/xcconfig/actions/set_xcconfig_value_action.rb
|
150
|
+
- lib/fastlane/plugin/xcconfig/helper/xcconfig_helper.rb
|
151
|
+
- lib/fastlane/plugin/xcconfig/version.rb
|
152
|
+
homepage: https://github.com/sovcharenko/fastlane-plugin-xcconfig
|
153
|
+
licenses:
|
154
|
+
- MIT
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubyforge_project:
|
172
|
+
rubygems_version: 2.7.4
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: Adds 2 actions to fastlane to read and update xcconfig files.
|
176
|
+
test_files: []
|