fastlane-plugin-unity_exporter 1.1.0 → 1.2.0

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
  SHA256:
3
- metadata.gz: 7bff3d2d963ce751f8770a2e461b1765637ef1a4d7a274ff48b9de6be392f0e3
4
- data.tar.gz: d57e0104dd2d54504d384681ad84d6f39a811c7e5e321e2eecad2421e9718a1f
3
+ metadata.gz: 5f871c4202b1c52b9d5d719312834f66f9374a6a16319925a6e39d5d3f87f258
4
+ data.tar.gz: 6c74a627ee70148c1b27d52421f5bf275d5ce2405c60588db6abeee04dcded2e
5
5
  SHA512:
6
- metadata.gz: 4f02ef24f177fd4885bf28b2d6c1470ced2ec9ef45c00c9105001a1962053f3a67403991a9e029e85d53064dba5ae5e091e7731098945bd14a008b3c8f3e0300
7
- data.tar.gz: 31b2a74cf72c8c38a4c9272984ac9104600b063982eebaf66b40a409ab46a8c257560f6176d19b7b9fae97eea76a2dfa74bb9c7cf016fcd1e7af6533cc5adea3
6
+ metadata.gz: e62253ae48ffaa41ee6a62ce09e91b0d10dcc610e05216ddec73414ea2f1d295263c95117289fd9ca33c0622036f98e9e7d44cddb3fedf360e4245378a569aa9
7
+ data.tar.gz: 3ce7dc870812337f11e80c9de94910697b47278dc98b31d51dbffe7b5006516bbb7b07342693269ee624d818000a931c4d31c9e4fecb4d4a9e63d6ae8e916482
data/README.md CHANGED
@@ -117,6 +117,28 @@ unity_export(build_target: "...", new_version: "3.4.5", new_version_code: "0")
117
117
  unity_commit_version_bump
118
118
  ```
119
119
 
120
+ ### Using `unity_get_version_number`
121
+
122
+ ```ruby
123
+ # you must first use the unity export action
124
+ unity_export(...)
125
+
126
+ # afterwards you can get the version number like so
127
+ # note that an error code will be returned if something fails
128
+ version_number = unity_get_version_number
129
+ ```
130
+
131
+ ### Using `unity_get_build_number`
132
+
133
+ ```ruby
134
+ # you must first use the unity export action
135
+ unity_export(...)
136
+
137
+ # afterwards you can get the build number like so
138
+ # note that an error code will be returned if something fails
139
+ build_number = unity_get_build_number
140
+ ```
141
+
120
142
 
121
143
  ## Example
122
144
 
@@ -1,5 +1,6 @@
1
1
  require 'fastlane/action'
2
2
  require_relative '../helper/unity_editor_helper'
3
+ require_relative '../helper/generic_helper'
3
4
 
4
5
  module Fastlane
5
6
  module Actions
@@ -8,7 +9,7 @@ module Fastlane
8
9
  # TODO: improve the commit command: currently it simply commits the ProjectSettings file
9
10
  # what if there are other changes in the file and you don't want these changes to be part of the commit
10
11
 
11
- log_file = "unity-export-logs/#{DateTime.now.strftime('%Y-%m-%d_%H-%M-%S-%L')}_git.log"
12
+ log_file = Helper::GenericHelper.instance_variable_get(:@git_log_path)
12
13
 
13
14
  # Thank you: https://linuxize.com/post/bash-redirect-stderr-stdout/#redirecting-stderr-to-stdout
14
15
  sh("echo 'UnityCommitVersionBumpAction: created file' > #{log_file} 2>&1")
@@ -18,7 +18,7 @@ module Fastlane
18
18
 
19
19
  elsif params[:build_target]
20
20
  if params[:project_path]
21
- Helper::UnityEditorHelper.class_variable_set(:@@projectPath, params[:project_path])
21
+ Helper::UnityEditorHelper.instance_variable_set(:@project_path, params[:project_path])
22
22
  end
23
23
 
24
24
  # following are arguments as defined in the docs: https://docs.unity3d.com/Manual/CommandLineArguments.html
@@ -0,0 +1,44 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/unity_editor_helper'
3
+ require_relative '../helper/generic_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class UnityGetBuildNumberAction < Action
8
+ def self.run(params)
9
+ build_number = Helper::GenericHelper.build_exporter_build_number
10
+ if build_number == ""
11
+ return "unity_exporter_error_occurred"
12
+ end
13
+
14
+ return build_number
15
+ end
16
+
17
+ def self.description
18
+ "Will get the build number that was used for the latest Unity export action. Therefore make sure to call the Unity export action before you use this action."
19
+ end
20
+
21
+ def self.authors
22
+ ["steft"]
23
+ end
24
+
25
+ def self.return_value
26
+ "Returns the build number that was used for the latest Unity export action. In case of error will return 'unity_exporter_error_occurred'."
27
+ end
28
+
29
+ def self.details
30
+ # Optional:
31
+ end
32
+
33
+ def self.available_options
34
+ end
35
+
36
+ def self.is_supported?(platform)
37
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
38
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
39
+ [:ios, :android].include?(platform)
40
+ true
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/unity_editor_helper'
3
+ require_relative '../helper/generic_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class UnityGetVersionNumberAction < Action
8
+ def self.run(params)
9
+ version_number = Helper::GenericHelper.build_exporter_version_number
10
+ if version_number == ""
11
+ return "unity_exporter_error_occurred"
12
+ end
13
+
14
+ return version_number
15
+ end
16
+
17
+ def self.description
18
+ "Will get the version number that was used for the latest Unity export action. Therefore make sure to call the Unity export action before you use this action."
19
+ end
20
+
21
+ def self.authors
22
+ ["steft"]
23
+ end
24
+
25
+ def self.return_value
26
+ "Returns the version number that was used for the latest Unity export action. In case of error will return 'unity_exporter_error_occurred'."
27
+ end
28
+
29
+ def self.details
30
+ # Optional:
31
+ end
32
+
33
+ def self.available_options
34
+ end
35
+
36
+ def self.is_supported?(platform)
37
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
38
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
39
+ [:ios, :android].include?(platform)
40
+ true
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,11 +1,46 @@
1
1
  require 'fastlane_core/ui/ui'
2
2
  require 'shellwords'
3
+ require_relative './unity_editor_helper'
3
4
 
4
5
  module Fastlane
5
6
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
7
 
7
8
  module Helper
8
9
  class GenericHelper
10
+ @git_log_path = "fastlane-unity-exporter/logs/#{DateTime.now.strftime('%Y-%m-%d_%H-%M-%S-%L')}_git.log"
11
+
12
+ def self.build_exporter_versions
13
+ # this is created and updated whenever you create a build via the build exporter
14
+ build_exporter_versions_file = "#{Helper::UnityEditorHelper.unity_project_path}/BuildExporter/latest-build-version.txt"
15
+
16
+ if File.file?(build_exporter_versions_file)
17
+ return File.readlines(build_exporter_versions_file, chomp: true)
18
+ else
19
+ UI.user_error!("Versions file does not exist yet. You must execute the Unity export action beforehand.")
20
+ return []
21
+ end
22
+ end
23
+
24
+ def self.build_exporter_version_number
25
+ versions = build_exporter_versions
26
+
27
+ if versions.count > 0
28
+ return versions[0]
29
+ else
30
+ return ""
31
+ end
32
+ end
33
+
34
+ def self.build_exporter_build_number
35
+ versions = build_exporter_versions
36
+
37
+ if versions.count > 0
38
+ return versions[1]
39
+ else
40
+ return ""
41
+ end
42
+ end
43
+
9
44
  def self.shellify(path)
10
45
  if FastlaneCore::Helper.is_mac?
11
46
  return Shellwords.escape(path)
@@ -10,11 +10,12 @@ module Fastlane
10
10
  class UnityEditorHelper
11
11
  # project path relative if following hierarchy is given: "root/{unity-project}/fastlane-build-exporter/{platform}-export/."
12
12
  # p File.expand_path("../../")
13
- @@projectPathDefault = "../../"
14
- @@projectPath = ""
13
+ @project_path_default = "../../"
14
+ @project_path = ""
15
15
 
16
16
  def self.unity_project_path
17
- return @@projectPath if @@projectPath != ""
17
+ return @project_path if @project_path != ""
18
+
18
19
  return "../../"
19
20
  end
20
21
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module UnityExporter
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-unity_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ar:met
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-12 00:00:00.000000000 Z
11
+ date: 2022-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -161,6 +161,8 @@ files:
161
161
  - lib/fastlane/plugin/unity_exporter.rb
162
162
  - lib/fastlane/plugin/unity_exporter/actions/unity_commit_version_bump.rb
163
163
  - lib/fastlane/plugin/unity_exporter/actions/unity_export.rb
164
+ - lib/fastlane/plugin/unity_exporter/actions/unity_get_build_number.rb
165
+ - lib/fastlane/plugin/unity_exporter/actions/unity_get_version_number.rb
164
166
  - lib/fastlane/plugin/unity_exporter/helper/generic_helper.rb
165
167
  - lib/fastlane/plugin/unity_exporter/helper/unity_editor_helper.rb
166
168
  - lib/fastlane/plugin/unity_exporter/helper/unity_hub_helper.rb