diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml new file mode 100644 index 000000000..bc33a6bc9 --- /dev/null +++ b/.buildkite/pipeline.yml @@ -0,0 +1,80 @@ +# Nodes with values to reuse in the pipeline. +common_params: + plugins: &common_plugins + - &bash_cache automattic/bash-cache#2.0.0: ~ + # Common environment values to use with the `env` key. + env: &common_env + IMAGE_ID: xcode-13 + +# This is the default pipeline – it will build and test the app +steps: + ################# + # Build and Test + ################# + - label: "🧪 Build and Test" + key: "test" + command: | + # See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 + gem install bundler:2.3.4 + + build_and_test_pod + env: *common_env + plugins: *common_plugins + + ################# + # Validate Podspecs + ################# + - label: "🔬 Validate Podspecs" + key: "validate" + command: | + # See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 + gem install bundler:2.3.4 + + validate_podspec + env: *common_env + plugins: *common_plugins + + ################# + # Lint + ################# + - label: "🧹 Lint" + key: "lint" + command: | + # See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 + gem install bundler:2.3.4 + + lint_pod + env: *common_env + plugins: *common_plugins + + ################# + # Publish the Podspec (if we're building a tag) + ################# + - label: "⬆️ Publish Aztec Podspec" + key: "publish-aztec" + command: .buildkite/publish-aztec-pod.sh + env: *common_env + plugins: *common_plugins + depends_on: + - "test" + - "validate" + - "lint" + if: build.tag != null + agents: + queue: "mac" + + ################# + # Publish the Podspec (if we're building a tag) + ################# + - label: "⬆️ Publish Editor Podspec" + key: "publish-editor" + command: .buildkite/publish-editor-pod.sh + env: *common_env + plugins: *common_plugins + depends_on: + - "test" + - "validate" + - "lint" + if: build.tag != null + agents: + queue: "mac" diff --git a/.buildkite/publish-aztec-pod.sh b/.buildkite/publish-aztec-pod.sh new file mode 100644 index 000000000..2343776da --- /dev/null +++ b/.buildkite/publish-aztec-pod.sh @@ -0,0 +1,20 @@ +#!/bin/bash -eu + +PODSPEC_PATH="WordPress-Aztec-iOS.podspec" +SPECS_REPO="git@github.com:wordpress-mobile/cocoapods-specs.git" +SLACK_WEBHOOK=$PODS_SLACK_WEBHOOK + +echo "--- :rubygems: Setting up Gems" +# See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 +gem install bundler:2.3.4 + +install_gems + +echo "--- :cocoapods: Publishing Pod to CocoaPods CDN" +publish_pod $PODSPEC_PATH + +echo "--- :cocoapods: Publishing Pod to WP Specs Repo" +publish_private_pod $PODSPEC_PATH $SPECS_REPO "$SPEC_REPO_PUBLIC_DEPLOY_KEY" + +echo "--- :slack: Notifying Slack" +slack_notify_pod_published $PODSPEC_PATH $SLACK_WEBHOOK diff --git a/.buildkite/publish-editor.pod.sh b/.buildkite/publish-editor.pod.sh new file mode 100644 index 000000000..f6534c70f --- /dev/null +++ b/.buildkite/publish-editor.pod.sh @@ -0,0 +1,20 @@ +#!/bin/bash -eu + +PODSPEC_PATH="WordPress-Editor-iOS.podspec" +SPECS_REPO="git@github.com:wordpress-mobile/cocoapods-specs.git" +SLACK_WEBHOOK=$PODS_SLACK_WEBHOOK + +echo "--- :rubygems: Setting up Gems" +# See https://github.com/Automattic/bash-cache-buildkite-plugin/issues/16 +gem install bundler:2.3.4 + +install_gems + +echo "--- :cocoapods: Publishing Pod to CocoaPods CDN" +publish_pod $PODSPEC_PATH + +echo "--- :cocoapods: Publishing Pod to WP Specs Repo" +publish_private_pod $PODSPEC_PATH $SPECS_REPO "$SPEC_REPO_PUBLIC_DEPLOY_KEY" + +echo "--- :slack: Notifying Slack" +slack_notify_pod_published $PODSPEC_PATH $SLACK_WEBHOOK diff --git a/.gitignore b/.gitignore index 4b226e631..15268ca39 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,7 @@ Pods/ # For more information about the recommended setup visit: # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md +fastlane/README.md fastlane/report.xml fastlane/Preview.html fastlane/screenshots diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 000000000..a38e86800 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,10 @@ +# Opt in to new cops by default +AllCops: + NewCops: enable + +# Allow the Podspec filename to match the project +Naming/FileName: + Exclude: + - 'WordPress-Aztec-iOS.podspec' + - 'WordPress-Editor-iOS.podspec' + - 'Example/Carthage/Checkouts/Gridicons-iOS/Gridicons.podspec' diff --git a/Aztec.xcodeproj/project.pbxproj b/Aztec.xcodeproj/project.pbxproj index fe4bc7aa0..5042b71ff 100644 --- a/Aztec.xcodeproj/project.pbxproj +++ b/Aztec.xcodeproj/project.pbxproj @@ -1456,7 +1456,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 1230; + LastUpgradeCheck = 1310; ORGANIZATIONNAME = "Automattic Inc."; TargetAttributes = { 5951CB8D1D8BC93600E1866F = { diff --git a/Aztec.xcodeproj/xcshareddata/xcschemes/Aztec.xcscheme b/Aztec.xcodeproj/xcshareddata/xcschemes/Aztec.xcscheme index 1cf5571d4..6be491f86 100644 --- a/Aztec.xcodeproj/xcshareddata/xcschemes/Aztec.xcscheme +++ b/Aztec.xcodeproj/xcshareddata/xcschemes/Aztec.xcscheme @@ -1,6 +1,6 @@ + + + + + + + + diff --git a/Aztec.xcodeproj/xcshareddata/xcschemes/Carthage Update.xcscheme b/Aztec.xcodeproj/xcshareddata/xcschemes/Carthage Update.xcscheme index 28f4387d1..c7dad3a96 100644 --- a/Aztec.xcodeproj/xcshareddata/xcschemes/Carthage Update.xcscheme +++ b/Aztec.xcodeproj/xcshareddata/xcschemes/Carthage Update.xcscheme @@ -1,6 +1,6 @@ - - - - 1.8.0' +gem 'fastlane', '~> 2.189' +gem 'rubocop', '~> 1.18' diff --git a/Gemfile.lock b/Gemfile.lock index 376b79767..bd7465897 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,24 +1,49 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.1) - activesupport (4.2.11.1) + CFPropertyList (3.0.5) + rexml + activesupport (4.2.11.3) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + artifactory (3.0.15) + ast (2.4.2) atomos (0.1.3) - claide (1.0.3) - cocoapods (1.7.5) + aws-eventstream (1.2.0) + aws-partitions (1.552.0) + aws-sdk-core (3.126.0) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.525.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1.0) + aws-sdk-kms (1.54.0) + aws-sdk-core (~> 3, >= 3.126.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.112.0) + aws-sdk-core (~> 3, >= 3.126.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.4.0) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + claide (1.1.0) + cocoapods (1.8.4) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.7.5) + cocoapods-core (= 1.8.4) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.1, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) @@ -27,50 +52,243 @@ GEM molinillo (~> 0.6.6) nap (~> 1.0) ruby-macho (~> 1.4) - xcodeproj (>= 1.10.0, < 2.0) - cocoapods-core (1.7.5) + xcodeproj (>= 1.11.1, < 2.0) + cocoapods-core (1.8.4) activesupport (>= 4.0.2, < 6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.4) - cocoapods-downloader (1.2.2) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (1.5.1) cocoapods-plugins (1.0.0) nap - cocoapods-search (1.0.0) + cocoapods-search (1.0.1) cocoapods-stats (1.1.0) - cocoapods-trunk (1.4.0) + cocoapods-trunk (1.6.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) - cocoapods-try (1.1.0) + cocoapods-try (1.2.0) + colored (1.2) colored2 (3.1.2) - concurrent-ruby (1.1.5) + commander (4.6.0) + highline (~> 2.0.0) + concurrent-ruby (1.1.9) + declarative (0.0.20) + digest-crc (0.6.4) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.7.6) + emoji_regex (3.2.3) escape (0.0.4) + excon (0.91.0) + faraday (1.9.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.3) + multipart-post (>= 1.2, < 3) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.6) + fastlane (2.204.2) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (~> 2.0.0) + naturally (~> 2.2) + optparse (~> 0.1.1) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.16.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-core (0.4.2) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-iamcredentials_v1 (0.10.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-playcustomapp_v1 (0.7.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-storage_v1 (0.11.0) + google-apis-core (>= 0.4, < 2.a) + google-cloud-core (1.6.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-env (1.5.0) + faraday (>= 0.17.3, < 2.0) + google-cloud-errors (1.2.0) + google-cloud-storage (1.36.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.1) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.1.0) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.4) + domain_name (~> 0.5) + httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - minitest (5.12.0) + jmespath (1.5.0) + json (2.6.1) + jwt (2.3.0) + memoist (0.16.2) + mini_magick (4.11.0) + mini_mime (1.1.2) + minitest (5.15.0) molinillo (0.6.6) - nanaimo (0.2.6) + multi_json (1.15.0) + multipart-post (2.0.0) + nanaimo (0.3.0) nap (1.1.0) + naturally (2.2.1) netrc (0.11.0) + optparse (0.1.1) + os (1.1.4) + parallel (1.21.0) + parser (3.1.0.0) + ast (~> 2.4.1) + plist (3.6.0) + public_suffix (4.0.6) + rainbow (3.1.1) + rake (13.0.6) + regexp_parser (2.2.0) + representable (3.1.1) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.5) + rouge (2.0.7) + rubocop (1.25.1) + parallel (~> 1.10) + parser (>= 3.1.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.15.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.15.1) + parser (>= 3.0.1.1) ruby-macho (1.4.0) + ruby-progressbar (1.11.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.3) + signet (0.16.0) + addressable (~> 2.8) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.8) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (1.6.0) thread_safe (0.3.6) - tzinfo (1.2.5) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + tzinfo (1.2.9) thread_safe (~> 0.1) - xcodeproj (1.12.0) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8) + unicode-display_width (2.1.0) + webrick (1.7.0) + word_wrap (1.0.0) + xcodeproj (1.21.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.6) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.7.5)! + cocoapods (~> 1.8.0) + fastlane (~> 2.189) + rubocop (~> 1.18) BUNDLED WITH - 2.0.2 + 2.2.33 diff --git a/WordPress-Aztec-iOS.podspec b/WordPress-Aztec-iOS.podspec index 8eacfefaa..28aa8fa57 100644 --- a/WordPress-Aztec-iOS.podspec +++ b/WordPress-Aztec-iOS.podspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Pod::Spec.new do |s| s.name = 'WordPress-Aztec-iOS' s.version = '1.19.7' @@ -7,21 +9,21 @@ Pod::Spec.new do |s| The native HTML Editor by Automattic Inc. This library provides a UITextView subclass with HTML visual editing capabilities. - DESC + DESC s.homepage = 'https://github.com/wordpress-mobile/AztecEditor-iOS' - s.license = { :type => 'MPLv2', :file => 'LICENSE.md' } + s.license = { type: 'MPLv2', file: 'LICENSE.md' } s.author = { 'The WordPress Mobile Team' => 'mobile@wordpress.org' } s.ios.deployment_target = '11.0' s.swift_version = '5.0' - s.source = { :git => 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', :tag => s.version.to_s } - s.module_name = "Aztec" + s.source = { git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', tag: s.version.to_s } + s.module_name = 'Aztec' s.source_files = 'Aztec/Classes/**/*' s.resource_bundles = { 'WordPress-Aztec-iOS': [ - "Aztec/Assets/**/*" + 'Aztec/Assets/**/*' ] } s.xcconfig = { diff --git a/WordPress-Editor-iOS.podspec b/WordPress-Editor-iOS.podspec index 729a5c3b1..a4fa51852 100644 --- a/WordPress-Editor-iOS.podspec +++ b/WordPress-Editor-iOS.podspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Pod::Spec.new do |s| s.name = 'WordPress-Editor-iOS' s.version = '1.19.7' @@ -8,17 +10,17 @@ Pod::Spec.new do |s| This library provides a UITextView subclass with HTML visual editing capabilities. Use this library if you want to create an App that interacts with WordPress HTML content. - DESC + DESC s.homepage = 'https://github.com/wordpress-mobile/AztecEditor-iOS' - s.license = { :type => 'MPLv2', :file => 'LICENSE.md' } + s.license = { type: 'MPLv2', file: 'LICENSE.md' } s.author = { 'The WordPress Mobile Team' => 'mobile@wordpress.org' } s.ios.deployment_target = '11.0' s.swift_version = '5.0' - - s.source = { :git => 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', :tag => s.version.to_s } - s.module_name = "WordPressEditor" + + s.source = { git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', tag: s.version.to_s } + s.module_name = 'WordPressEditor' s.source_files = 'WordPressEditor/WordPressEditor/Classes/**/*' s.resources = 'WordPressEditor/WordPressEditor/Assets/**/*' s.xcconfig = { @@ -26,5 +28,5 @@ Pod::Spec.new do |s| 'HEADER_SEARCH_PATHS' => '/usr/include/libxml2' } - s.dependency "WordPress-Aztec-iOS", s.version.to_s + s.dependency 'WordPress-Aztec-iOS', s.version.to_s end diff --git a/WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj b/WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj index 9e03fb0af..b13f3dcb5 100644 --- a/WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj +++ b/WordPressEditor/WordPressEditor.xcodeproj/project.pbxproj @@ -555,7 +555,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0930; - LastUpgradeCheck = 1230; + LastUpgradeCheck = 1310; ORGANIZATIONNAME = "Automattic Inc."; TargetAttributes = { F1D360AC2092947500B4E7A5 = { diff --git a/WordPressEditor/WordPressEditor.xcodeproj/xcshareddata/xcschemes/WordPressEditor.xcscheme b/WordPressEditor/WordPressEditor.xcodeproj/xcshareddata/xcschemes/WordPressEditor.xcscheme new file mode 100644 index 000000000..63824d665 --- /dev/null +++ b/WordPressEditor/WordPressEditor.xcodeproj/xcshareddata/xcschemes/WordPressEditor.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 000000000..252f581a6 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +default_platform(:ios) + +TEST_RUNTIME = 'iOS 15.0' +TEST_DEVICE = 'iPhone 11' + +platform :ios do + desc 'Builds the project and runs tests' + lane :test do + device = create_simulator(TEST_RUNTIME, TEST_DEVICE) + + run_tests( + workspace: 'Aztec.xcworkspace', + scheme: 'Aztec', + device: device.name, + prelaunch_simulator: true, + buildlog_path: File.join(__dir__, '.build', 'logs'), + derived_data_path: File.join(__dir__, '.build', 'derived-data'), + ensure_devices_found: true + ) + + run_tests( + workspace: 'Aztec.xcworkspace', + scheme: 'WordPressEditor', + device: device.name, + prelaunch_simulator: true, + buildlog_path: File.join(__dir__, '.build', 'logs'), + derived_data_path: File.join(__dir__, '.build', 'derived-data'), + ensure_devices_found: true + ) + + destroy_simulator(device) + end +end + +def create_simulator(runtime, device) + fastlane_require 'simctl' + fastlane_require 'securerandom' + + validate_runtime_exists(runtime) + + simulator = SimCtl.create_device( + SecureRandom.uuid, + SimCtl.devicetype(name: device), + SimCtl.runtime(name: runtime) + ) + + UI.success "Successfully created an #{runtime} #{device} labelled #{simulator.name}" + + simulator +end + +def validate_runtime_exists(runtime) + fastlane_require 'simctl' + + begin + SimCtl.runtime({ name: runtime }) + rescue StandardError + SimCtl.list_runtimes.each do |existing_runtime| + puts existing_runtime.name + end + + UI.user_error! "#{runtime} is not available. Available runtimes are listed above." + end +end + +def destroy_simulator(simulator) + runtime = simulator.runtime.name + device_type_name = simulator.devicetype.name + + simulator.delete + UI.success "Successfully deleted #{runtime} #{device_type_name}" +end