run_loop 1.0.8 → 1.0.9
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 +4 -4
- data/lib/run_loop/core.rb +9 -17
- data/lib/run_loop/sim_control.rb +97 -7
- data/lib/run_loop/version.rb +1 -1
- data/lib/run_loop/xctools.rb +1 -10
- data/scripts/run_loop_host.js +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd788e0a671931f1ce5b3bac708f21670e29b5b2
|
4
|
+
data.tar.gz: 5361aaeb26d981a5857aa4c67f38348c1430d8e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecc950e0a6a3a014b9cad45aaa73dcb3d731b2fe68e116b9f97c35cc910e907d80c4d8eee6c1cb1ecf3763e6d929d80c2176ccdf4d05d55a7b85a61192cc4a8c
|
7
|
+
data.tar.gz: 909167069d0abc322404b191f97569d8f22cd603a413aed63b22a608228b02bbf3cf5264f0c4c233f0591220ad8e1c1d3f82e27b0a58785cf9014768a9943bce
|
data/lib/run_loop/core.rb
CHANGED
@@ -92,7 +92,7 @@ module RunLoop
|
|
92
92
|
|
93
93
|
if self.simulator_target?(options, sim_control)
|
94
94
|
# @todo only enable accessibility on the targeted simulator
|
95
|
-
sim_control.enable_accessibility_on_sims({:verbose =>
|
95
|
+
sim_control.enable_accessibility_on_sims({:verbose => false})
|
96
96
|
end
|
97
97
|
|
98
98
|
device_target = options[:udid] || options[:device_target] || detect_connected_device || 'simulator'
|
@@ -358,7 +358,9 @@ module RunLoop
|
|
358
358
|
# @param [RunLoop::XCTools] xcode_tools Used to detect the current xcode
|
359
359
|
# version.
|
360
360
|
def self.default_simulator(xcode_tools=RunLoop::XCTools.new)
|
361
|
-
if xcode_tools.
|
361
|
+
if xcode_tools.xcode_version_gte_61?
|
362
|
+
'iPhone 5 (8.1 Simulator)'
|
363
|
+
elsif xcode_tools.xcode_version_gte_6?
|
362
364
|
'iPhone 5 (8.0 Simulator)'
|
363
365
|
else
|
364
366
|
'iPhone Retina (4-inch) - Simulator - iOS 7.1'
|
@@ -574,21 +576,11 @@ module RunLoop
|
|
574
576
|
|
575
577
|
def self.default_tracetemplate(xctools=RunLoop::XCTools.new)
|
576
578
|
templates = xctools.instruments :templates
|
577
|
-
if xctools.
|
578
|
-
templates.
|
579
|
-
not path =~ /\/Automation.tracetemplate/
|
580
|
-
end.delete_if do |path|
|
581
|
-
not path =~ /Xcode/
|
582
|
-
end.first.tr("\"", '').strip
|
583
|
-
elsif xctools.xcode_version_gte_6?
|
584
|
-
templates.delete_if do |name|
|
585
|
-
not name == 'Automation'
|
586
|
-
end.first
|
579
|
+
if xctools.xcode_version_gte_6?
|
580
|
+
templates.select { |name| name == 'Automation' }.first
|
587
581
|
else
|
588
|
-
templates.
|
589
|
-
|
590
|
-
end.delete_if do |path|
|
591
|
-
not path =~ /Xcode/
|
582
|
+
templates.select do |path|
|
583
|
+
path =~ /\/Automation.tracetemplate/ and path =~ /Xcode/
|
592
584
|
end.first.tr("\"", '').strip
|
593
585
|
end
|
594
586
|
end
|
@@ -742,4 +734,4 @@ module RunLoop
|
|
742
734
|
script
|
743
735
|
end
|
744
736
|
|
745
|
-
end
|
737
|
+
end
|
data/lib/run_loop/sim_control.rb
CHANGED
@@ -290,6 +290,9 @@ module RunLoop
|
|
290
290
|
details = sim_details :udid
|
291
291
|
results = existing.map do |dir|
|
292
292
|
enable_accessibility_in_sim_data_dir(dir, details, opts)
|
293
|
+
# This is done here so we don't have to make a public method
|
294
|
+
# to enable the keyboards for all devices.
|
295
|
+
enable_keyboard_in_sim_data_dir(dir, details, opts)
|
293
296
|
end
|
294
297
|
else
|
295
298
|
possible = XCODE_5_SDKS.map do |sdk|
|
@@ -665,15 +668,15 @@ module RunLoop
|
|
665
668
|
#
|
666
669
|
# @param [String] sim_data_dir The directory where the
|
667
670
|
# Library/Preferences/com.apple.Accessibility.plist can be found.
|
668
|
-
# @param [Hash]
|
671
|
+
# @param [Hash] sim_details_keyed_with_udid A hash table of simulator details
|
669
672
|
# that can be obtained by calling `sim_details(:udid)`.
|
670
673
|
#
|
671
674
|
# @param [Hash] opts controls the behavior of the method
|
672
675
|
# @option opts [Boolean] :verbose controls logging output
|
673
|
-
# @return [Boolean]
|
674
|
-
# updated.
|
676
|
+
# @return [Boolean] If the plist exists and the plist was successfully
|
677
|
+
# updated or if the directory was skipped (see code comments).
|
675
678
|
# @raise [RuntimeError] If called when Xcode 6 is _not_ the active Xcode version.
|
676
|
-
def enable_accessibility_in_sim_data_dir(sim_data_dir,
|
679
|
+
def enable_accessibility_in_sim_data_dir(sim_data_dir, sim_details_keyed_with_udid, opts={})
|
677
680
|
unless xcode_version_gte_6?
|
678
681
|
raise RuntimeError, 'it is illegal to call this method when the Xcode < 6 is the current Xcode version'
|
679
682
|
end
|
@@ -685,9 +688,20 @@ module RunLoop
|
|
685
688
|
|
686
689
|
verbose = merged_opts[:verbose]
|
687
690
|
target_udid = sim_data_dir[XCODE_6_SIM_UDID_REGEX, 0]
|
688
|
-
launch_name = sim_details_key_with_udid[target_udid][:launch_name]
|
689
|
-
sdk_version = sim_details_key_with_udid[target_udid][:sdk_version]
|
690
691
|
|
692
|
+
# Directory contains simulators not reported by instruments -s devices
|
693
|
+
simulator_details = sim_details_keyed_with_udid[target_udid]
|
694
|
+
if simulator_details.nil?
|
695
|
+
if verbose
|
696
|
+
xcode_version = xctools.xcode_version
|
697
|
+
puts ["INFO: Skipping '#{target_udid}' directory because",
|
698
|
+
"there is no corresponding simulator for active Xcode (version '#{xcode_version}')"].join("\n")
|
699
|
+
end
|
700
|
+
return true
|
701
|
+
end
|
702
|
+
|
703
|
+
launch_name = simulator_details.fetch(:launch_name, nil)
|
704
|
+
sdk_version = simulator_details.fetch(:sdk_version, nil)
|
691
705
|
msgs = ["cannot enable accessibility for '#{target_udid}' - '#{launch_name}'"]
|
692
706
|
plist_path = File.expand_path("#{sim_data_dir}/Library/Preferences/com.apple.Accessibility.plist")
|
693
707
|
|
@@ -717,12 +731,88 @@ module RunLoop
|
|
717
731
|
msgs << "could not set #{hash_key} => '#{settings[:key]}' to #{value}"
|
718
732
|
puts "WARN: #{msgs.join("\n")}"
|
719
733
|
end
|
720
|
-
|
734
|
+
end
|
721
735
|
success
|
722
736
|
end
|
723
737
|
res.all?
|
724
738
|
end
|
725
739
|
|
740
|
+
# @!visibility private
|
741
|
+
# Enables the keyboard to be shown by default on the new Xcode 6 simulators.
|
742
|
+
#
|
743
|
+
# The new CoreSimulator environment has a new Hardware > Keyboard > Connect
|
744
|
+
# Hardware Keyboard option which is on by default and prevents the native
|
745
|
+
# keyboard from being presented.
|
746
|
+
#
|
747
|
+
# @note This will quit the simulator.
|
748
|
+
#
|
749
|
+
# @note This is for Xcode 6 only. Will raise an error if called on Xcode 5.
|
750
|
+
#
|
751
|
+
# If the Library/Preferences/com.apple.Preferences.plist file doesn't exist
|
752
|
+
# this method will create one with the content to activate the keyboard.
|
753
|
+
#
|
754
|
+
# @param [String] sim_data_dir The directory where the
|
755
|
+
# Library/Preferences/com.apple.Preferences.plist can be found.
|
756
|
+
# @param [Hash] sim_details_keyed_with_udid A hash table of simulator details
|
757
|
+
# that can be obtained by calling `sim_details(:udid)`.
|
758
|
+
#
|
759
|
+
# @param [Hash] opts controls the behavior of the method
|
760
|
+
# @option opts [Boolean] :verbose controls logging output
|
761
|
+
# @return [Boolean] If the plist exists and the plist was successfully
|
762
|
+
# updated or if the directory was skipped (see code comments).
|
763
|
+
# @raise [RuntimeError] If called when Xcode 6 is _not_ the active Xcode version.
|
764
|
+
def enable_keyboard_in_sim_data_dir(sim_data_dir, sim_details_keyed_with_udid, opts={})
|
765
|
+
unless xcode_version_gte_6?
|
766
|
+
raise RuntimeError, 'it is illegal to call this method when the Xcode < 6 is the current Xcode version'
|
767
|
+
end
|
768
|
+
|
769
|
+
hash = {:key => 'AutomaticMinimizationEnabled',
|
770
|
+
:value => 0,
|
771
|
+
:type => 'integer'}
|
772
|
+
|
773
|
+
default_opts = {:verbose => false}
|
774
|
+
merged_opts = default_opts.merge(opts)
|
775
|
+
|
776
|
+
quit_sim
|
777
|
+
|
778
|
+
verbose = merged_opts[:verbose]
|
779
|
+
target_udid = sim_data_dir[XCODE_6_SIM_UDID_REGEX, 0]
|
780
|
+
|
781
|
+
# Directory contains simulators not reported by instruments -s devices
|
782
|
+
simulator_details = sim_details_keyed_with_udid[target_udid]
|
783
|
+
if simulator_details.nil?
|
784
|
+
if verbose
|
785
|
+
xcode_version = xctools.xcode_version
|
786
|
+
puts ["INFO: Skipping '#{target_udid}' directory because",
|
787
|
+
"there is no corresponding simulator for active Xcode (version '#{xcode_version}')"].join("\n")
|
788
|
+
end
|
789
|
+
return true
|
790
|
+
end
|
791
|
+
|
792
|
+
launch_name = simulator_details.fetch(:launch_name, nil)
|
793
|
+
|
794
|
+
msgs = ["cannot enable keyboard for '#{target_udid}' - '#{launch_name}'"]
|
795
|
+
plist_path = File.expand_path("#{sim_data_dir}/Library/Preferences/com.apple.Preferences.plist")
|
796
|
+
|
797
|
+
unless File.exist? plist_path
|
798
|
+
FileUtils.mkdir_p("#{sim_data_dir}/Library/Preferences")
|
799
|
+
plist = CFPropertyList::List.new
|
800
|
+
data = {}
|
801
|
+
plist.value = CFPropertyList.guess(data)
|
802
|
+
plist.save(plist_path, CFPropertyList::List::FORMAT_BINARY)
|
803
|
+
end
|
804
|
+
|
805
|
+
success = pbuddy.plist_set(hash[:key], hash[:type], hash[:value], plist_path)
|
806
|
+
unless success
|
807
|
+
if verbose
|
808
|
+
msgs << "could not set #{hash[:key]} => '#{hash[:key]}' to #{hash[:value]}"
|
809
|
+
puts "WARN: #{msgs.join("\n")}"
|
810
|
+
end
|
811
|
+
end
|
812
|
+
|
813
|
+
success
|
814
|
+
end
|
815
|
+
|
726
816
|
# @!visibility private
|
727
817
|
# Returns a hash table that contains detailed information about the
|
728
818
|
# available simulators. Use the `primary_key` to control the primary hash
|
data/lib/run_loop/version.rb
CHANGED
data/lib/run_loop/xctools.rb
CHANGED
@@ -157,16 +157,7 @@ module RunLoop
|
|
157
157
|
when :templates
|
158
158
|
@instruments_templates ||= lambda {
|
159
159
|
cmd = "#{instruments} -s templates"
|
160
|
-
if self.xcode_version >= self.
|
161
|
-
Open3.popen3(cmd) do |_, stdout, stderr, _|
|
162
|
-
stderr_filter.call(stderr)
|
163
|
-
stdout.read.chomp.split("\n").map do |line|
|
164
|
-
line.strip.tr('"', '')
|
165
|
-
end.delete_if do |path|
|
166
|
-
not path =~ /tracetemplate/
|
167
|
-
end
|
168
|
-
end
|
169
|
-
elsif self.xcode_version >= self.v60
|
160
|
+
if self.xcode_version >= self.v60
|
170
161
|
Open3.popen3(cmd) do |_, stdout, stderr, _|
|
171
162
|
stderr_filter.call(stderr)
|
172
163
|
stdout.read.chomp.split("\n").map { |elm| elm.strip.tr('"', '') }
|
data/scripts/run_loop_host.js
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Krukow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -242,8 +242,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
version: '0'
|
243
243
|
requirements: []
|
244
244
|
rubyforge_project:
|
245
|
-
rubygems_version: 2.4.
|
245
|
+
rubygems_version: 2.4.2
|
246
246
|
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: Tools related to running Calabash iOS tests
|
249
249
|
test_files: []
|
250
|
+
has_rdoc:
|