tworingtools 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/rebuild-sims +70 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf6328f361ce6dacbb3ecac3554e8fa6bc65e659
|
4
|
+
data.tar.gz: 40900ebc25ea6bdc97120ff577b04e3dd0edb2ae
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9120bd4f9915f1d6a4d1cae6e032d009929da4a4a03ee3d343e1735337d892ca1b5cdd64ae6657c593a63de723b5efbc1a2d1888a17bb54d73c748d3d9f3b8c9
|
7
|
+
data.tar.gz: '09e4067570e0f5583f61de08f114c9d25f4b04f179301ec8710c66f573670191b0cc5e1c59192d129637ccd327ec83edef6d942ab66ce8ce75a3588f55e9b89f'
|
data/bin/rebuild-sims
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
# get the lists of device types and runtimes
|
6
|
+
@device_types = JSON.parse(`xcrun simctl list -j devicetypes`)
|
7
|
+
@runtimes = JSON.parse(`xcrun simctl list -j runtimes`)
|
8
|
+
|
9
|
+
def put_and_exe command
|
10
|
+
puts command
|
11
|
+
`#{command}`
|
12
|
+
end
|
13
|
+
|
14
|
+
puts 'Deleting simulators...'
|
15
|
+
puts
|
16
|
+
|
17
|
+
put_and_exe 'xcrun simctl delete unavailable'
|
18
|
+
|
19
|
+
# delete all simulators
|
20
|
+
put_and_exe "xcrun simctl list -j devices | jq '[.devices[]] | flatten | .[] | .udid' | xargs -t -I @ xcrun simctl delete @"
|
21
|
+
|
22
|
+
# sometimes simctl list misses some things
|
23
|
+
user = `whoami`.strip
|
24
|
+
simulator_dir = "/Users/#{user}/Library/Developer/CoreSimulator/Devices"
|
25
|
+
leftover_simulators = Dir.entries(simulator_dir).select do |child|
|
26
|
+
child != '.' && child != '..' && File.directory?(simulator_dir + '/' + child)
|
27
|
+
end
|
28
|
+
if leftover_simulators.count > 0 then
|
29
|
+
puts
|
30
|
+
puts "The following were not removed by simctl, consider manually deleting:"
|
31
|
+
puts
|
32
|
+
puts leftover_simulators.map {|dir| simulator_dir + '/' + dir}
|
33
|
+
end
|
34
|
+
|
35
|
+
puts
|
36
|
+
puts 'Creating simulators...'
|
37
|
+
puts
|
38
|
+
|
39
|
+
# given a runtime keyword (e.g. 'iphone') and a set of device type keywords (e.g. 'ios'), find all runtimes matching the runtime keyword, and all device types that match one of the device type keywords, take the cartesian product of runtimes and device types and create a simulator for each entry in that product
|
40
|
+
def create_simulators runtime_keyword, device_type_keywords
|
41
|
+
selected_runtimes = @runtimes['runtimes'].select do |runtime|
|
42
|
+
runtime['name'].downcase.include?(runtime_keyword)
|
43
|
+
end
|
44
|
+
selected_device_types = @device_types['devicetypes'].select do |device_type|
|
45
|
+
device_type_keywords.select do |keyword|
|
46
|
+
device_type['name'].downcase.include?(keyword)
|
47
|
+
end.size > 0
|
48
|
+
end
|
49
|
+
selected_runtimes.product(selected_device_types).each do |runtime_device_type_pair_array|
|
50
|
+
runtime = runtime_device_type_pair_array.first
|
51
|
+
device_type = runtime_device_type_pair_array.last
|
52
|
+
create_command = "xcrun simctl create '#{device_type['name']} (#{runtime['name']})' #{device_type['identifier']} #{runtime['identifier']}"
|
53
|
+
puts create_command
|
54
|
+
`#{create_command}`
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# create simulators for each runtime/device relationship
|
59
|
+
create_simulators 'ios', ['iphone', 'ipad']
|
60
|
+
create_simulators 'tv', ['tv']
|
61
|
+
create_simulators 'watch', ['watch']
|
62
|
+
|
63
|
+
puts
|
64
|
+
puts 'Summary:'
|
65
|
+
puts
|
66
|
+
|
67
|
+
# print summary
|
68
|
+
list_command = 'xcrun simctl list devices'
|
69
|
+
puts list_command
|
70
|
+
puts `#{list_command}`
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tworingtools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew McKnight
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-17 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: " - rebuild-sims: Delete all simulators and recreate one for each compatible
|
14
|
+
platform and device type pairing.\n"
|
15
|
+
email: andrew@tworingsoft.com
|
16
|
+
executables:
|
17
|
+
- rebuild-sims
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/rebuild-sims
|
22
|
+
homepage: https://github.com/TwoRingSoft/tools
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.5.2.3
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: A collection of command line tools.
|
46
|
+
test_files: []
|