fastlane-plugin-android_versioning 0.5.0 → 0.5.5

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
- SHA1:
3
- metadata.gz: 5c15697ef9a7304587fb5cbdbf519012d6cceb0d
4
- data.tar.gz: f7ac71706010a1df57618e567bf7899b10b938ce
2
+ SHA256:
3
+ metadata.gz: 745f98d04151c9106b767f1ae9ee53afdaf6218770019a24353f9f1c493313a4
4
+ data.tar.gz: 170a3ec0baa8a0fe69ea096646b963b9c4887901e8e5330420af1cd76d33681b
5
5
  SHA512:
6
- metadata.gz: ce8936e9d2c2db095bc2a1986de3e73c3973800e63d64453220cd03e59e48b5276668ffb12bbc763a5dd52ef994b3ef97733bb89364a07e719a8df9603ff745a
7
- data.tar.gz: 2006d4219e8775f5010fcf642a0ece4787965569283439bfe6c3c5050aa5fda263ceb4db13f3d7dfcbd34c8da397c0d1ca96926381ac849af42dd06b86c6195d
6
+ metadata.gz: 564d266aa0efe79e43e4339e63897826f622711c709cb78030b099fb6ae72d1b3a67727081268ea39320391b122c14deb384e563620bed3a16753165740c6824
7
+ data.tar.gz: e8ab43c7135842e3b1e382bce3a944600c5ed9505b9b162c2e4b54333d8774cca0056c8591a3b0c1fdacdec3ce2b3f6b3c15d8a0d891d7fadd94da276eaf0ed1
@@ -6,12 +6,34 @@ module Fastlane
6
6
  def self.run(params)
7
7
  app_project_dir ||= params[:app_project_dir]
8
8
  regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
9
+ flavor = params[:flavor]
10
+ flavorSpecified = !(flavor.nil? or flavor.empty?)
11
+ regex_flavor = Regexp.new(/[ \t]#{flavor}[ \t]/)
9
12
  value = ""
10
13
  found = false
14
+ flavorFound = false
15
+ productFlavorsSection = false
11
16
  Dir.glob("#{app_project_dir}/build.gradle") do |path|
17
+ UI.verbose("path: #{path}")
18
+ UI.verbose("absolute_path: #{File.expand_path(path)}")
12
19
  begin
13
20
  File.open(path, 'r') do |file|
14
21
  file.each_line do |line|
22
+
23
+ if flavorSpecified and !productFlavorsSection
24
+ unless line.include? "productFlavors"
25
+ next
26
+ end
27
+ productFlavorsSection = true
28
+ end
29
+
30
+ if flavorSpecified and !flavorFound
31
+ unless line.match(regex_flavor)
32
+ next
33
+ end
34
+ flavorFound = true
35
+ end
36
+
15
37
  unless line.match(regex) and !found
16
38
  next
17
39
  end
@@ -36,6 +58,11 @@ module Fastlane
36
58
  optional: true,
37
59
  type: String,
38
60
  default_value: "android/app"),
61
+ FastlaneCore::ConfigItem.new(key: :flavor,
62
+ env_name: "ANDROID_VERSIONING_FLAVOR",
63
+ description: "The product flavor name (optional)",
64
+ optional: true,
65
+ type: String),
39
66
  FastlaneCore::ConfigItem.new(key: :key,
40
67
  description: "The property key",
41
68
  type: String)
@@ -6,6 +6,7 @@ module Fastlane
6
6
  def self.run(params)
7
7
  GetValueFromBuildAction.run(
8
8
  app_project_dir: params[:app_project_dir],
9
+ flavor: params[:flavor],
9
10
  key: "versionCode"
10
11
  )
11
12
  end
@@ -20,7 +21,12 @@ module Fastlane
20
21
  description: "The path to the application source folder in the Android project (default: android/app)",
21
22
  optional: true,
22
23
  type: String,
23
- default_value: "android/app")
24
+ default_value: "android/app"),
25
+ FastlaneCore::ConfigItem.new(key: :flavor,
26
+ env_name: "ANDROID_VERSIONING_FLAVOR",
27
+ description: "The product flavor name (optional)",
28
+ optional: true,
29
+ type: String)
24
30
  ]
25
31
  end
26
32
 
@@ -6,6 +6,7 @@ module Fastlane
6
6
  def self.run(params)
7
7
  GetValueFromBuildAction.run(
8
8
  app_project_dir: params[:app_project_dir],
9
+ flavor: params[:flavor],
9
10
  key: "versionName"
10
11
  )
11
12
  end
@@ -20,7 +21,12 @@ module Fastlane
20
21
  description: "The path to the application source folder in the Android project (default: android/app)",
21
22
  optional: true,
22
23
  type: String,
23
- default_value: "android/app")
24
+ default_value: "android/app"),
25
+ FastlaneCore::ConfigItem.new(key: :flavor,
26
+ env_name: "ANDROID_VERSIONING_FLAVOR",
27
+ description: "The product flavor name (optional)",
28
+ optional: true,
29
+ type: String)
24
30
  ]
25
31
  end
26
32
 
@@ -21,6 +21,7 @@ module Fastlane
21
21
 
22
22
  SetValueInBuildAction.run(
23
23
  app_project_dir: params[:app_project_dir],
24
+ flavor: params[:flavor],
24
25
  key: "versionCode",
25
26
  value: new_version_code
26
27
  )
@@ -39,6 +40,11 @@ module Fastlane
39
40
  optional: true,
40
41
  type: String,
41
42
  default_value: "android/app"),
43
+ FastlaneCore::ConfigItem.new(key: :flavor,
44
+ env_name: "ANDROID_VERSIONING_FLAVOR",
45
+ description: "The product flavor name (optional)",
46
+ optional: true,
47
+ type: String),
42
48
  FastlaneCore::ConfigItem.new(key: :version_code,
43
49
  env_name: "ANDROID_VERSIONING_VERSION_CODE",
44
50
  description: "Change to a specific version (optional)",
@@ -31,6 +31,7 @@ module Fastlane
31
31
  end
32
32
  SetValueInBuildAction.run(
33
33
  app_project_dir: params[:app_project_dir],
34
+ flavor: params[:flavor],
34
35
  key: "versionName",
35
36
  value: new_version
36
37
  )
@@ -49,6 +50,11 @@ module Fastlane
49
50
  optional: true,
50
51
  type: String,
51
52
  default_value: "android/app"),
53
+ FastlaneCore::ConfigItem.new(key: :flavor,
54
+ env_name: "ANDROID_VERSIONING_FLAVOR",
55
+ description: "The product flavor name (optional)",
56
+ optional: true,
57
+ type: String),
52
58
  FastlaneCore::ConfigItem.new(key: :bump_type,
53
59
  env_name: "ANDROID_VERSIONING_BUMP_TYPE",
54
60
  description: "Change to a specific type (optional)",
@@ -6,13 +6,35 @@ module Fastlane
6
6
  class SetValueInBuildAction < Action
7
7
  def self.run(params)
8
8
  app_project_dir ||= params[:app_project_dir]
9
- regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
9
+ regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\-\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
10
+ flavor = params[:flavor]
11
+ flavorSpecified = !(flavor.nil? or flavor.empty?)
12
+ regex_flavor = Regexp.new(/[ \t]#{flavor}[ \t]/)
10
13
  found = false
14
+ productFlavorsSection = false
15
+ flavorFound = false
11
16
  Dir.glob("#{app_project_dir}/build.gradle") do |path|
12
17
  begin
13
18
  temp_file = Tempfile.new('versioning')
14
19
  File.open(path, 'r') do |file|
15
20
  file.each_line do |line|
21
+
22
+ if flavorSpecified and !productFlavorsSection
23
+ unless line.include? "productFlavors" or productFlavorsSection
24
+ temp_file.puts line
25
+ next
26
+ end
27
+ productFlavorsSection = true
28
+ end
29
+
30
+ if flavorSpecified and !flavorFound
31
+ unless line.match(regex_flavor)
32
+ temp_file.puts line
33
+ next
34
+ end
35
+ flavorFound = true
36
+ end
37
+
16
38
  unless line.match(regex) and !found
17
39
  temp_file.puts line
18
40
  next
@@ -42,6 +64,11 @@ module Fastlane
42
64
  optional: true,
43
65
  type: String,
44
66
  default_value: "android/app"),
67
+ FastlaneCore::ConfigItem.new(key: :flavor,
68
+ env_name: "ANDROID_VERSIONING_FLAVOR",
69
+ description: "The product flavor name (optional)",
70
+ optional: true,
71
+ type: String),
45
72
  FastlaneCore::ConfigItem.new(key: :key,
46
73
  description: "The property key",
47
74
  type: String),
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AndroidVersioning
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-android_versioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu OHTAKE
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2022-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.17.0
97
- description:
97
+ description:
98
98
  email: manabu2783@hotmail.com
99
99
  executables: []
100
100
  extensions: []
@@ -114,7 +114,7 @@ homepage: https://github.com/otkmnb2783/fastlane-plugin-android_versioning
114
114
  licenses:
115
115
  - MIT
116
116
  metadata: {}
117
- post_install_message:
117
+ post_install_message:
118
118
  rdoc_options: []
119
119
  require_paths:
120
120
  - lib
@@ -129,9 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubyforge_project:
133
- rubygems_version: 2.6.14.1
134
- signing_key:
132
+ rubygems_version: 3.1.6
133
+ signing_key:
135
134
  specification_version: 4
136
135
  summary: Allows to set/get app version name and version code directly to/from build.gradle
137
136
  test_files: []