run_loop_tcc 2.1.4 → 2.1.5
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/cli/tcc.rb +1 -0
- data/lib/run_loop/device.rb +37 -0
- data/lib/run_loop/plist_buddy.rb +3 -3
- data/lib/run_loop/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba34fbad489b76c83f05053ea85c84d7170d1311
|
4
|
+
data.tar.gz: 54274decfe80bde2eb1d390759e06ab69e11cb5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e82e8d023569c115a0b77c4d1ee7b9e1433e580e8976c8df14d5fc7be290555ceb908754516e1dab9f1aea4ad985a34111f7ebe8eb78d2f4380cf15c518aa072
|
7
|
+
data.tar.gz: 2c83f38e2dea1f5ebcbdd45dd0cf6bf173eeb088dbc1c2df7800720db8e499e86fe7af75ed26468064eeba9d3f1dca9a83f75c9286377eaeb6a51bb0484f6506
|
data/lib/run_loop/cli/tcc.rb
CHANGED
data/lib/run_loop/device.rb
CHANGED
@@ -37,6 +37,7 @@ module RunLoop
|
|
37
37
|
attr_reader :state
|
38
38
|
attr_reader :simulator_root_dir
|
39
39
|
attr_reader :simulator_accessibility_plist_path
|
40
|
+
attr_reader :simulator_locationd_plist_path
|
40
41
|
attr_reader :simulator_preferences_plist_path
|
41
42
|
attr_reader :simulator_log_file_path
|
42
43
|
attr_reader :pbuddy
|
@@ -287,6 +288,14 @@ version: #{version}
|
|
287
288
|
}.call
|
288
289
|
end
|
289
290
|
|
291
|
+
# @!visibility private
|
292
|
+
def simulator_locationd_plist_path
|
293
|
+
@simulator_locationd_plist_path ||= lambda {
|
294
|
+
return nil if physical_device?
|
295
|
+
File.join(simulator_root_dir, 'data/Library/Caches/locationd/clients.plist')
|
296
|
+
}.call
|
297
|
+
end
|
298
|
+
|
290
299
|
# @!visibility private
|
291
300
|
def simulator_preferences_plist_path
|
292
301
|
@simulator_preferences_plist_path ||= lambda {
|
@@ -459,6 +468,34 @@ version: #{version}
|
|
459
468
|
locale
|
460
469
|
end
|
461
470
|
|
471
|
+
# Authorize location permission.
|
472
|
+
# @param [String] bundle_id bundle id to authorize
|
473
|
+
# @raise [RuntimeError] if this is a physical device
|
474
|
+
def simulator_allow_location(bundle_id)
|
475
|
+
if physical_device?
|
476
|
+
raise RuntimeError, "This method is for Simulators only"
|
477
|
+
end
|
478
|
+
|
479
|
+
location_plist = simulator_locationd_plist_path
|
480
|
+
unless File.exist? location_plist
|
481
|
+
FileUtils.mkdir_p File.dirname location_plist
|
482
|
+
pbuddy.create_plist(location_plist)
|
483
|
+
end
|
484
|
+
pbuddy.plist_set("#{bundle_id}", 'dict', nil, location_plist)
|
485
|
+
pbuddy.plist_set("#{bundle_id}:BundleId", 'string', bundle_id, location_plist)
|
486
|
+
pbuddy.plist_set("#{bundle_id}:Authorization", 'integer', 2, location_plist)
|
487
|
+
pbuddy.plist_set("#{bundle_id}:SupportedAuthorizationMask", 'integer', 3, location_plist)
|
488
|
+
|
489
|
+
# BundleId - String - bundle_id
|
490
|
+
# Authorization - Integer - 2
|
491
|
+
# SupportedAuthorizationMask - Integer - 3
|
492
|
+
|
493
|
+
# Add :new.id Dict
|
494
|
+
# Add :new.id:BundleId string com.my.bundleid
|
495
|
+
# Add :new.id:SupportedAuthorizationMask integer 3
|
496
|
+
# Add :new.id:Authorization integer 2
|
497
|
+
end
|
498
|
+
|
462
499
|
# @!visibility private
|
463
500
|
#
|
464
501
|
# Returns the AppleLanguages array in global plist as an array
|
data/lib/run_loop/plist_buddy.rb
CHANGED
@@ -149,12 +149,12 @@ module RunLoop
|
|
149
149
|
unless value_type
|
150
150
|
raise(ArgumentError, ':value_type is a required key for :add command')
|
151
151
|
end
|
152
|
-
allowed_value_types = ['string', 'bool', 'real', 'integer']
|
152
|
+
allowed_value_types = ['string', 'bool', 'real', 'integer', 'dict']
|
153
153
|
unless allowed_value_types.include?(value_type)
|
154
154
|
raise(ArgumentError, "expected '#{value_type}' to be one of '#{allowed_value_types}'")
|
155
155
|
end
|
156
156
|
value = args_hash[:value]
|
157
|
-
unless value
|
157
|
+
unless value || args_hash[:type] == 'dict'
|
158
158
|
raise(ArgumentError, ':value is a required key for :add command')
|
159
159
|
end
|
160
160
|
key = args_hash[:key]
|
@@ -170,7 +170,7 @@ module RunLoop
|
|
170
170
|
cmd_part = "\"Print :#{key}\""
|
171
171
|
when :set
|
172
172
|
value = args_hash[:value]
|
173
|
-
unless value
|
173
|
+
unless value || args_hash[:type] == 'dict'
|
174
174
|
raise(ArgumentError, ':value is a required key for :set command')
|
175
175
|
end
|
176
176
|
key = args_hash[:key]
|
data/lib/run_loop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: run_loop_tcc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Krukow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -435,9 +435,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
435
435
|
version: '0'
|
436
436
|
requirements: []
|
437
437
|
rubyforge_project:
|
438
|
-
rubygems_version: 2.6.
|
438
|
+
rubygems_version: 2.6.10
|
439
439
|
signing_key:
|
440
440
|
specification_version: 4
|
441
441
|
summary: Fork of run_loop with tcc support.
|
442
442
|
test_files: []
|
443
|
-
has_rdoc:
|