fastlane-plugin-get_version_name 0.1.1 → 0.2.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fcf8bd3096c012bd0021cd1bd4a98b725e721aa
|
4
|
+
data.tar.gz: cbc6b224f1b4434ba7ee9b4b8ab91b4dea8edd42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 324c1832cc551eb9c2f897871c6d468bbafc650d2fdfce3b112b030f6b5c60384d1f192683b0387d72b3f382b63a5a8c5644cba07f6ca93cc18de06dd5ed7445
|
7
|
+
data.tar.gz: 520da19386364657e06a4e8065b39d1f409c805d451f26f193ee07e6a23a250d3c1a96f671ae0edb8329e0df2fa969fc4e1974ca55eaeee377ade6f61f55c2ec
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2016 Jérémy TOUDIC <jeremy.toudic@
|
3
|
+
Copyright (c) 2016 Jérémy TOUDIC <jeremy.toudic@gmail.com>
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -2,30 +2,26 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
class GetVersionNameAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
app_folder_name ||= params[:app_folder_name]
|
6
|
-
UI.message("The getversionname plugin is looking inside your project folder (#{app_folder_name})!")
|
7
|
-
|
8
5
|
version_name = "0"
|
6
|
+
constant_name ||= params[:ext_constant_name]
|
7
|
+
gradle_file_path ||= params[:gradle_file_path]
|
8
|
+
if gradle_file_path != nil
|
9
|
+
UI.message("The increment_version_code plugin will use gradle file at (#{gradle_file_path})!")
|
10
|
+
version_name = getVersionName(gradle_file_path, constant_name)
|
11
|
+
else
|
12
|
+
app_folder_name ||= params[:app_folder_name]
|
13
|
+
UI.message("The get_version_code plugin is looking inside your project folder (#{app_folder_name})!")
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
versionComponents = line.strip.split(' ')
|
16
|
-
version_name = versionComponents[1].tr("\"","")
|
17
|
-
break
|
18
|
-
end
|
19
|
-
end
|
20
|
-
file.close
|
21
|
-
rescue => err
|
22
|
-
UI.error("An exception occured while readinf gradle file: #{err}")
|
23
|
-
err
|
15
|
+
#temp_file = Tempfile.new('fastlaneIncrementVersionCode')
|
16
|
+
#foundVersionCode = "false"
|
17
|
+
Dir.glob("**/#{app_folder_name}/build.gradle") do |path|
|
18
|
+
UI.message(" -> Found a build.gradle file at path: (#{path})!")
|
19
|
+
version_name = getVersionName(path, constant_name)
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
27
23
|
if version_name == "0"
|
28
|
-
UI.user_error!("Impossible to find the version name
|
24
|
+
UI.user_error!("Impossible to find the version name with the specified properties 😭")
|
29
25
|
else
|
30
26
|
# Store the version name in the shared hash
|
31
27
|
Actions.lane_context["VERSION_NAME"]=version_name
|
@@ -36,6 +32,32 @@ module Fastlane
|
|
36
32
|
|
37
33
|
end
|
38
34
|
|
35
|
+
|
36
|
+
def self.getVersionName(path, constant_name)
|
37
|
+
version_name = "0"
|
38
|
+
if !File.file?(path)
|
39
|
+
UI.message(" -> No file exist at path: (#{path})!")
|
40
|
+
return version_name
|
41
|
+
end
|
42
|
+
begin
|
43
|
+
file = File.new(path, "r")
|
44
|
+
while (line = file.gets)
|
45
|
+
if line.include? constant_name
|
46
|
+
versionComponents = line.strip.split(' ')
|
47
|
+
version_name = versionComponents[versionComponents.length - 1].tr("\"","")
|
48
|
+
break
|
49
|
+
end
|
50
|
+
end
|
51
|
+
file.close
|
52
|
+
rescue => err
|
53
|
+
UI.error("An exception occured while readinf gradle file: #{err}")
|
54
|
+
err
|
55
|
+
end
|
56
|
+
return version_name
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
|
39
61
|
def self.description
|
40
62
|
"Get the version name of an Android project. This action will return the version name of your project according to the one set in your build.gradle file"
|
41
63
|
end
|
@@ -51,7 +73,19 @@ module Fastlane
|
|
51
73
|
description: "The name of the application source folder in the Android project (default: app)",
|
52
74
|
optional: true,
|
53
75
|
type: String,
|
54
|
-
default_value:"app")
|
76
|
+
default_value:"app"),
|
77
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file_path,
|
78
|
+
env_name: "GETVERSIONNAME_GRADLE_FILE_PATH",
|
79
|
+
description: "The relative path to the gradle file containing the version name parameter (default:app/build.gradle)",
|
80
|
+
optional: true,
|
81
|
+
type: String,
|
82
|
+
default_value: nil),
|
83
|
+
FastlaneCore::ConfigItem.new(key: :ext_constant_name,
|
84
|
+
env_name: "GETVERSIONNAME_EXT_CONSTANT_NAME",
|
85
|
+
description: "If the version name is set in an ext constant, specify the constant name (optional)",
|
86
|
+
optional: true,
|
87
|
+
type: String,
|
88
|
+
default_value: "versionName")
|
55
89
|
]
|
56
90
|
end
|
57
91
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-get_version_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Jems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|