fastlane-plugin-android_versioning 0.5.1 → 0.5.3

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
  SHA1:
3
- metadata.gz: 8d58c9d85d39b8503d7ee40abca62f2c07950785
4
- data.tar.gz: 14dbee51039e198aef515cded31ee201c30089e9
3
+ metadata.gz: 82b09a7fe923b9f8ea150119279f720113464ac0
4
+ data.tar.gz: 3b549baf3c47f66b91aa11c72c0c49662278eec2
5
5
  SHA512:
6
- metadata.gz: e367118d9378586d998c9800863f2f73e73868ae94227afefd07e3c68fc2e87247501aa9b5837ac8c764738bf675c4dbef73db5442831b9bfc390f828a064566
7
- data.tar.gz: c3f2f17a0752f4bb72d52b133a0926907f03662278f940736724361ffbfebf00788a98544470934449c1141afd4f221b1847bacdff50636af3286f6892121dbd
6
+ metadata.gz: cda70a5d6148c970c49f6f6f4fbe716becc2a0a7374485c406e2441255598a086914925c2d43986c2694cb24e41d6dc5d4b0c5d84a90869f5d5779d0c3a87e5b
7
+ data.tar.gz: b8c01e2954e8d08c91318d3fc7db8d6d33d436e5da3f1eb4fa64b0df91a624f49deb4cfa9f6312b0c0004447c3e7a44211ed35c68c5745712231cdf07e87ba92
@@ -6,14 +6,33 @@ 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?)
9
11
  value = ""
10
12
  found = false
13
+ flavorFound = false
14
+ productFlavorsSection = false
11
15
  Dir.glob("#{app_project_dir}/build.gradle") do |path|
12
16
  UI.verbose("path: #{path}")
13
17
  UI.verbose("absolute_path: #{File.expand_path(path)}")
14
18
  begin
15
19
  File.open(path, 'r') do |file|
16
20
  file.each_line do |line|
21
+
22
+ if flavorSpecified and !productFlavorsSection
23
+ unless line.include? "productFlavors"
24
+ next
25
+ end
26
+ productFlavorsSection = true
27
+ end
28
+
29
+ if flavorSpecified and !flavorFound
30
+ unless line.include? " #{flavor} "
31
+ next
32
+ end
33
+ flavorFound = true
34
+ end
35
+
17
36
  unless line.match(regex) and !found
18
37
  next
19
38
  end
@@ -38,6 +57,11 @@ module Fastlane
38
57
  optional: true,
39
58
  type: String,
40
59
  default_value: "android/app"),
60
+ FastlaneCore::ConfigItem.new(key: :flavor,
61
+ env_name: "ANDROID_VERSIONING_FLAVOR",
62
+ description: "The product flavor name (optional)",
63
+ optional: true,
64
+ type: String),
41
65
  FastlaneCore::ConfigItem.new(key: :key,
42
66
  description: "The property key",
43
67
  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)",
@@ -7,12 +7,33 @@ module Fastlane
7
7
  def self.run(params)
8
8
  app_project_dir ||= params[:app_project_dir]
9
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?)
10
12
  found = false
13
+ productFlavorsSection = false
14
+ flavorFound = false
11
15
  Dir.glob("#{app_project_dir}/build.gradle") do |path|
12
16
  begin
13
17
  temp_file = Tempfile.new('versioning')
14
18
  File.open(path, 'r') do |file|
15
19
  file.each_line do |line|
20
+
21
+ if flavorSpecified and !productFlavorsSection
22
+ unless line.include? "productFlavors" or productFlavorsSection
23
+ temp_file.puts line
24
+ next
25
+ end
26
+ productFlavorsSection = true
27
+ end
28
+
29
+ if flavorSpecified and !flavorFound
30
+ unless line.include? " #{flavor} "
31
+ temp_file.puts line
32
+ next
33
+ end
34
+ flavorFound = true
35
+ end
36
+
16
37
  unless line.match(regex) and !found
17
38
  temp_file.puts line
18
39
  next
@@ -42,6 +63,11 @@ module Fastlane
42
63
  optional: true,
43
64
  type: String,
44
65
  default_value: "android/app"),
66
+ FastlaneCore::ConfigItem.new(key: :flavor,
67
+ env_name: "ANDROID_VERSIONING_FLAVOR",
68
+ description: "The product flavor name (optional)",
69
+ optional: true,
70
+ type: String),
45
71
  FastlaneCore::ConfigItem.new(key: :key,
46
72
  description: "The property key",
47
73
  type: String),
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AndroidVersioning
3
- VERSION = "0.5.1"
3
+ VERSION = "0.5.3"
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.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu OHTAKE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-06 00:00:00.000000000 Z
11
+ date: 2020-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry