fastlane-plugin-increment_build_number 0.0.2 → 0.0.3

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: af0b9ad87c01d1b3f674890d3be0e2c06da3f18d3fdb4149540149517d111e8e
4
- data.tar.gz: 9cd662317f181b278cc9cb820031de67079638e442f1ce9c832e1aecd1c269c7
3
+ metadata.gz: c7b77d132dd354766922104678c7a4b529f3b924f20413b8a6ccbdf195c5108d
4
+ data.tar.gz: e51b3d909eefe14218cc673a4071ee0f29d99782696c1a410f0bac77f5dcddbd
5
5
  SHA512:
6
- metadata.gz: 87444d4179940a53f8e1291072892ae9ace086a4dadd3ce6ca5d7e70b1260e645e6d6305290be1b8da4c127695aa091909d3f4512e94950672d4d84fb6de3eec
7
- data.tar.gz: 87f8f09ffc3c69f74ddbefc5d4f3a239b872562df991dd3427def92b232fb2ebbf005f98444878e36e491c57f9ed896b94b0fc7da550ca2ca7fcbb1c56aa1b1f
6
+ metadata.gz: 70d376abcd7908be0f558c279e353b1f492bb01bf373f009c6682184144dc76d3208897aefa6d3bdeb16bfb48db0419ab5985062dc1db5f0928534c70826e5ad
7
+ data.tar.gz: e8acce84987919108a0b3947af65efa8ef6c5dfb771377c0e012b4ad7e4ca98514c3d8ee6a16e9a0af0077d52b83a37a2deb79cc4641295ffdf6b286f775c27e
@@ -5,13 +5,22 @@ module Fastlane
5
5
  module Actions
6
6
  class IncrementBundleVersionAction < Action
7
7
  def self.run(params)
8
- ver_code = Fastlane::Actions::GetInfoPlistValueAction.run(path: params[:info_plist], key: "CFBundleVersion")
9
- new_ver = self.number?(ver_code).nil? ? nil : ver_code.to_i + 1
10
- if new_ver.nil?
11
- UI.user_error!("Failure - Increment bundle version #{params[:info_plist]} from #{ver_code} to #{new_ver}.")
8
+ org_version = Fastlane::Actions::GetInfoPlistValueAction.run(path: params[:info_plist], key: "CFBundleShortVersionString")
9
+ version = params[:version_number] || org_version
10
+ org_build = Fastlane::Actions::GetInfoPlistValueAction.run(path: params[:info_plist], key: "CFBundleVersion")
11
+ build = params[:build_number] || org_build
12
+ auto_increment = params[:auto_increment].nil? ? true : params[:auto_increment]
13
+ new_build = if self.number?(build).nil?
14
+ nil
15
+ else
16
+ auto_increment ? build.to_i + 1 : build.to_i
17
+ end
18
+ if new_build.nil?
19
+ UI.user_error!("Failure - Increment/Change bundle version #{params[:info_plist]} from #{org_build} to #{new_build} and change version from #{org_version} to #{version}.")
12
20
  else
13
- Fastlane::Actions::SetInfoPlistValueAction.run(path: params[:info_plist], key: "CFBundleVersion", value: new_ver.to_s)
14
- UI.success("Success - Increment bundle version #{params[:info_plist]} from #{ver_code} to #{new_ver}!")
21
+ Fastlane::Actions::SetInfoPlistValueAction.run(path: params[:info_plist], key: "CFBundleShortVersionString", value: version.to_s)
22
+ Fastlane::Actions::SetInfoPlistValueAction.run(path: params[:info_plist], key: "CFBundleVersion", value: new_build.to_s)
23
+ UI.success("Success - Increment/Change bundle version #{params[:info_plist]} from #{org_build} to #{new_build} and change version from #{org_version} to #{version}!")
15
24
  end
16
25
  end
17
26
 
@@ -41,10 +50,29 @@ module Fastlane
41
50
  FastlaneCore::ConfigItem.new(key: :info_plist,
42
51
  env_name: "FL_BUILD_NUMBER_INFO_PLIST",
43
52
  description: "optional, you must specify the path to your Info.plist file if it is not in the project root directory",
53
+ type: String,
44
54
  optional: true,
45
55
  verify_block: proc do |value|
46
56
  UI.user_error!("Could not find Info.plist") if !File.exist?(value) && !Helper.test?
47
57
  end),
58
+ FastlaneCore::ConfigItem.new(key: :version_number,
59
+ env_name: "FL_INCREMENT_BUILD_NUMBER_VERSION_NUMBER",
60
+ description: "Change to a specific version number. This will replace the bump type value",
61
+ type: String,
62
+ optional: true,
63
+ skip_type_validation: true),
64
+ FastlaneCore::ConfigItem.new(key: :build_number,
65
+ env_name: "FL_INCREMENT_BUILD_NUMBER_BUILD_NUMBER",
66
+ description: "Change to a specific build number",
67
+ type: String,
68
+ optional: true,
69
+ skip_type_validation: true),
70
+ FastlaneCore::ConfigItem.new(key: :auto_increment,
71
+ env_name: "FL_INCREMENT_BUILD_NUMBER_AUTO_INCREMENT",
72
+ description: "Auto increment version code from your AndroidManifest.xml's original version code",
73
+ type: Boolean,
74
+ optional: true,
75
+ default_value: true)
48
76
  ]
49
77
  end
50
78
 
@@ -8,15 +8,24 @@ module Fastlane
8
8
  require "nokogiri"
9
9
  require "open-uri"
10
10
 
11
- manifest = Nokogiri::XML(open(params[:manifest]))
12
- ver_code = manifest.xpath("//manifest").first["android:versionCode"]
13
- new_ver = self.number?(ver_code).nil? ? nil : ver_code.to_i + 1
14
- if new_ver.nil?
15
- UI.user_error!("Failure - Increment version code #{params[:manifest]} from #{ver_code} to #{new_ver}.")
11
+ manifest = Nokogiri::XML(File.open(params[:manifest]))
12
+ org_name = manifest.xpath("//manifest").first["android:versionName"]
13
+ ver_name = params[:version_name] || org_name
14
+ org_code = manifest.xpath("//manifest").first["android:versionCode"]
15
+ ver_code = params[:version_code] || org_code
16
+ auto_increment = params[:auto_increment].nil? ? true : params[:auto_increment]
17
+ new_code = if self.number?(ver_code).nil?
18
+ nil
19
+ else
20
+ auto_increment ? ver_code.to_i + 1 : ver_code.to_i
21
+ end
22
+ if new_code.nil?
23
+ UI.user_error!("Failure - Increment/Change version code #{params[:manifest]} from #{org_code} to #{new_code} and change version name from #{org_name} to #{ver_name}.")
16
24
  else
17
- manifest.xpath("//manifest").first["android:versionCode"] = new_ver
25
+ manifest.xpath("//manifest").first["android:versionName"] = ver_name
26
+ manifest.xpath("//manifest").first["android:versionCode"] = new_code
18
27
  File.write(params[:manifest], manifest.to_xml)
19
- UI.success("Success - Increment version code #{params[:manifest]} from #{ver_code} to #{new_ver}!")
28
+ UI.success("Success - Increment/Change version code #{params[:manifest]} from #{org_code} to #{new_code} and change version name from #{org_name} to #{ver_name}!")
20
29
  end
21
30
  end
22
31
 
@@ -44,12 +53,28 @@ module Fastlane
44
53
  def self.available_options
45
54
  [
46
55
  FastlaneCore::ConfigItem.new(key: :manifest,
47
- env_name: "FL_BUILD_NUMBER_MANIFEST",
56
+ env_name: "FL_INCREMENT_BUILD_NUMBER_MANIFEST",
48
57
  description: "optional, you must specify the path to your AndroidManifest.xml file if it is not in the project root directory",
49
58
  optional: true,
50
59
  verify_block: proc do |value|
51
60
  UI.user_error!("Could not find AndroidManifest.xml") if !File.exist?(value) && !Helper.test?
52
61
  end),
62
+ FastlaneCore::ConfigItem.new(key: :version_name,
63
+ env_name: "FL_INCREMENT_BUILD_NUMBER_VERSION_NAME",
64
+ description: "Change to a specific version name. This will replace the bump type value",
65
+ optional: true,
66
+ skip_type_validation: true),
67
+ FastlaneCore::ConfigItem.new(key: :version_code,
68
+ env_name: "FL_INCREMENT_BUILD_NUMBER_VERSION_CODE",
69
+ description: "Change to a specific version code.",
70
+ optional: true,
71
+ skip_type_validation: true),
72
+ FastlaneCore::ConfigItem.new(key: :auto_increment,
73
+ env_name: "FL_INCREMENT_BUILD_NUMBER_AUTO_INCREMENT",
74
+ description: "Auto increment version code from your AndroidManifest.xml's original version code",
75
+ type: Boolean,
76
+ optional: true,
77
+ default_value: true)
53
78
  ]
54
79
  end
55
80
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module IncrementBuildNumber
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-increment_build_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miyabi Ogino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-21 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.198.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
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'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: pry
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -150,20 +164,6 @@ dependencies:
150
164
  - - ">="
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: nokogiri
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
167
  description:
168
168
  email: miyabichan@aol.jp
169
169
  executables: []