fastlane-plugin-unity_exporter 1.2.0 → 1.3.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: 5f871c4202b1c52b9d5d719312834f66f9374a6a16319925a6e39d5d3f87f258
4
- data.tar.gz: 6c74a627ee70148c1b27d52421f5bf275d5ce2405c60588db6abeee04dcded2e
3
+ metadata.gz: 1a1b16db5c56d81b08d0c944ddfde6d5e3295d714ec07cb0ed0155faa663ea21
4
+ data.tar.gz: f84cc70bd9024acd8df427efad57d3dbd1c58e8855fd35eed5a60643651cf10e
5
5
  SHA512:
6
- metadata.gz: e62253ae48ffaa41ee6a62ce09e91b0d10dcc610e05216ddec73414ea2f1d295263c95117289fd9ca33c0622036f98e9e7d44cddb3fedf360e4245378a569aa9
7
- data.tar.gz: 3ce7dc870812337f11e80c9de94910697b47278dc98b31d51dbffe7b5006516bbb7b07342693269ee624d818000a931c4d31c9e4fecb4d4a9e63d6ae8e916482
6
+ metadata.gz: e126535a70b41d1a67d8d6939c7d426fcac0e5138c96d9ba13f902899ab6e02f3f4bad882e8f98b5df651fa76fa4b9a90a5ca0a30ff60978fa059b248ef5f401
7
+ data.tar.gz: 365a6cd6106ca841fc0e59baa8ca837fa3c8c3ba1bd096453950ce3895b2b23a47fe324c8182ab247d2ae66f19c90b924b9dc57326a47c1cdd3bbaceda235ff4
data/README.md CHANGED
@@ -115,6 +115,12 @@ unity_export(build_target: "...", new_version: "3.4.5", new_version_code: "0")
115
115
 
116
116
  # after the export is finished, we commit the version bump
117
117
  unity_commit_version_bump
118
+
119
+ # another invocation example that specifies a project path
120
+ # the expected default path is in accordance with the "getting started" section of this readme
121
+ # if a custom path to the Unity project is required, it's specified this way
122
+ # note that the starting point for relative paths is the directory that contains the 'fastlane' folder
123
+ unity_commit_version_bump(project_path: "path/some-example-unity-projects-directory")
118
124
  ```
119
125
 
120
126
  ### Using `unity_get_version_number`
@@ -126,6 +132,12 @@ unity_export(...)
126
132
  # afterwards you can get the version number like so
127
133
  # note that an error code will be returned if something fails
128
134
  version_number = unity_get_version_number
135
+
136
+ # another invocation example that specifies a project path
137
+ # the expected default path is in accordance with the "getting started" section of this readme
138
+ # if a custom path to the Unity project is required, it's specified this way
139
+ # note that the starting point for relative paths is the directory that contains the 'fastlane' folder
140
+ version_number = unity_get_version_number(project_path: "path/some-example-unity-projects-directory")
129
141
  ```
130
142
 
131
143
  ### Using `unity_get_build_number`
@@ -137,6 +149,12 @@ unity_export(...)
137
149
  # afterwards you can get the build number like so
138
150
  # note that an error code will be returned if something fails
139
151
  build_number = unity_get_build_number
152
+
153
+ # another invocation example that specifies a project path
154
+ # the expected default path is in accordance with the "getting started" section of this readme
155
+ # if a custom path to the Unity project is required, it's specified this way
156
+ # note that the starting point for relative paths is the directory that contains the 'fastlane' folder
157
+ build_number = unity_get_build_number(project_path: "path/some-example-unity-projects-directory")
140
158
  ```
141
159
 
142
160
 
@@ -6,6 +6,10 @@ module Fastlane
6
6
  module Actions
7
7
  class UnityCommitVersionBumpAction < Action
8
8
  def self.run(params)
9
+ if params[:project_path]
10
+ Helper::UnityEditorHelper.instance_variable_set(:@project_path, params[:project_path])
11
+ end
12
+
9
13
  # TODO: improve the commit command: currently it simply commits the ProjectSettings file
10
14
  # what if there are other changes in the file and you don't want these changes to be part of the commit
11
15
 
@@ -34,6 +38,14 @@ module Fastlane
34
38
  end
35
39
 
36
40
  def self.available_options
41
+ [
42
+ FastlaneCore::ConfigItem.new(key: :project_path,
43
+ env_name: "FL_UNITY_PROJECT_PATH",
44
+ description: "The path to the Unity project. The starting point for relative paths is the directory that contains the 'fastlane' folder",
45
+ optional: true,
46
+ type: String,
47
+ conflicting_options: [:arguments])
48
+ ]
37
49
  end
38
50
 
39
51
  def self.is_supported?(platform)
@@ -1,12 +1,16 @@
1
1
  require 'fastlane/action'
2
2
  require_relative '../helper/unity_editor_helper'
3
- require_relative '../helper/generic_helper'
3
+ require_relative '../helper/build_exporter_helper'
4
4
 
5
5
  module Fastlane
6
6
  module Actions
7
7
  class UnityGetBuildNumberAction < Action
8
8
  def self.run(params)
9
- build_number = Helper::GenericHelper.build_exporter_build_number
9
+ if params[:project_path]
10
+ Helper::UnityEditorHelper.instance_variable_set(:@project_path, params[:project_path])
11
+ end
12
+
13
+ build_number = Helper::BuildExporterHelper.build_number
10
14
  if build_number == ""
11
15
  return "unity_exporter_error_occurred"
12
16
  end
@@ -31,6 +35,14 @@ module Fastlane
31
35
  end
32
36
 
33
37
  def self.available_options
38
+ [
39
+ FastlaneCore::ConfigItem.new(key: :project_path,
40
+ env_name: "FL_UNITY_PROJECT_PATH",
41
+ description: "The path to the Unity project. The starting point for relative paths is the directory that contains the 'fastlane' folder",
42
+ optional: true,
43
+ type: String,
44
+ conflicting_options: [:arguments])
45
+ ]
34
46
  end
35
47
 
36
48
  def self.is_supported?(platform)
@@ -1,12 +1,16 @@
1
1
  require 'fastlane/action'
2
2
  require_relative '../helper/unity_editor_helper'
3
- require_relative '../helper/generic_helper'
3
+ require_relative '../helper/build_exporter_helper'
4
4
 
5
5
  module Fastlane
6
6
  module Actions
7
7
  class UnityGetVersionNumberAction < Action
8
8
  def self.run(params)
9
- version_number = Helper::GenericHelper.build_exporter_version_number
9
+ if params[:project_path]
10
+ Helper::UnityEditorHelper.instance_variable_set(:@project_path, params[:project_path])
11
+ end
12
+
13
+ version_number = Helper::BuildExporterHelper.version_number
10
14
  if version_number == ""
11
15
  return "unity_exporter_error_occurred"
12
16
  end
@@ -31,6 +35,14 @@ module Fastlane
31
35
  end
32
36
 
33
37
  def self.available_options
38
+ [
39
+ FastlaneCore::ConfigItem.new(key: :project_path,
40
+ env_name: "FL_UNITY_PROJECT_PATH",
41
+ description: "The path to the Unity project. The starting point for relative paths is the directory that contains the 'fastlane' folder",
42
+ optional: true,
43
+ type: String,
44
+ conflicting_options: [:arguments])
45
+ ]
34
46
  end
35
47
 
36
48
  def self.is_supported?(platform)
@@ -0,0 +1,44 @@
1
+ require 'fastlane_core/ui/ui'
2
+ require 'shellwords'
3
+ require_relative './unity_editor_helper'
4
+
5
+ module Fastlane
6
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
7
+
8
+ module Helper
9
+ # a helper class specific to the Unity-Build-Exporter package: https://github.com/ar-met/unity-build-exporter
10
+ class BuildExporterHelper
11
+ def self.versions_file_content
12
+ # this is created and updated whenever you create a build via the build exporter
13
+ build_exporter_versions_file = "#{Helper::UnityEditorHelper.unity_project_path}/BuildExporter/latest-build-version.txt"
14
+
15
+ if File.file?(build_exporter_versions_file)
16
+ return File.readlines(build_exporter_versions_file, chomp: true)
17
+ else
18
+ UI.user_error!("Versions file does not exist yet. You must execute the Unity export action beforehand.")
19
+ return []
20
+ end
21
+ end
22
+
23
+ def self.version_number
24
+ versions = versions_file_content
25
+
26
+ if versions.count > 0
27
+ return versions[0]
28
+ else
29
+ return ""
30
+ end
31
+ end
32
+
33
+ def self.build_number
34
+ versions = versions_file_content
35
+
36
+ if versions.count > 0
37
+ return versions[1]
38
+ else
39
+ return ""
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,6 +1,5 @@
1
1
  require 'fastlane_core/ui/ui'
2
2
  require 'shellwords'
3
- require_relative './unity_editor_helper'
4
3
 
5
4
  module Fastlane
6
5
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
@@ -9,38 +8,6 @@ module Fastlane
9
8
  class GenericHelper
10
9
  @git_log_path = "fastlane-unity-exporter/logs/#{DateTime.now.strftime('%Y-%m-%d_%H-%M-%S-%L')}_git.log"
11
10
 
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
-
44
11
  def self.shellify(path)
45
12
  if FastlaneCore::Helper.is_mac?
46
13
  return Shellwords.escape(path)
@@ -14,9 +14,15 @@ module Fastlane
14
14
  @project_path = ""
15
15
 
16
16
  def self.unity_project_path
17
- return @project_path if @project_path != ""
17
+ project_path = @project_path == "" ? "../../" : @project_path
18
18
 
19
- return "../../"
19
+ # we verify the path to the Unity project by looking for the 'manifest.json' file
20
+ package_manifest_path = "#{project_path}/Packages/manifest.json"
21
+ unless File.file?(package_manifest_path)
22
+ UI.user_error!("Cannot find 'manifest.json' at '#{package_manifest_path}'. Make sure that the Unity project path is properly set.")
23
+ end
24
+
25
+ return project_path
20
26
  end
21
27
 
22
28
  def self.unity_editor_path
@@ -67,14 +73,7 @@ module Fastlane
67
73
  end
68
74
 
69
75
  package_manifest_path = "#{relative_path}/Packages/manifest.json"
70
-
71
- # we verify the path to the Unity project by looking for the 'manifest.json' file
72
- if File.file?(package_manifest_path)
73
- return File.read(package_manifest_path)
74
- else
75
- UI.user_error!("Cannot find 'manifest.json' at '#{package_manifest_path}'. Make sure that the Unity project path is properly set.")
76
- return ""
77
- end
76
+ return File.read(package_manifest_path)
78
77
  end
79
78
 
80
79
  def self.load_unity_project_version
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module UnityExporter
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-unity_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ar:met
@@ -163,6 +163,7 @@ files:
163
163
  - lib/fastlane/plugin/unity_exporter/actions/unity_export.rb
164
164
  - lib/fastlane/plugin/unity_exporter/actions/unity_get_build_number.rb
165
165
  - lib/fastlane/plugin/unity_exporter/actions/unity_get_version_number.rb
166
+ - lib/fastlane/plugin/unity_exporter/helper/build_exporter_helper.rb
166
167
  - lib/fastlane/plugin/unity_exporter/helper/generic_helper.rb
167
168
  - lib/fastlane/plugin/unity_exporter/helper/unity_editor_helper.rb
168
169
  - lib/fastlane/plugin/unity_exporter/helper/unity_hub_helper.rb