fastlane-plugin-xcconfig 1.0.0 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58d03002755a01a9c94e7962b7b2f1acf8aacc536b5ace59b55d6cf9de3141a6
4
- data.tar.gz: 6b6d1c2b45cbf6967defcda7877b4320f9ec390954354c5c8457ea57dcda910a
3
+ metadata.gz: 1744250f9238b86752f3d125ad67b77d62a35d0e416da171cc52c303c7bb83b1
4
+ data.tar.gz: 4abc691adbfa8e9dc6dbe6b66e7e28e19c360b45c4b8ad3d58a013c0fe0ee5a9
5
5
  SHA512:
6
- metadata.gz: 7e367b932e6d92ccfd97393d898f2748e3f0b3faa3fb0491cfb0fea65ec1aabbeee4599d03c95f3272142b0d802d544f07b9381b16a94823484ac744bfbae9b8
7
- data.tar.gz: cd7a29d07757efbaa4c5e36dfd27f12fe71794ab0b8409fe1afaff60f570a408db8270c2c5627cc8cfd6d11160ec6ad04f4a3353b18621c94da9a3951b5293d8
6
+ metadata.gz: db890577830b765b3707141bf2dc55d75b8ec12cd30fe6d9c69e416cfef70054b7bea4d314f0d64423119a7bf855f9e21fb6a9a5f2ace3b885915c311798e2bb
7
+ data.tar.gz: 92958255e587fd80d6baaae501f1a83d4c6424c778d292634b5a8a98383749319eb68ad5b54173e9d9deda6bb9b9173146fbef2f68343195cccfba16c9b0fdf5
data/README.md CHANGED
@@ -11,27 +11,54 @@ fastlane add_plugin xcconfig
11
11
  ```
12
12
 
13
13
  ## About xcconfig
14
- Adds 2 actions to fastlane to read and update xcconfig files.
14
+ Adds 3 actions to fastlane to read and update xcconfig files.
15
15
 
16
16
 
17
17
  ## Example
18
18
 
19
19
  ```ruby
20
20
  lane :test do
21
-
21
+
22
22
  # Read PRODUCT_BUNDLE_IDENTIFIER value from Configs/Release.xcconfig
23
23
  bundle_id = get_xcconfig_value(
24
- path: 'fastlane/Configs/Release.xcconfig',
24
+ path: 'fastlane/Configs/Release.xcconfig',
25
25
  name: 'PRODUCT_BUNDLE_IDENTIFIER'
26
26
  )
27
-
28
- # Sets PRODUCT_BUNDLE_IDENTIFIER value to 'com.sovcharenko.App-beta' in Configs/Release.xcconfig
27
+
28
+ # Update PRODUCT_NAME value to 'Updated App' in Configs/Test.xcconfig
29
+ # Will fail if PRODUCT_NAME doesn't exist in Configs/Test.xcconfig
30
+ update_xcconfig_value(
31
+ path: 'fastlane/Test.xcconfig',
32
+ name: 'PRODUCT_NAME',
33
+ value: 'Updated App'
34
+ )
35
+
36
+ # Updates the value and hides it from being printed to the UI.
37
+ # Used to hide sensitive data from being displayed in logs.
38
+ update_xcconfig_value(
39
+ path: 'fastlane/Test.xcconfig',
40
+ name: 'PRODUCT_NAME',
41
+ value: 'Updated App Hidden',
42
+ mask_value: true
43
+ )
44
+
45
+ # Sets PRODUCT_BUNDLE_IDENTIFIER value to 'com.sovcharenko.App-beta' in Configs/Release.xcconfig
46
+ # PRODUCT_BUNDLE_IDENTIFIER will be added if it doesn't exist
29
47
  set_xcconfig_value(
30
- path: 'fastlane/Configs/Release.xcconfig',
31
- name: 'PRODUCT_BUNDLE_IDENTIFIER',
48
+ path: 'fastlane/Configs/Release.xcconfig',
49
+ name: 'PRODUCT_BUNDLE_IDENTIFIER',
32
50
  value: 'com.sovcharenko.App-beta'
33
51
  )
34
-
52
+
53
+ # Sets the value and hides it from printed to the UI.
54
+ # Used to hide sensitive data from being displayed in logs.
55
+ set_xcconfig_value(
56
+ path: 'fastlane/Configs/Release.xcconfig',
57
+ name: 'PRODUCT_BUNDLE_IDENTIFIER',
58
+ value: 'com.sovcharenko.App-beta',
59
+ mask_value: true
60
+ )
61
+
35
62
  end
36
63
 
37
64
  ```
@@ -7,7 +7,7 @@ module Fastlane
7
7
  def self.run(params)
8
8
  path = File.expand_path(params[:path])
9
9
 
10
- tmp_file = path + '.updated'
10
+ tmp_file = path + '.set'
11
11
 
12
12
  name = params[:name]
13
13
 
@@ -28,12 +28,17 @@ module Fastlane
28
28
  file.write(name + ' = ' + value + "\n")
29
29
  updated = true
30
30
  else
31
- file.write(line)
31
+ file.write(line.strip + "\n")
32
32
  end
33
33
  end
34
+ file.write(name + ' = ' + value) unless updated
34
35
  end
35
36
 
36
- Fastlane::UI.user_error!("Couldn't find '#{name}' in #{path}.") unless updated
37
+ if params[:mask_value]
38
+ Fastlane::UI.message("Set `#{name}` to `****`")
39
+ else
40
+ Fastlane::UI.message("Set `#{name}` to `#{value}`")
41
+ end
37
42
 
38
43
  FileUtils.cp(tmp_file, path)
39
44
  ensure
@@ -42,11 +47,11 @@ module Fastlane
42
47
  end
43
48
 
44
49
  def self.description
45
- 'Updates value of a setting in xcconfig file.'
50
+ 'Sets the value of a setting in xcconfig file.'
46
51
  end
47
52
 
48
53
  def self.authors
49
- ["Sergii Ovcharenko"]
54
+ ["Sergii Ovcharenko", "steprescott"]
50
55
  end
51
56
 
52
57
  def self.return_value
@@ -54,7 +59,7 @@ module Fastlane
54
59
  end
55
60
 
56
61
  def self.details
57
- 'This action updates the value of a given setting in a given xcconfig file. Will throw an error if specified setting doesn\'t exist'
62
+ 'This action sets the value of a given setting in a given xcconfig file.'
58
63
  end
59
64
 
60
65
  def self.available_options
@@ -77,7 +82,13 @@ module Fastlane
77
82
  optional: false,
78
83
  verify_block: proc do |value|
79
84
  UI.user_error!("Couldn't find xcconfig file at path '#{value}'") unless File.exist?(File.expand_path(value))
80
- end)
85
+ end),
86
+ FastlaneCore::ConfigItem.new(key: :mask_value,
87
+ env_name: "XCCP_SET_VALUE_PARAM_MASK_VALUE",
88
+ description: "Masks the value from being printed to the console",
89
+ optional: true,
90
+ is_string: false,
91
+ default_value: false)
81
92
  ]
82
93
  end
83
94
 
@@ -0,0 +1,100 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/xcconfig_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class UpdateXcconfigValueAction < Action
7
+ def self.run(params)
8
+ path = File.expand_path(params[:path])
9
+
10
+ tmp_file = path + '.updated'
11
+
12
+ name = params[:name]
13
+
14
+ # Revert fastlane's auto conversion of strings into booleans
15
+ # https://github.com/fastlane/fastlane/pull/11923
16
+ value = if [true, false].include?(params[:value])
17
+ params[:value] ? 'YES' : 'NO'
18
+ else
19
+ params[:value].strip
20
+ end
21
+ begin
22
+ updated = false
23
+
24
+ File.open(tmp_file, 'w') do |file|
25
+ File.open(path).each do |line|
26
+ xcname, = Helper::XcconfigHelper.parse_xcconfig_name_value_line(line)
27
+ if xcname == name
28
+ file.write(name + ' = ' + value + "\n")
29
+ updated = true
30
+ else
31
+ file.write(line)
32
+ end
33
+ end
34
+ end
35
+
36
+ Fastlane::UI.user_error!("Couldn't find '#{name}' in #{path}.") unless updated
37
+ if params[:mask_value]
38
+ Fastlane::UI.message("Updated `#{name}` to `****`")
39
+ else
40
+ Fastlane::UI.message("Updated `#{name}` to `#{value}`")
41
+ end
42
+
43
+ FileUtils.cp(tmp_file, path)
44
+ ensure
45
+ File.delete(tmp_file)
46
+ end
47
+ end
48
+
49
+ def self.description
50
+ 'Updates value of a setting in xcconfig file.'
51
+ end
52
+
53
+ def self.authors
54
+ ["Sergii Ovcharenko", "steprescott"]
55
+ end
56
+
57
+ def self.return_value
58
+ nil
59
+ end
60
+
61
+ def self.details
62
+ 'This action updates the value of a given setting in a given xcconfig file. Will throw an error if specified setting doesn\'t exist'
63
+ end
64
+
65
+ def self.available_options
66
+ [
67
+ FastlaneCore::ConfigItem.new(key: :name,
68
+ env_name: "XCCP_UPDATE_VALUE_PARAM_NAME",
69
+ description: "Name of key in xcconfig file to update",
70
+ type: String,
71
+ optional: false),
72
+ FastlaneCore::ConfigItem.new(key: :value,
73
+ env_name: "XCCP_UPDATE_VALUE_PARAM_VALUE",
74
+ description: "Value to set",
75
+ skip_type_validation: true, # skipping type validation as fastlane converts YES/NO/true/false strings into booleans
76
+ type: String,
77
+ optional: false),
78
+ FastlaneCore::ConfigItem.new(key: :path,
79
+ env_name: "XCCP_UPDATE_VALUE_PARAM_PATH",
80
+ description: "Path to xcconfig file you want to update",
81
+ type: String,
82
+ optional: false,
83
+ verify_block: proc do |value|
84
+ UI.user_error!("Couldn't find xcconfig file at path '#{value}'") unless File.exist?(File.expand_path(value))
85
+ end),
86
+ FastlaneCore::ConfigItem.new(key: :mask_value,
87
+ env_name: "XCCP_UPDATE_VALUE_PARAM_MASK_VALUE",
88
+ description: "Masks the value from being printed to the console",
89
+ optional: true,
90
+ is_string: false,
91
+ default_value: false)
92
+ ]
93
+ end
94
+
95
+ def self.is_supported?(platform)
96
+ true
97
+ end
98
+ end
99
+ end
100
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Xcconfig
3
- VERSION = "1.0.0"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-xcconfig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergii Ovcharenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-25 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -147,6 +147,7 @@ files:
147
147
  - lib/fastlane/plugin/xcconfig.rb
148
148
  - lib/fastlane/plugin/xcconfig/actions/get_xcconfig_value_action.rb
149
149
  - lib/fastlane/plugin/xcconfig/actions/set_xcconfig_value_action.rb
150
+ - lib/fastlane/plugin/xcconfig/actions/update_xcconfig_value_action.rb
150
151
  - lib/fastlane/plugin/xcconfig/helper/xcconfig_helper.rb
151
152
  - lib/fastlane/plugin/xcconfig/version.rb
152
153
  homepage: https://github.com/sovcharenko/fastlane-plugin-xcconfig
@@ -168,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
169
  - !ruby/object:Gem::Version
169
170
  version: '0'
170
171
  requirements: []
171
- rubyforge_project:
172
- rubygems_version: 2.7.6
172
+ rubygems_version: 3.0.3.1
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Adds 2 actions to fastlane to read and update xcconfig files.