fastlane-plugin-applitoolsify 0.1.0 → 0.1.3

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
  SHA256:
3
- metadata.gz: 8dde23a8ff95bb22470fa59369cb35b99320a04df8ebb97bd1cb5e059fc1cc99
4
- data.tar.gz: 8e737bacb0698eaf112b5abd4a558ab3f7a10475dd59763a64be8f6afb65c38e
3
+ metadata.gz: aaca5ec7937e64e2b327df99da64dc2958ae60f7e2c5414e359bf7915e783d54
4
+ data.tar.gz: d59a6c6acc78b5b554d8f674e124e482a7dde662a4b652342ead2c971d3518aa
5
5
  SHA512:
6
- metadata.gz: 944fd5b8b7d904169171ed4e49e93eea918d2ccb6f17a0b522a88d0bab19123dcd803de6a511cc95ca085ccefb8985e996cfcbb3f51bdcb888b6f56b6be7e5ce
7
- data.tar.gz: b66c3a0a0d1c577ae56ad25b6f6ce18ed2af3e004aace0e170bf47bb388f8d4e7bf1383b1c173b0c34a296154932ca8943f0fc12959e6ded5c1b6b10d9763e0b
6
+ metadata.gz: 179217b0b3352cd3f627761b9121bc369d336b4229b9b93909d4771b184a8f7d09bb0e4e29e58790f078427e501cd4f1f085d1a30cecbb02a910ef74c61e2e12
7
+ data.tar.gz: d84f3c6fe2284e9fb3cd1ccca9bb7d033629a8d7c4c10c3400d0cf3724d787fa92b8edbcc0a13a9d2d5074e09f6b35ec30e8cfd0d3c5b5e8070657796ce227dd
data/README.md CHANGED
@@ -12,41 +12,30 @@ fastlane add_plugin applitoolsify
12
12
 
13
13
  ## About applitoolsify
14
14
 
15
- Add Applitools SDKs to ipa and app iOS apps as fastlane-plugin
16
-
17
- **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
15
+ Add Applitools SDKs (UFG_lib.xcframework) to iOS apps as fastlane-plugin
18
16
 
19
17
  ## Example
20
18
 
21
19
  Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
20
 
23
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
-
25
- ## Run tests for this plugin
21
+ ## Using _fastlane_ Plugins
26
22
 
27
- To run both the tests, and code style validation, run
23
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
28
24
 
25
+ Adding lib into app-file, require path to your app-file:
29
26
  ```
30
- rake
27
+ applitoolsify applitoolsify_input: './some.app'
31
28
  ```
32
-
33
- To automatically fix many of the styling issues, use
29
+ For debug purposes you can store original file as is, by providing parameter where will to put app with lib:
34
30
  ```
35
- rubocop -a
31
+ applitoolsify applitoolsify_input: './before.app', applitoolsify_output: './after.app'
36
32
  ```
37
33
 
38
- ## Issues and Feedback
39
-
40
- For any other issues and feedback about this plugin, please submit it to this repository.
41
-
42
- ## Troubleshooting
43
-
44
- If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
-
46
- ## Using _fastlane_ Plugins
47
-
48
- For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
-
50
34
  ## About _fastlane_
51
35
 
52
36
  _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
37
+
38
+ ### fastline-docs links:
39
+ - Install Fastline https://docs.fastlane.tools/#getting-started
40
+ - Add Plugin https://docs.fastlane.tools/plugins/using-plugins/#add-a-plugin-to-your-project
41
+ - Run tasks https://docs.fastlane.tools/plugins/using-plugins/#run-with-plugins
@@ -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,7 @@
1
+ require 'open-uri'
1
2
  require 'fastlane_core/ui/ui'
3
+ require 'fileutils'
4
+ require 'zip'
2
5
 
3
6
  module Fastlane
4
7
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
@@ -11,6 +14,62 @@ module Fastlane
11
14
  def self.show_message
12
15
  UI.message("Hello from the applitoolsify plugin helper!")
13
16
  end
17
+
18
+ def self.applitoolsify(file_to_process, app_name)
19
+ Dir.mktmpdir do |tmpdir|
20
+ zip_ufg_lib = get_ufg_lib(tmpdir)
21
+ framework_zip_entries = get_framework_filenames(zip_ufg_lib)
22
+
23
+ Zip.continue_on_exists_proc = true
24
+ Zip::File.open(file_to_process, create: false) do |zipfile|
25
+ framework_zip_entries.each do |zip_entry|
26
+ new_path = get_new_path(zip_entry.to_s, app_name)
27
+ ext_path = extract_zip_entry(tmpdir, zip_ufg_lib, zip_entry)
28
+ zipfile.add(new_path, ext_path)
29
+ end
30
+ end
31
+ # require 'pry'
32
+ # binding.pry
33
+ end
34
+ end
35
+
36
+ def self.get_ufg_lib(tmpdir)
37
+ url = 'https://applitools.jfrog.io/artifactory/ufg-mobile/UFG_lib.xcframework.zip'
38
+ filename = File.basename(url)
39
+ where = File.expand_path(filename, tmpdir)
40
+ OpenURI::open_uri(url) {|cloud| File.write(where, cloud.read) } unless File.exist?(where)
41
+ where
42
+ end
43
+
44
+ def self.get_framework_filenames(zip_ufg_lib)
45
+ input_filenames = []
46
+ Zip::File.open(zip_ufg_lib) {|zip_file| input_filenames = zip_file.select {|entry| entry.file? } }
47
+ input_filenames
48
+ end
49
+
50
+
51
+ def self.extract_zip_entry(tmpdir, zip_ufg_lib, zip_entry)
52
+ lib_path = File.basename(zip_ufg_lib, File.extname(zip_ufg_lib))
53
+ ext_path = File.join(tmpdir, lib_path, zip_entry.name)
54
+ dirname = File.dirname(ext_path)
55
+ FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
56
+ zip_entry.extract ext_path
57
+ ext_path
58
+ end
59
+
60
+ def self.get_new_path(zip_path, app_name)
61
+ extname = File.extname(app_name)
62
+ if extname === '.ipa'
63
+ basename = File.basename(app_name, extname)
64
+ return File.join('Payload', "#{basename}.app", 'Frameworks', zip_path.to_s)
65
+ end
66
+ if zip_path.to_s.start_with?('__MACOSX')
67
+ File.join(zip_path.to_s.split('/').insert(1, app_name, 'Frameworks'))
68
+ else
69
+ File.join(app_name, 'Frameworks', zip_path.to_s)
70
+ end
71
+ end
72
+
14
73
  end
15
74
  end
16
75
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Applitoolsify
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  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.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
@@ -9,8 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-16 00:00:00.000000000 Z
12
+ date: 2022-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: open-uri
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '0.1'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.1.0
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '0.1'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.0
14
34
  - !ruby/object:Gem::Dependency
15
35
  name: bundler
16
36
  requirement: !ruby/object:Gem::Requirement
@@ -184,8 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
204
  - !ruby/object:Gem::Version
185
205
  version: '0'
186
206
  requirements: []
187
- rubyforge_project:
188
- rubygems_version: 2.7.6
207
+ rubygems_version: 3.1.6
189
208
  signing_key:
190
209
  specification_version: 4
191
210
  summary: Add Applitools SDKs to ipa and app iOS apps as fastlane-plugin