fastlane-plugin-xcconfig 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58d03002755a01a9c94e7962b7b2f1acf8aacc536b5ace59b55d6cf9de3141a6
4
- data.tar.gz: 6b6d1c2b45cbf6967defcda7877b4320f9ec390954354c5c8457ea57dcda910a
3
+ metadata.gz: 47cae4f71d72b6f6bb7116104b705543e356f83b21f0397fcc4411db1bf86551
4
+ data.tar.gz: e67391cd08ac7b507931561ae2500901dd6f7d7e151f488960260011b33603f2
5
5
  SHA512:
6
- metadata.gz: 7e367b932e6d92ccfd97393d898f2748e3f0b3faa3fb0491cfb0fea65ec1aabbeee4599d03c95f3272142b0d802d544f07b9381b16a94823484ac744bfbae9b8
7
- data.tar.gz: cd7a29d07757efbaa4c5e36dfd27f12fe71794ab0b8409fe1afaff60f570a408db8270c2c5627cc8cfd6d11160ec6ad04f4a3353b18621c94da9a3951b5293d8
6
+ metadata.gz: 988bb441dafeab3da0cc7cecf1dd7839798443a8e30884dbb44cfb4138e592c9cdb225267e33563b4095f6dfa913e60dcb57ed85b91fce82d1989e5af092d691
7
+ data.tar.gz: 337fee6448b94d0fd536f763cd63f9b50fd97b95ae6c7e0a1daba34ab7ad4783412cbd25163c1c46b7ae0601ffeb90dc5ba57331cb405b014b35d86d82a82bcd
data/README.md CHANGED
@@ -11,27 +11,36 @@ 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
+ # Sets PRODUCT_BUNDLE_IDENTIFIER value to 'com.sovcharenko.App-beta' in Configs/Release.xcconfig
37
+ # PRODUCT_BUNDLE_IDENTIFIER will be added if it doesn't exist
29
38
  set_xcconfig_value(
30
- path: 'fastlane/Configs/Release.xcconfig',
31
- name: 'PRODUCT_BUNDLE_IDENTIFIER',
39
+ path: 'fastlane/Configs/Release.xcconfig',
40
+ name: 'PRODUCT_BUNDLE_IDENTIFIER',
32
41
  value: 'com.sovcharenko.App-beta'
33
42
  )
34
-
43
+
35
44
  end
36
45
 
37
46
  ```
@@ -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,13 @@ 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
+ Fastlane::UI.message("Set `#{name}` to `#{value}`")
37
38
 
38
39
  FileUtils.cp(tmp_file, path)
39
40
  ensure
@@ -42,11 +43,11 @@ module Fastlane
42
43
  end
43
44
 
44
45
  def self.description
45
- 'Updates value of a setting in xcconfig file.'
46
+ 'Sets the value of a setting in xcconfig file.'
46
47
  end
47
48
 
48
49
  def self.authors
49
- ["Sergii Ovcharenko"]
50
+ ["Sergii Ovcharenko", "steprescott"]
50
51
  end
51
52
 
52
53
  def self.return_value
@@ -54,7 +55,7 @@ module Fastlane
54
55
  end
55
56
 
56
57
  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'
58
+ 'This action sets the value of a given setting in a given xcconfig file.'
58
59
  end
59
60
 
60
61
  def self.available_options
@@ -0,0 +1,90 @@
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
+ Fastlane::UI.message("Updated `#{name}` to `#{value}`")
38
+
39
+ FileUtils.cp(tmp_file, path)
40
+ ensure
41
+ File.delete(tmp_file)
42
+ end
43
+ end
44
+
45
+ def self.description
46
+ 'Updates value of a setting in xcconfig file.'
47
+ end
48
+
49
+ def self.authors
50
+ ["Sergii Ovcharenko", "steprescott"]
51
+ end
52
+
53
+ def self.return_value
54
+ nil
55
+ end
56
+
57
+ def self.details
58
+ 'This action updates the value of a given setting in a given xcconfig file. Will throw an error if specified setting doesn\'t exist'
59
+ end
60
+
61
+ def self.available_options
62
+ [
63
+ FastlaneCore::ConfigItem.new(key: :name,
64
+ env_name: "XCCP_UPDATE_VALUE_PARAM_NAME",
65
+ description: "Name of key in xcconfig file to update",
66
+ type: String,
67
+ optional: false),
68
+ FastlaneCore::ConfigItem.new(key: :value,
69
+ env_name: "XCCP_UPDATE_VALUE_PARAM_VALUE",
70
+ description: "Value to set",
71
+ skip_type_validation: true, # skipping type validation as fastlane converts YES/NO/true/false strings into booleans
72
+ type: String,
73
+ optional: false),
74
+ FastlaneCore::ConfigItem.new(key: :path,
75
+ env_name: "XCCP_UPDATE_VALUE_PARAM_PATH",
76
+ description: "Path to xcconfig file you want to update",
77
+ type: String,
78
+ optional: false,
79
+ verify_block: proc do |value|
80
+ UI.user_error!("Couldn't find xcconfig file at path '#{value}'") unless File.exist?(File.expand_path(value))
81
+ end)
82
+ ]
83
+ end
84
+
85
+ def self.is_supported?(platform)
86
+ true
87
+ end
88
+ end
89
+ end
90
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Xcconfig
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.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.0.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: 2019-05-17 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
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Adds 2 actions to fastlane to read and update xcconfig files.