fastlane-plugin-applitoolsify 0.1.0 → 0.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bda9f029ce7b97e2ddd85897cdcb135c1df52e3869d6607bd3fed4fd8d81793
|
4
|
+
data.tar.gz: c629369f2a8b96b8b52d625ef42eccc50a9b8cf2687939335c9c12e814492beb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8878eedccf46efcbbdf5c7cc618abb3e9040e6a6f69ae3fcfbdd9b9c182d2a2e8bab99531378ce75ae4c26ad9338ddd52659aa4d1d4853644e94d0b5b59b8cc
|
7
|
+
data.tar.gz: bfed75f08acac1608c5080177c073852d9aba74a6e57a736f0023a867ba78f99eea161dd152482f553aca9972e0b614b8cdd8f1d9fce2666ba98f58312b3c88a
|
@@ -6,6 +6,21 @@ module Fastlane
|
|
6
6
|
class ApplitoolsifyAction < Action
|
7
7
|
def self.run(params)
|
8
8
|
UI.message("The applitoolsify plugin is working!")
|
9
|
+
UI.message("Parameter Input Path: #{params[:applitoolsify_input]} >")
|
10
|
+
|
11
|
+
input = params[:applitoolsify_input]
|
12
|
+
output = params[:applitoolsify_output]
|
13
|
+
if output.nil?
|
14
|
+
output = input
|
15
|
+
UI.message("Parameter Output Empty using Input to Overwrite: > #{output}")
|
16
|
+
else
|
17
|
+
UI.message("Parameter Output Path: > #{params[:applitoolsify_output]}")
|
18
|
+
FileUtils.cp(input, output)
|
19
|
+
end
|
20
|
+
|
21
|
+
app_name = File.basename(input)
|
22
|
+
Helper::ApplitoolsifyHelper.applitoolsify(output, app_name)
|
23
|
+
UI.message("The applitoolsify plugin finish working!")
|
9
24
|
end
|
10
25
|
|
11
26
|
def self.description
|
@@ -32,6 +47,20 @@ module Fastlane
|
|
32
47
|
# description: "A description of your option",
|
33
48
|
# optional: false,
|
34
49
|
# type: String)
|
50
|
+
FastlaneCore::ConfigItem.new(key: :applitoolsify_input,
|
51
|
+
env_name: "APPLITOOLSIFY_INPUT",
|
52
|
+
description: "Path to your original file to modify",
|
53
|
+
optional: false,
|
54
|
+
type: String,
|
55
|
+
verify_block: proc do |value|
|
56
|
+
UI.user_error!("Could not find file at path '#{File.expand_path(value)}'") unless File.exist?(value)
|
57
|
+
UI.user_error!("'#{value}' doesn't seem to be an valid file") unless value.end_with?(".ipa") || value.end_with?(".app")
|
58
|
+
end),
|
59
|
+
FastlaneCore::ConfigItem.new(key: :applitoolsify_output,
|
60
|
+
env_name: "APPLITOOLSIFY_OUTPUT_NAME",
|
61
|
+
description: "The name of the resulting file",
|
62
|
+
optional: true,
|
63
|
+
type: String),
|
35
64
|
]
|
36
65
|
end
|
37
66
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'fastlane_core/ui/ui'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'zip'
|
2
4
|
|
3
5
|
module Fastlane
|
4
6
|
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
@@ -11,6 +13,57 @@ module Fastlane
|
|
11
13
|
def self.show_message
|
12
14
|
UI.message("Hello from the applitoolsify plugin helper!")
|
13
15
|
end
|
16
|
+
|
17
|
+
def self.applitoolsify(file_to_process, app_name)
|
18
|
+
Dir.mktmpdir do |tmpdir|
|
19
|
+
zip_ufg_lib = get_ufg_lib(tmpdir)
|
20
|
+
framework_zip_entries = get_framework_filenames(zip_ufg_lib)
|
21
|
+
|
22
|
+
Zip.continue_on_exists_proc = true
|
23
|
+
Zip::File.open(file_to_process, create: false) do |zipfile|
|
24
|
+
framework_zip_entries.each do |zip_entry|
|
25
|
+
new_path = get_new_path(zip_entry.to_s, app_name)
|
26
|
+
ext_path = extract_zip_entry(tmpdir, zip_ufg_lib, zip_entry)
|
27
|
+
zipfile.add(new_path, ext_path)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
# require 'pry'
|
31
|
+
# binding.pry
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.get_ufg_lib(tmpdir)
|
36
|
+
url = 'https://applitools.jfrog.io/artifactory/ufg-mobile/UFG_lib.xcframework.zip'
|
37
|
+
filename = File.basename(url)
|
38
|
+
where = File.expand_path(filename, tmpdir)
|
39
|
+
open(url) {|cloud| File.write(where, cloud.read) } unless File.exist?(where)
|
40
|
+
where
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.get_framework_filenames(zip_ufg_lib)
|
44
|
+
input_filenames = []
|
45
|
+
Zip::File.open(zip_ufg_lib) {|zip_file| input_filenames = zip_file.select {|entry| entry.file? } }
|
46
|
+
input_filenames
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def self.extract_zip_entry(tmpdir, zip_ufg_lib, zip_entry)
|
51
|
+
lib_path = File.basename(zip_ufg_lib, File.extname(zip_ufg_lib))
|
52
|
+
ext_path = File.join(tmpdir, lib_path, zip_entry.name)
|
53
|
+
dirname = File.dirname(ext_path)
|
54
|
+
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
55
|
+
zip_entry.extract ext_path
|
56
|
+
ext_path
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.get_new_path(zip_path, app_name)
|
60
|
+
if zip_path.to_s.start_with?('__MACOSX')
|
61
|
+
File.join(zip_path.to_s.split('/').insert(1, app_name, 'Frameworks'))
|
62
|
+
else
|
63
|
+
File.join(app_name, 'Frameworks', zip_path.to_s)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
14
67
|
end
|
15
68
|
end
|
16
69
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-applitoolsify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Applitools Team
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|