apple_sim_utils 0.1.1 → 0.1.2
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/README.md +7 -2
- data/lib/apple_sim_utils/command.rb +28 -3
- data/lib/apple_sim_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5267b96c0e69fc77d0d8c33e71e5e55c18364569
|
4
|
+
data.tar.gz: 94b82dcfdf6a2a348709a0f73707f64d7c792909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3e88ccc4efeec86111454d4b30dd11314e1d2d0ccd391253a4d6432a0018e67ec8a2153150e3f0054fe97fdc139b25d800df8f107b14ada9e192fd8546d7167
|
7
|
+
data.tar.gz: 93fa18e04ee3f54db936e853aba6cb32d3428ef8ad03f2ae74aeabe625159b443c681fdbae7eaeb42e1b2d49c6ac6410cfad942d36d2626b1aced753799a1a58
|
data/README.md
CHANGED
@@ -20,7 +20,12 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
```
|
24
|
+
$ cmd = AppleSimUtils::Cmd.new(bundle_id: 'com.apple.example')
|
25
|
+
$ cmd.allow_all(device: 'iPhone SE, OS = 10.3', permissions: %w(notifications photos camera))
|
26
|
+
```
|
27
|
+
|
28
|
+
See test/apple_sim_utils_test.rb for more details.
|
24
29
|
|
25
30
|
## Development
|
26
31
|
|
@@ -30,7 +35,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
30
35
|
|
31
36
|
## Contributing
|
32
37
|
|
33
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/KazuCocoa/apple_sim_utils.
|
34
39
|
|
35
40
|
|
36
41
|
## License
|
@@ -1,13 +1,38 @@
|
|
1
1
|
module AppleSimUtils
|
2
2
|
class Cmd
|
3
|
-
attr_reader :path
|
3
|
+
attr_reader :path, :bundle_id
|
4
4
|
|
5
|
-
def initialize
|
5
|
+
def initialize(bundle_id: nil)
|
6
6
|
@path = get_command_path
|
7
|
+
@bundle_id = bundle_id
|
8
|
+
end
|
9
|
+
|
10
|
+
def allow_all(device:, permissions:)
|
11
|
+
raise 'You should set bundle_id' if @bundle_id.nil?
|
12
|
+
|
13
|
+
p = permissions.map {|permission| permission + '=YES'}.join(',')
|
14
|
+
run(%(--simulator '#{device}' --bundle #{@bundle_id} --setPermissions '#{p}'))
|
15
|
+
end
|
16
|
+
|
17
|
+
def deny_all(device:, permissions:)
|
18
|
+
raise 'You should set bundle_id' if @bundle_id.nil?
|
19
|
+
|
20
|
+
p = permissions.map {|permission| permission + '=NO'}.join(',')
|
21
|
+
run(%(--simulator '#{device}' --bundle #{@bundle_id} --setPermissions '#{p}'))
|
22
|
+
end
|
23
|
+
|
24
|
+
def set(device:, permission:, value:)
|
25
|
+
run(%(--simulator '#{device}' --bundle #{@bundle_id} --setPermissions '#{permission}=#{value}'))
|
26
|
+
end
|
27
|
+
|
28
|
+
def restart(device:)
|
29
|
+
run(%(--simulator '#{device}' --restartSB))
|
7
30
|
end
|
8
31
|
|
9
32
|
def run(*command)
|
33
|
+
return command.join(' ') if ENV['DRY_RUN']
|
10
34
|
cmd = ([@path] + command).join(' ')
|
35
|
+
|
11
36
|
sto, ste, status = Open3.capture3(cmd)
|
12
37
|
if status.success?
|
13
38
|
unless ste.empty?
|
@@ -26,7 +51,7 @@ module AppleSimUtils
|
|
26
51
|
def get_command_path
|
27
52
|
cmd = `which applesimutils`.strip
|
28
53
|
return cmd unless cmd.empty?
|
29
|
-
raise
|
54
|
+
raise 'You should install applesimutils. Read https://github.com/wix/AppleSimulatorUtils'
|
30
55
|
end
|
31
56
|
end
|
32
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apple_sim_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|