fastlane-plugin-get_version_code 0.1.2 → 0.2.0
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: 9da0361fa95dde4ffc14be481ef6661a83e8a974
|
4
|
+
data.tar.gz: 3864980ae24b4051094b36c6cd0e2c52c15bb86e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 264f1e52ff9031591073f053f2e3297646ff54cfea894917734346489e7d27f6c7954bca511a8f98b3ea44b87b4126f748fcba2bbb67ef041202a23c0f1f2219
|
7
|
+
data.tar.gz: 3e18ef36164dc2f7216a51564749a44cfe0f020123790b14ab93a0a1e7aa40dbea4270ef0abda575444b2cdba018b2d1d2133b015b5ebc31d33d3a5bc7cca6a2
|
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,25 +2,22 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
class GetVersionCodeAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
app_folder_name ||= params[:app_folder_name]
|
6
|
-
UI.message("The get_version_code plugin is looking inside your project folder (#{app_folder_name})!")
|
7
|
-
|
8
5
|
version_code = "0"
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
UI.
|
23
|
-
|
7
|
+
constant_name ||= params[:ext_constant_name]
|
8
|
+
gradle_file_path ||= params[:gradle_file_path]
|
9
|
+
if gradle_file_path != nil
|
10
|
+
UI.message("The get_version_code plugin will use gradle file at (#{gradle_file_path})!")
|
11
|
+
version_code = getVersionCode(gradle_file_path, constant_name)
|
12
|
+
else
|
13
|
+
app_folder_name ||= params[:app_folder_name]
|
14
|
+
UI.message("The get_version_code plugin is looking inside your project folder (#{app_folder_name})!")
|
15
|
+
|
16
|
+
#temp_file = Tempfile.new('fastlaneIncrementVersionCode')
|
17
|
+
#foundVersionCode = "false"
|
18
|
+
Dir.glob("**/#{app_folder_name}/build.gradle") do |path|
|
19
|
+
UI.message(" -> Found a build.gradle file at path: (#{path})!")
|
20
|
+
version_code = getVersionCode(path, constant_name)
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
@@ -35,12 +32,35 @@ module Fastlane
|
|
35
32
|
return version_code
|
36
33
|
end
|
37
34
|
|
35
|
+
def self.getVersionCode(path, constant_name)
|
36
|
+
version_code = "0"
|
37
|
+
if !File.file?(path)
|
38
|
+
UI.message(" -> No file exist at path: (#{path})!")
|
39
|
+
return version_code
|
40
|
+
end
|
41
|
+
begin
|
42
|
+
file = File.new(path, "r")
|
43
|
+
while (line = file.gets)
|
44
|
+
if line.include? constant_name
|
45
|
+
versionComponents = line.strip.split(' ')
|
46
|
+
version_code = versionComponents[versionComponents.length - 1].tr("\"","")
|
47
|
+
break
|
48
|
+
end
|
49
|
+
end
|
50
|
+
file.close
|
51
|
+
rescue => err
|
52
|
+
UI.error("An exception occured while readinf gradle file: #{err}")
|
53
|
+
err
|
54
|
+
end
|
55
|
+
return version_code
|
56
|
+
end
|
57
|
+
|
38
58
|
def self.description
|
39
59
|
"Get the version code of an Android project. This action will return the version code of your project according to the one set in your build.gradle file"
|
40
60
|
end
|
41
61
|
|
42
62
|
def self.authors
|
43
|
-
["
|
63
|
+
["Jems"]
|
44
64
|
end
|
45
65
|
|
46
66
|
def self.available_options
|
@@ -50,7 +70,19 @@ module Fastlane
|
|
50
70
|
description: "The name of the application source folder in the Android project (default: app)",
|
51
71
|
optional: true,
|
52
72
|
type: String,
|
53
|
-
default_value:"app")
|
73
|
+
default_value:"app"),
|
74
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file_path,
|
75
|
+
env_name: "GETVERSIONCODE_GRADLE_FILE_PATH",
|
76
|
+
description: "The relative path to the gradle file containing the version code parameter (default:app/build.gradle)",
|
77
|
+
optional: true,
|
78
|
+
type: String,
|
79
|
+
default_value: nil),
|
80
|
+
FastlaneCore::ConfigItem.new(key: :ext_constant_name,
|
81
|
+
env_name: "GETVERSIONCODE_EXT_CONSTANT_NAME",
|
82
|
+
description: "If the version code is set in an ext constant, specify the constant name (optional)",
|
83
|
+
optional: true,
|
84
|
+
type: String,
|
85
|
+
default_value: "versionCode")
|
54
86
|
]
|
55
87
|
end
|
56
88
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-get_version_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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
|