fastlane 2.142.0 → 2.143.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +84 -84
  3. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  4. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  5. data/fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp +0 -0
  6. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +22 -6
  7. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +20 -4
  8. data/fastlane/lib/fastlane/actions/frame_screenshots.rb +2 -1
  9. data/fastlane/lib/fastlane/actions/s3.rb +3 -289
  10. data/fastlane/lib/fastlane/helper/s3_client_helper.rb +56 -0
  11. data/fastlane/lib/fastlane/version.rb +1 -1
  12. data/fastlane/swift/Deliverfile.swift +1 -1
  13. data/fastlane/swift/Fastlane.swift +59 -5
  14. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  15. data/fastlane/swift/Gymfile.swift +1 -1
  16. data/fastlane/swift/Matchfile.swift +1 -1
  17. data/fastlane/swift/MatchfileProtocol.swift +17 -1
  18. data/fastlane/swift/Precheckfile.swift +1 -1
  19. data/fastlane/swift/Scanfile.swift +1 -1
  20. data/fastlane/swift/Screengrabfile.swift +1 -1
  21. data/fastlane/swift/Snapshotfile.swift +1 -1
  22. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +1 -0
  23. data/frameit/lib/frameit/commands_generator.rb +25 -0
  24. data/frameit/lib/frameit/config_parser.rb +31 -9
  25. data/frameit/lib/frameit/device.rb +90 -0
  26. data/frameit/lib/frameit/device_types.rb +121 -5
  27. data/frameit/lib/frameit/editor.rb +28 -40
  28. data/frameit/lib/frameit/offsets.rb +8 -1
  29. data/frameit/lib/frameit/options.rb +81 -54
  30. data/frameit/lib/frameit/runner.rb +17 -7
  31. data/frameit/lib/frameit/screenshot.rb +35 -47
  32. data/frameit/lib/frameit/template_finder.rb +15 -12
  33. data/match/lib/match/change_password.rb +1 -1
  34. data/match/lib/match/encryption.rb +4 -0
  35. data/match/lib/match/importer.rb +2 -2
  36. data/match/lib/match/module.rb +1 -1
  37. data/match/lib/match/nuke.rb +5 -1
  38. data/match/lib/match/options.rb +18 -0
  39. data/match/lib/match/runner.rb +4 -0
  40. data/match/lib/match/setup.rb +1 -1
  41. data/match/lib/match/storage.rb +4 -0
  42. data/match/lib/match/storage/s3_storage.rb +162 -0
  43. data/pilot/lib/pilot/.manager.rb.swp +0 -0
  44. data/scan/lib/scan/test_command_generator.rb +2 -1
  45. data/screengrab/lib/screengrab/runner.rb +11 -3
  46. data/spaceship/lib/spaceship/connect_api/.DS_Store +0 -0
  47. data/spaceship/lib/spaceship/connect_api/models/build.rb +1 -2
  48. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +2 -0
  49. data/spaceship/lib/spaceship/portal/.certificate.rb.swp +0 -0
  50. metadata +42 -19
  51. data/gym/lib/gym/.code_signing_mapping.rb.swp +0 -0
@@ -0,0 +1,56 @@
1
+ require 'aws-sdk'
2
+
3
+ module Fastlane
4
+ module Helper
5
+ class S3ClientHelper
6
+ attr_reader :client
7
+
8
+ def initialize(access_key: nil, secret_access_key: nil, region: nil)
9
+ creds = Aws::Credentials.new(access_key, secret_access_key)
10
+ Aws.config.update({
11
+ region: region,
12
+ credentials: creds
13
+ })
14
+
15
+ @client = Aws::S3::Client.new
16
+ end
17
+
18
+ def list_buckets
19
+ return @client.list_buckets
20
+ end
21
+
22
+ def upload_file(bucket_name, file_name, file_data, acl)
23
+ bucket = find_bucket!(bucket_name)
24
+ details = {
25
+ acl: acl,
26
+ key: file_name,
27
+ body: file_data
28
+ }
29
+ obj = bucket.put_object(details)
30
+
31
+ # When you enable versioning on a S3 bucket,
32
+ # writing to an object will create an object version
33
+ # instead of replacing the existing object.
34
+ # http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/ObjectVersion.html
35
+ if obj.kind_of?(Aws::S3::ObjectVersion)
36
+ obj = obj.object
37
+ end
38
+
39
+ # Return public url
40
+ obj.public_url.to_s
41
+ end
42
+
43
+ def delete_file(bucket, file_name)
44
+ bucket = find_bucket!(bucket_name)
45
+ bucket.objects[file_name].delete
46
+ end
47
+
48
+ def find_bucket!(bucket_name)
49
+ bucket = Aws::S3::Bucket.new(bucket_name, client: @client)
50
+ raise "Bucket '#{bucket_name}' not found" unless bucket.exists?
51
+
52
+ return bucket
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.142.0'.freeze
2
+ VERSION = '2.143.0'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  MINIMUM_XCODE_RELEASE = "7.0".freeze
5
5
  RUBOCOP_REQUIREMENT = '0.49.1'.freeze
@@ -18,4 +18,4 @@ class Deliverfile: DeliverfileProtocol {
18
18
 
19
19
 
20
20
 
21
- // Generated with fastlane 2.142.0
21
+ // Generated with fastlane 2.143.0
@@ -2757,7 +2757,7 @@ func downloadDsyms(username: String,
2757
2757
  func downloadFromPlayStore(packageName: String,
2758
2758
  versionName: String? = nil,
2759
2759
  track: String = "production",
2760
- metadataPath: String? = nil,
2760
+ metadataPath: String = "./metadata",
2761
2761
  key: String? = nil,
2762
2762
  issuer: String? = nil,
2763
2763
  jsonKey: String? = nil,
@@ -2986,10 +2986,15 @@ func flock(message: String,
2986
2986
  - forceDeviceType: Forces a given device type, useful for Mac screenshots, as their sizes vary
2987
2987
  - useLegacyIphone5s: Use iPhone 5s instead of iPhone SE frames
2988
2988
  - useLegacyIphone6s: Use iPhone 6s frames instead of iPhone 7 frames
2989
+ - useLegacyIphone7: Use iPhone 7 frames instead of iPhone 8 frames
2989
2990
  - useLegacyIphonex: Use iPhone X instead of iPhone XS frames
2991
+ - useLegacyIphonexr: Use iPhone XR instead of iPhone 11 frames
2992
+ - useLegacyIphonexs: Use iPhone XS instead of iPhone 11 Pro frames
2993
+ - useLegacyIphonexsmax: Use iPhone XS Max instead of iPhone 11 Pro Max frames
2990
2994
  - forceOrientationBlock: [Advanced] A block to customize your screenshots' device orientation
2991
2995
  - debugMode: Output debug information in framed screenshots
2992
2996
  - resume: Resume frameit instead of reprocessing all screenshots
2997
+ - usePlatform: Choose a platform, the valid options are IOS, ANDROID and ANY (IOS is default to ensure backward compatibility)
2993
2998
  - path: The path to the directory containing the screenshots
2994
2999
 
2995
3000
  Uses [frameit](https://docs.fastlane.tools/actions/frameit/) to prepare perfect screenshots for the App Store, your website, QA or emails.
@@ -3002,10 +3007,15 @@ func frameScreenshots(white: Bool? = nil,
3002
3007
  forceDeviceType: String? = nil,
3003
3008
  useLegacyIphone5s: Bool = false,
3004
3009
  useLegacyIphone6s: Bool = false,
3010
+ useLegacyIphone7: Bool = false,
3005
3011
  useLegacyIphonex: Bool = false,
3012
+ useLegacyIphonexr: Bool = false,
3013
+ useLegacyIphonexs: Bool = false,
3014
+ useLegacyIphonexsmax: Bool = false,
3006
3015
  forceOrientationBlock: String? = nil,
3007
3016
  debugMode: Bool = false,
3008
3017
  resume: Bool = false,
3018
+ usePlatform: String = "IOS",
3009
3019
  path: String = "./") {
3010
3020
  let command = RubyCommand(commandID: "", methodName: "frame_screenshots", className: nil, args: [RubyCommand.Argument(name: "white", value: white),
3011
3021
  RubyCommand.Argument(name: "silver", value: silver),
@@ -3014,10 +3024,15 @@ func frameScreenshots(white: Bool? = nil,
3014
3024
  RubyCommand.Argument(name: "force_device_type", value: forceDeviceType),
3015
3025
  RubyCommand.Argument(name: "use_legacy_iphone5s", value: useLegacyIphone5s),
3016
3026
  RubyCommand.Argument(name: "use_legacy_iphone6s", value: useLegacyIphone6s),
3027
+ RubyCommand.Argument(name: "use_legacy_iphone7", value: useLegacyIphone7),
3017
3028
  RubyCommand.Argument(name: "use_legacy_iphonex", value: useLegacyIphonex),
3029
+ RubyCommand.Argument(name: "use_legacy_iphonexr", value: useLegacyIphonexr),
3030
+ RubyCommand.Argument(name: "use_legacy_iphonexs", value: useLegacyIphonexs),
3031
+ RubyCommand.Argument(name: "use_legacy_iphonexsmax", value: useLegacyIphonexsmax),
3018
3032
  RubyCommand.Argument(name: "force_orientation_block", value: forceOrientationBlock),
3019
3033
  RubyCommand.Argument(name: "debug_mode", value: debugMode),
3020
3034
  RubyCommand.Argument(name: "resume", value: resume),
3035
+ RubyCommand.Argument(name: "use_platform", value: usePlatform),
3021
3036
  RubyCommand.Argument(name: "path", value: path)])
3022
3037
  _ = runner.executeCommand(command)
3023
3038
  }
@@ -3033,10 +3048,15 @@ func frameScreenshots(white: Bool? = nil,
3033
3048
  - forceDeviceType: Forces a given device type, useful for Mac screenshots, as their sizes vary
3034
3049
  - useLegacyIphone5s: Use iPhone 5s instead of iPhone SE frames
3035
3050
  - useLegacyIphone6s: Use iPhone 6s frames instead of iPhone 7 frames
3051
+ - useLegacyIphone7: Use iPhone 7 frames instead of iPhone 8 frames
3036
3052
  - useLegacyIphonex: Use iPhone X instead of iPhone XS frames
3053
+ - useLegacyIphonexr: Use iPhone XR instead of iPhone 11 frames
3054
+ - useLegacyIphonexs: Use iPhone XS instead of iPhone 11 Pro frames
3055
+ - useLegacyIphonexsmax: Use iPhone XS Max instead of iPhone 11 Pro Max frames
3037
3056
  - forceOrientationBlock: [Advanced] A block to customize your screenshots' device orientation
3038
3057
  - debugMode: Output debug information in framed screenshots
3039
3058
  - resume: Resume frameit instead of reprocessing all screenshots
3059
+ - usePlatform: Choose a platform, the valid options are IOS, ANDROID and ANY (IOS is default to ensure backward compatibility)
3040
3060
  - path: The path to the directory containing the screenshots
3041
3061
 
3042
3062
  Uses [frameit](https://docs.fastlane.tools/actions/frameit/) to prepare perfect screenshots for the App Store, your website, QA or emails.
@@ -3049,10 +3069,15 @@ func frameit(white: Bool? = nil,
3049
3069
  forceDeviceType: String? = nil,
3050
3070
  useLegacyIphone5s: Bool = false,
3051
3071
  useLegacyIphone6s: Bool = false,
3072
+ useLegacyIphone7: Bool = false,
3052
3073
  useLegacyIphonex: Bool = false,
3074
+ useLegacyIphonexr: Bool = false,
3075
+ useLegacyIphonexs: Bool = false,
3076
+ useLegacyIphonexsmax: Bool = false,
3053
3077
  forceOrientationBlock: String? = nil,
3054
3078
  debugMode: Bool = false,
3055
3079
  resume: Bool = false,
3080
+ usePlatform: String = "IOS",
3056
3081
  path: String = "./") {
3057
3082
  let command = RubyCommand(commandID: "", methodName: "frameit", className: nil, args: [RubyCommand.Argument(name: "white", value: white),
3058
3083
  RubyCommand.Argument(name: "silver", value: silver),
@@ -3061,10 +3086,15 @@ func frameit(white: Bool? = nil,
3061
3086
  RubyCommand.Argument(name: "force_device_type", value: forceDeviceType),
3062
3087
  RubyCommand.Argument(name: "use_legacy_iphone5s", value: useLegacyIphone5s),
3063
3088
  RubyCommand.Argument(name: "use_legacy_iphone6s", value: useLegacyIphone6s),
3089
+ RubyCommand.Argument(name: "use_legacy_iphone7", value: useLegacyIphone7),
3064
3090
  RubyCommand.Argument(name: "use_legacy_iphonex", value: useLegacyIphonex),
3091
+ RubyCommand.Argument(name: "use_legacy_iphonexr", value: useLegacyIphonexr),
3092
+ RubyCommand.Argument(name: "use_legacy_iphonexs", value: useLegacyIphonexs),
3093
+ RubyCommand.Argument(name: "use_legacy_iphonexsmax", value: useLegacyIphonexsmax),
3065
3094
  RubyCommand.Argument(name: "force_orientation_block", value: forceOrientationBlock),
3066
3095
  RubyCommand.Argument(name: "debug_mode", value: debugMode),
3067
3096
  RubyCommand.Argument(name: "resume", value: resume),
3097
+ RubyCommand.Argument(name: "use_platform", value: usePlatform),
3068
3098
  RubyCommand.Argument(name: "path", value: path)])
3069
3099
  _ = runner.executeCommand(command)
3070
3100
  }
@@ -4444,6 +4474,10 @@ func makeChangelogFromJenkins(fallbackChangelog: String = "",
4444
4474
  - googleCloudBucketName: Name of the Google Cloud Storage bucket to use
4445
4475
  - googleCloudKeysFile: Path to the gc_keys.json file
4446
4476
  - googleCloudProjectId: ID of the Google Cloud project to use for authentication
4477
+ - s3Region: Name of the S3 region
4478
+ - s3AccessKey: S3 access key
4479
+ - s3SecretAccessKey: S3 secret secret access key
4480
+ - s3Bucket: Name of the S3 bucket
4447
4481
  - keychainName: Keychain the items should be imported to
4448
4482
  - keychainPassword: This might be required the first time you access certificates on a new mac. For the login/default keychain this is your account password
4449
4483
  - force: Renew the provisioning profiles every time you run match
@@ -4478,6 +4512,10 @@ func match(type: Any = matchfile.type,
4478
4512
  googleCloudBucketName: Any? = matchfile.googleCloudBucketName,
4479
4513
  googleCloudKeysFile: Any? = matchfile.googleCloudKeysFile,
4480
4514
  googleCloudProjectId: Any? = matchfile.googleCloudProjectId,
4515
+ s3Region: Any? = matchfile.s3Region,
4516
+ s3AccessKey: Any? = matchfile.s3AccessKey,
4517
+ s3SecretAccessKey: Any? = matchfile.s3SecretAccessKey,
4518
+ s3Bucket: Any? = matchfile.s3Bucket,
4481
4519
  keychainName: Any = matchfile.keychainName,
4482
4520
  keychainPassword: Any? = matchfile.keychainPassword,
4483
4521
  force: Bool = matchfile.force,
@@ -4509,6 +4547,10 @@ func match(type: Any = matchfile.type,
4509
4547
  RubyCommand.Argument(name: "google_cloud_bucket_name", value: googleCloudBucketName),
4510
4548
  RubyCommand.Argument(name: "google_cloud_keys_file", value: googleCloudKeysFile),
4511
4549
  RubyCommand.Argument(name: "google_cloud_project_id", value: googleCloudProjectId),
4550
+ RubyCommand.Argument(name: "s3_region", value: s3Region),
4551
+ RubyCommand.Argument(name: "s3_access_key", value: s3AccessKey),
4552
+ RubyCommand.Argument(name: "s3_secret_access_key", value: s3SecretAccessKey),
4553
+ RubyCommand.Argument(name: "s3_bucket", value: s3Bucket),
4512
4554
  RubyCommand.Argument(name: "keychain_name", value: keychainName),
4513
4555
  RubyCommand.Argument(name: "keychain_password", value: keychainPassword),
4514
4556
  RubyCommand.Argument(name: "force", value: force),
@@ -7000,7 +7042,7 @@ func supply(packageName: String,
7000
7042
  releaseStatus: String = "completed",
7001
7043
  track: String = "production",
7002
7044
  rollout: String? = nil,
7003
- metadataPath: String? = nil,
7045
+ metadataPath: String = "./metadata",
7004
7046
  key: String? = nil,
7005
7047
  issuer: String? = nil,
7006
7048
  jsonKey: String? = nil,
@@ -7137,6 +7179,10 @@ func swiftlint(mode: Any = "lint",
7137
7179
  - googleCloudBucketName: Name of the Google Cloud Storage bucket to use
7138
7180
  - googleCloudKeysFile: Path to the gc_keys.json file
7139
7181
  - googleCloudProjectId: ID of the Google Cloud project to use for authentication
7182
+ - s3Region: Name of the S3 region
7183
+ - s3AccessKey: S3 access key
7184
+ - s3SecretAccessKey: S3 secret secret access key
7185
+ - s3Bucket: Name of the S3 bucket
7140
7186
  - keychainName: Keychain the items should be imported to
7141
7187
  - keychainPassword: This might be required the first time you access certificates on a new mac. For the login/default keychain this is your account password
7142
7188
  - force: Renew the provisioning profiles every time you run match
@@ -7171,6 +7217,10 @@ func syncCodeSigning(type: String = "development",
7171
7217
  googleCloudBucketName: String? = nil,
7172
7218
  googleCloudKeysFile: String? = nil,
7173
7219
  googleCloudProjectId: String? = nil,
7220
+ s3Region: String? = nil,
7221
+ s3AccessKey: String? = nil,
7222
+ s3SecretAccessKey: String? = nil,
7223
+ s3Bucket: String? = nil,
7174
7224
  keychainName: String = "login.keychain",
7175
7225
  keychainPassword: String? = nil,
7176
7226
  force: Bool = false,
@@ -7202,6 +7252,10 @@ func syncCodeSigning(type: String = "development",
7202
7252
  RubyCommand.Argument(name: "google_cloud_bucket_name", value: googleCloudBucketName),
7203
7253
  RubyCommand.Argument(name: "google_cloud_keys_file", value: googleCloudKeysFile),
7204
7254
  RubyCommand.Argument(name: "google_cloud_project_id", value: googleCloudProjectId),
7255
+ RubyCommand.Argument(name: "s3_region", value: s3Region),
7256
+ RubyCommand.Argument(name: "s3_access_key", value: s3AccessKey),
7257
+ RubyCommand.Argument(name: "s3_secret_access_key", value: s3SecretAccessKey),
7258
+ RubyCommand.Argument(name: "s3_bucket", value: s3Bucket),
7205
7259
  RubyCommand.Argument(name: "keychain_name", value: keychainName),
7206
7260
  RubyCommand.Argument(name: "keychain_password", value: keychainPassword),
7207
7261
  RubyCommand.Argument(name: "force", value: force),
@@ -8037,7 +8091,7 @@ func uploadToPlayStore(packageName: String,
8037
8091
  releaseStatus: String = "completed",
8038
8092
  track: String = "production",
8039
8093
  rollout: String? = nil,
8040
- metadataPath: String? = nil,
8094
+ metadataPath: String = "./metadata",
8041
8095
  key: String? = nil,
8042
8096
  issuer: String? = nil,
8043
8097
  jsonKey: String? = nil,
@@ -8536,7 +8590,7 @@ func xcov(workspace: String? = nil,
8536
8590
  coverallsServiceJobId: String? = nil,
8537
8591
  coverallsRepoToken: String? = nil,
8538
8592
  xcconfig: String? = nil,
8539
- ideFoundationPath: String = "/Applications/Xcode-11.3.app/Contents/Developer/../Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation",
8593
+ ideFoundationPath: String = "/Applications/Xcode-11.2.1.app/Contents/Developer/../Frameworks/IDEFoundation.framework/Versions/A/IDEFoundation",
8540
8594
  legacySupport: Bool = false) {
8541
8595
  let command = RubyCommand(commandID: "", methodName: "xcov", className: nil, args: [RubyCommand.Argument(name: "workspace", value: workspace),
8542
8596
  RubyCommand.Argument(name: "project", value: project),
@@ -8681,4 +8735,4 @@ let snapshotfile: Snapshotfile = Snapshotfile()
8681
8735
 
8682
8736
  // Please don't remove the lines below
8683
8737
  // They are used to detect outdated files
8684
- // FastlaneRunnerAPIVersion [0.9.70]
8738
+ // FastlaneRunnerAPIVersion [0.9.71]
@@ -18,4 +18,4 @@ class Gymfile: GymfileProtocol {
18
18
 
19
19
 
20
20
 
21
- // Generated with fastlane 2.142.0
21
+ // Generated with fastlane 2.143.0
@@ -18,4 +18,4 @@ class Matchfile: MatchfileProtocol {
18
18
 
19
19
 
20
20
 
21
- // Generated with fastlane 2.142.0
21
+ // Generated with fastlane 2.143.0
@@ -63,6 +63,18 @@ protocol MatchfileProtocol: class {
63
63
  /// ID of the Google Cloud project to use for authentication
64
64
  var googleCloudProjectId: String? { get }
65
65
 
66
+ /// Name of the S3 region
67
+ var s3Region: String? { get }
68
+
69
+ /// S3 access key
70
+ var s3AccessKey: String? { get }
71
+
72
+ /// S3 secret secret access key
73
+ var s3SecretAccessKey: String? { get }
74
+
75
+ /// Name of the S3 bucket
76
+ var s3Bucket: String? { get }
77
+
66
78
  /// Keychain the items should be imported to
67
79
  var keychainName: String { get }
68
80
 
@@ -116,6 +128,10 @@ extension MatchfileProtocol {
116
128
  var googleCloudBucketName: String? { return nil }
117
129
  var googleCloudKeysFile: String? { return nil }
118
130
  var googleCloudProjectId: String? { return nil }
131
+ var s3Region: String? { return nil }
132
+ var s3AccessKey: String? { return nil }
133
+ var s3SecretAccessKey: String? { return nil }
134
+ var s3Bucket: String? { return nil }
119
135
  var keychainName: String { return "login.keychain" }
120
136
  var keychainPassword: String? { return nil }
121
137
  var force: Bool { return false }
@@ -130,4 +146,4 @@ extension MatchfileProtocol {
130
146
 
131
147
  // Please don't remove the lines below
132
148
  // They are used to detect outdated files
133
- // FastlaneRunnerAPIVersion [0.9.13]
149
+ // FastlaneRunnerAPIVersion [0.9.14]
@@ -18,4 +18,4 @@ class Precheckfile: PrecheckfileProtocol {
18
18
 
19
19
 
20
20
 
21
- // Generated with fastlane 2.142.0
21
+ // Generated with fastlane 2.143.0
@@ -18,4 +18,4 @@ class Scanfile: ScanfileProtocol {
18
18
 
19
19
 
20
20
 
21
- // Generated with fastlane 2.142.0
21
+ // Generated with fastlane 2.143.0
@@ -18,4 +18,4 @@ class Screengrabfile: ScreengrabfileProtocol {
18
18
 
19
19
 
20
20
 
21
- // Generated with fastlane 2.142.0
21
+ // Generated with fastlane 2.143.0
@@ -18,4 +18,4 @@ class Snapshotfile: SnapshotfileProtocol {
18
18
 
19
19
 
20
20
 
21
- // Generated with fastlane 2.142.0
21
+ // Generated with fastlane 2.143.0
@@ -37,6 +37,7 @@ module FastlaneCore
37
37
 
38
38
  def self.fetch_info_plist_file(path)
39
39
  UI.user_error!("Could not find file at path '#{path}'") unless File.exist?(path)
40
+ Zip.validate_entry_sizes = true # https://github.com/rubyzip/rubyzip/releases/tag/v2.0.0
40
41
  Zip::File.open(path, "rb") do |zipfile|
41
42
  file = zipfile.glob('**/Payload/*.app/Info.plist').first
42
43
  return nil unless file
@@ -7,6 +7,7 @@ require_relative 'device_types'
7
7
  require_relative 'runner'
8
8
  require_relative 'options'
9
9
  require_relative 'dependency_checker'
10
+ require_relative 'device'
10
11
 
11
12
  HighLine.track_eof = false
12
13
 
@@ -80,6 +81,30 @@ module Frameit
80
81
  end
81
82
  end
82
83
 
84
+ command :android do |c|
85
+ c.syntax = 'fastlane frameit android'
86
+ c.description = "Adds Android frames around all screenshots"
87
+
88
+ FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options, command: c)
89
+
90
+ c.action do |args, options|
91
+ load_config(options)
92
+ Frameit::Runner.new.run('.', nil, Platform::ANDROID)
93
+ end
94
+ end
95
+
96
+ command :ios do |c|
97
+ c.syntax = 'fastlane frameit ios'
98
+ c.description = "Adds iOS frames around all screenshots"
99
+
100
+ FastlaneCore::CommanderGenerator.new.generate(Frameit::Options.available_options, command: c)
101
+
102
+ c.action do |args, options|
103
+ load_config(options)
104
+ Frameit::Runner.new.run('.', nil, Platform::IOS)
105
+ end
106
+ end
107
+
83
108
  command :setup do |c|
84
109
  c.syntax = 'fastlane frameit setup'
85
110
  c.description = "Downloads and sets up the latest device frames"
@@ -1,4 +1,4 @@
1
- require_relative 'module'
1
+ require_relative 'device_types'
2
2
 
3
3
  module Frameit
4
4
  class ConfigParser
@@ -79,13 +79,7 @@ module Frameit
79
79
  when 'font'
80
80
  UI.user_error!("Could not find font at path '#{File.expand_path(value)}'") unless File.exist?(value)
81
81
  when 'fonts'
82
- UI.user_error!("`fonts` must be an array") unless value.kind_of?(Array)
83
-
84
- value.each do |current|
85
- UI.user_error!("You must specify a font path") if current.fetch('font', '').length == 0
86
- UI.user_error!("Could not find font at path '#{File.expand_path(current.fetch('font'))}'") unless File.exist?(current.fetch('font'))
87
- UI.user_error!("`supported` must be an array") unless current.fetch('supported', []).kind_of?(Array)
88
- end
82
+ check_fonts(value)
89
83
  when 'background'
90
84
  UI.user_error!("Could not find background image at path '#{File.expand_path(value)}'") unless File.exist?(value)
91
85
  when 'color'
@@ -103,12 +97,40 @@ module Frameit
103
97
  when 'font_scale_factor'
104
98
  UI.user_error!("font_scale_factor must be numeric") unless value.kind_of?(Numeric)
105
99
  when 'frame'
106
- UI.user_error!("device must be BLACK, WHITE, GOLD, ROSE_GOLD") unless ["BLACK", "WHITE", "GOLD", "ROSE_GOLD"].include?(value)
100
+ UI.user_error!("Invalid frame color '#{value}'. Frame color must be one of " + Color.all_colors.join(', ')) unless ConfigParser.supported_color?(value)
101
+ when 'use_platform'
102
+ UI.user_error!("Invalid platform type '#{value}'. Available values are " + Platform.all_platforms.join(', ') + ".") unless ConfigParser.supported_platform?(value)
103
+ when 'force_device_type'
104
+ UI.user_error!("Invalid device type '#{value}'. Available values: " + Devices.all_device_names_without_apple.join(', ')) unless ConfigParser.supported_device?(value)
105
+ end
106
+ end
107
+
108
+ def check_fonts(value)
109
+ UI.user_error!("`fonts` must be an array") unless value.kind_of?(Array)
110
+
111
+ value.each do |current|
112
+ UI.user_error!("You must specify a font path") if current.fetch('font', '').length == 0
113
+ UI.user_error!("Could not find font at path '#{File.expand_path(current.fetch('font'))}'") unless File.exist?(current.fetch('font'))
114
+ UI.user_error!("`supported` must be an array") unless current.fetch('supported', []).kind_of?(Array)
107
115
  end
108
116
  end
109
117
 
110
118
  def integer_or_percentage(value)
111
119
  value.kind_of?(Integer) || (value.end_with?('%') && value.to_f > 0)
112
120
  end
121
+
122
+ def self.supported_color?(value)
123
+ return false if value.nil?
124
+ Color.all_colors.any? { |c| c == value }
125
+ end
126
+
127
+ def self.supported_platform?(value)
128
+ return false if value.nil?
129
+ Platform.all_platforms.any? { |c| c == value }
130
+ end
131
+
132
+ def self.supported_device?(value)
133
+ return !Device.find_device_by_id_or_name(value).nil?
134
+ end
113
135
  end
114
136
  end