run_loop 2.1.0 → 2.1.1.pre1

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
  SHA1:
3
- metadata.gz: ee9ecaf4f1c6ec33be1a4e7640991c46e14f1938
4
- data.tar.gz: 7348a649fd00ef921ccf16d049ca1f7c9c9b5421
3
+ metadata.gz: 5c918815b4ef775ad83f3f3ade7e33db64704d5b
4
+ data.tar.gz: a41970f9c49cb57129305389b4613af8ae2eb833
5
5
  SHA512:
6
- metadata.gz: f2de3db8241ef24056e0d140d569c30082d0436acd251134b0b2908ef063a9dc97e9be2be8431701340c21e80bc3cd2978a41893ffb3b787231aaff191b8637f
7
- data.tar.gz: 46c3ca51600d39434fee5a25d47b41c1122846f5e7eb3852e079174c1393acfa18df5e0cb9605899d6341b7cad1e3846212ad8348de1be1aad13af2622555010
6
+ metadata.gz: 4602a64d7e56fadc22bb0eeb77f11421367b6513c51b0ab3dd6da8e5d38ed836e48223cfbd72176cc878e31c0e748ea5444a4eb5e5c38eee4ce9a58dc6491df5
7
+ data.tar.gz: 4b6faebb8be5987067ee0a3af74c35f3c0010256d3636c40fef9d638fd9a3027c693c6786b5f715b04dd85d1fd2f4b63ddccdd10391898bbf8d0218038e52af1
@@ -751,12 +751,48 @@ Command had no output
751
751
  sim_app_dir = device_applications_dir
752
752
  return nil if !File.exist?(sim_app_dir)
753
753
 
754
- if xcode.version_gte_7?
755
- simctl = RunLoop::Simctl.new(device)
756
- simctl.app_container(app.bundle_identifier)
757
- else
758
- Dir.glob("#{sim_app_dir}/**/*.app").find do |path|
759
- RunLoop::App.new(path).bundle_identifier == app.bundle_identifier
754
+ app_bundle_dir = Dir.glob("#{sim_app_dir}/**/*.app").find do |path|
755
+ RunLoop::App.new(path).bundle_identifier == app.bundle_identifier
756
+ end
757
+
758
+ app_bundle_dir = ensure_complete_app_installation(app_bundle_dir)
759
+
760
+ app_bundle_dir
761
+ end
762
+
763
+ # Cleans up bad installations of an app. For unknown reasons, an app bundle
764
+ # can exist, but be unrecognized by CoreSimulator. If we detect a case like
765
+ # this, we need to clean up the installation.
766
+ def ensure_complete_app_installation(app_bundle_dir)
767
+ return nil if app_bundle_dir.nil?
768
+ return app_bundle_dir if complete_app_install?(app_bundle_dir)
769
+
770
+ # Remove the directory that contains the app bundle
771
+ base_dir = File.dirname(app_bundle_dir)
772
+ FileUtils.rm_rf(base_dir)
773
+
774
+ # Clean up Containers/Data/Application
775
+ remove_stale_data_containers
776
+
777
+ nil
778
+ end
779
+
780
+ # Detect an incomplete app installation.
781
+ def complete_app_install?(app_bundle_dir)
782
+ base_dir = File.dirname(app_bundle_dir)
783
+ plist = File.join(base_dir, METADATA_PLIST)
784
+ File.exist?(plist)
785
+ end
786
+
787
+ # Remove stale data directories that might have appeared as a result of an
788
+ # incomplete app installation.
789
+ # See #ensure_complete_app_installation
790
+ def remove_stale_data_containers
791
+ containers_data_dir = File.join(device_data_dir, "Containers", "Data", "Application")
792
+ apps = Dir.glob("#{containers_data_dir}/**/#{METADATA_PLIST}")
793
+ apps.each do |metadata_plist|
794
+ if pbuddy.plist_read("MCMMetadataIdentifier", metadata_plist) == app.bundle_identifier
795
+ FileUtils.rm_rf(File.dirname(metadata_plist))
760
796
  end
761
797
  end
762
798
  end
@@ -39,7 +39,7 @@ module RunLoop
39
39
  # @!visibility private
40
40
  # @deprecated 2.1.0
41
41
  def xcode_version_gte_51?
42
- RunLoop.deprecated("2.1.0", "No replacement.")
42
+ #RunLoop.deprecated("2.1.0", "No replacement.")
43
43
  xcode.version_gte_51?
44
44
  end
45
45
 
@@ -53,6 +53,14 @@ module RunLoop
53
53
  #
54
54
  # This method is not supported on Xcode < 7 - returns nil.
55
55
  #
56
+ # Simulator must be booted in El Cap, which makes this method useless for us
57
+ # because we have to do a bunch of pre-launch checks for sandbox resetting.
58
+ #
59
+ # Testing has shown that moving the device in and out of the booted state
60
+ # takes a long time (seconds) and is unpredictable.
61
+ #
62
+ # TODO ensure a booted state.
63
+ #
56
64
  # @param [String] bundle_id The CFBundleIdentifier of the app.
57
65
  # @return [String] The path to the .app bundle if it exists; nil otherwise.
58
66
  def app_container(bundle_id)
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1.pre1"
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
@@ -180,7 +180,7 @@ module RunLoop
180
180
  #
181
181
  # @return [Boolean] `true` if the current Xcode version is >= 5.1
182
182
  def version_gte_51?
183
- RunLoop.deprecated("2.1.0", "No replacement")
183
+ #RunLoop.deprecated("2.1.0", "No replacement")
184
184
  version >= v51
185
185
  end
186
186
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_loop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -362,9 +362,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
362
362
  version: '2.0'
363
363
  required_rubygems_version: !ruby/object:Gem::Requirement
364
364
  requirements:
365
- - - ">="
365
+ - - ">"
366
366
  - !ruby/object:Gem::Version
367
- version: '0'
367
+ version: 1.3.1
368
368
  requirements: []
369
369
  rubyforge_project:
370
370
  rubygems_version: 2.5.2