fastlane-plugin-validate_app 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +74 -0
- data/lib/fastlane/plugin/validate_app.rb +16 -0
- data/lib/fastlane/plugin/validate_app/actions/validate_app_action.rb +107 -0
- data/lib/fastlane/plugin/validate_app/helper/validate_app_helper.rb +16 -0
- data/lib/fastlane/plugin/validate_app/version.rb +5 -0
- metadata +175 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 657462245474ab242aa582b07eb947f5c3751348
|
4
|
+
data.tar.gz: '0802de059b331ff8d2ade46dec0313123e1181e8'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e0c29d4834c9da4ed2513d81dae5832ecdd6e660a3223dc4e4037b07d807dc7fa26f1f55268ba8b495bcb5e5c1aacd30090ca4fb7bdec1170076925ced9f777
|
7
|
+
data.tar.gz: 9c3067d5fb9dfbb224e8f821b9d86c3a77115982a1f3e5dd0583dc51c7fe8a3aebc7aaa116c224cfd2b4fba09eb0ea57b354e91ea58bce8f49ec0fd7249c3fca
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Thi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# validate_app plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-validate_app)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
|
8
|
+
get started with `fastlane-plugin-validate_app`, add it to your project by
|
9
|
+
running:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
fastlane add_plugin validate_app
|
13
|
+
```
|
14
|
+
|
15
|
+
## About validate_app
|
16
|
+
|
17
|
+
This plugin validates your ipa file using Application Loader's command line
|
18
|
+
tool `altool`. By default, it will take your Apple ID username from your
|
19
|
+
Appfile and password from yoru Keychain. You may specify a password directly or
|
20
|
+
pass it via `FASTLANE_PASSWORD` or `DELIVER_PASSWORD` environment variables.
|
21
|
+
Your password will not be printed out to build console log.
|
22
|
+
|
23
|
+
Returns an empty array if build is valid, and an array of error objects if
|
24
|
+
build is invalid
|
25
|
+
|
26
|
+
## Example
|
27
|
+
|
28
|
+
```
|
29
|
+
errors = validate_app(
|
30
|
+
ipa: "YourApp.ipa"
|
31
|
+
)
|
32
|
+
|
33
|
+
if errors.empty?
|
34
|
+
upload_to_testflight
|
35
|
+
else
|
36
|
+
UI.user_error! "IPA file did not pass validation."
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
## Run tests for this plugin
|
41
|
+
|
42
|
+
To run both the tests, and code style validation, run
|
43
|
+
|
44
|
+
```
|
45
|
+
rake
|
46
|
+
```
|
47
|
+
|
48
|
+
To automatically fix many of the styling issues, use
|
49
|
+
```
|
50
|
+
rubocop -a
|
51
|
+
```
|
52
|
+
|
53
|
+
## Issues and Feedback
|
54
|
+
|
55
|
+
For any other issues and feedback about this plugin, please submit it to this
|
56
|
+
repository.
|
57
|
+
|
58
|
+
## Troubleshooting
|
59
|
+
|
60
|
+
If you have trouble using plugins, check out the [Plugins
|
61
|
+
Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/)
|
62
|
+
guide.
|
63
|
+
|
64
|
+
## Using _fastlane_ Plugins
|
65
|
+
|
66
|
+
For more information about how the `fastlane` plugin system works, check out
|
67
|
+
the [Plugins
|
68
|
+
documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
69
|
+
|
70
|
+
## About _fastlane_
|
71
|
+
|
72
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for
|
73
|
+
your iOS and Android apps. To learn more, check out
|
74
|
+
[fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/validate_app/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module ValidateApp
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::ValidateApp.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/validate_app_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class ValidateAppAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
require 'plist'
|
9
|
+
|
10
|
+
xcode_contents_path = `dirname "$(xcode-select --print-path)"`.strip
|
11
|
+
altool = "#{xcode_contents_path}/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool".shellescape
|
12
|
+
|
13
|
+
UI.message "Validating your app. This may take a while."
|
14
|
+
|
15
|
+
username = params[:username]
|
16
|
+
password = "@env:DELIVER_PASSWORD" if ENV["DELIVER_PASSWORD"].to_s.length > 0
|
17
|
+
password = "@env:FASTLANE_PASSWORD" if ENV["FASTLANE_PASSWORD"].to_s.length > 0
|
18
|
+
|
19
|
+
if password.to_s.empty?
|
20
|
+
password = self.fetch_password_from_keychain
|
21
|
+
end
|
22
|
+
|
23
|
+
command = [altool]
|
24
|
+
command << "--validate-app"
|
25
|
+
command << "--file"
|
26
|
+
command << "#{params[:ipa]}".shellescape
|
27
|
+
command << "--username #{params[:username]}"
|
28
|
+
command << "--password"
|
29
|
+
command << password
|
30
|
+
command << "--output-format xml"
|
31
|
+
|
32
|
+
plist = Plist.parse_xml `#{command.join(' ')}`
|
33
|
+
errors = plist["product-errors"]
|
34
|
+
|
35
|
+
if errors.empty?
|
36
|
+
UI.success "Build is valid. Ready to be uploaded to iTunes Connect!"
|
37
|
+
return []
|
38
|
+
end
|
39
|
+
|
40
|
+
errors.each do |error|
|
41
|
+
UI.error error["message"]
|
42
|
+
end
|
43
|
+
|
44
|
+
errors
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.description
|
48
|
+
"Validate your ipa file"
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.authors
|
52
|
+
["Thi"]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.return_value
|
56
|
+
"Returns an empty array if build is valid, and an array of error objects if build is invalid"
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.details
|
60
|
+
[
|
61
|
+
"Validate your ipa file using altool before upload to ensure only",
|
62
|
+
"valid builds are uploaded and processed by iTunes Connect.",
|
63
|
+
"More information: https://github.com/thii/fastlane-plugin-validate_app"
|
64
|
+
].join(' ')
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.fetch_password_from_keychain
|
68
|
+
require 'credentials_manager/account_manager'
|
69
|
+
|
70
|
+
keychain_entry = CredentialsManager::AccountManager.new(user: @user)
|
71
|
+
keychain_entry.password
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.available_options
|
75
|
+
require 'credentials_manager/appfile_config'
|
76
|
+
|
77
|
+
@user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)
|
78
|
+
@user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
|
79
|
+
|
80
|
+
[
|
81
|
+
FastlaneCore::ConfigItem.new(key: :ipa,
|
82
|
+
env_name: "VALIDATE_APP_IPA",
|
83
|
+
description: "Path to the ipa file to validate",
|
84
|
+
is_string: true,
|
85
|
+
default_value: Dir["*.ipa"].sort_by { |x| File.mtime(x) }.last,
|
86
|
+
optional: false,
|
87
|
+
verify_block: proc do |value|
|
88
|
+
value = File.expand_path(value)
|
89
|
+
UI.user_error!("could not find ipa file at path '#{value}'") unless File.exist?(value)
|
90
|
+
UI.user_error!("'#{value}' doesn't seem to be an ipa file") unless value.end_with?(".ipa")
|
91
|
+
end),
|
92
|
+
|
93
|
+
FastlaneCore::ConfigItem.new(key: :username,
|
94
|
+
env_name: "VALIDATE_APP_USERNAME",
|
95
|
+
description: "Your Apple ID username",
|
96
|
+
is_string: true,
|
97
|
+
default_value: @user,
|
98
|
+
optional: false)
|
99
|
+
]
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.is_supported?(platform)
|
103
|
+
[:ios, :mac, :appletvos].include?(platform)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
class ValidateAppHelper
|
8
|
+
# class methods that you define here become available in your action
|
9
|
+
# as `Helper::ValidateAppHelper.your_method`
|
10
|
+
#
|
11
|
+
def self.show_message
|
12
|
+
UI.message("Hello from the validate_app plugin helper!")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-validate_app
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-01-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-require_tools
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fastlane
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.77.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.77.1
|
139
|
+
description:
|
140
|
+
email:
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- lib/fastlane/plugin/validate_app.rb
|
148
|
+
- lib/fastlane/plugin/validate_app/actions/validate_app_action.rb
|
149
|
+
- lib/fastlane/plugin/validate_app/helper/validate_app_helper.rb
|
150
|
+
- lib/fastlane/plugin/validate_app/version.rb
|
151
|
+
homepage: https://github.com/thii/fastlane-plugin-validate_app
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata: {}
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubyforge_project:
|
171
|
+
rubygems_version: 2.6.13
|
172
|
+
signing_key:
|
173
|
+
specification_version: 4
|
174
|
+
summary: Validate your build before uploading to iTunes Connect
|
175
|
+
test_files: []
|