run_loop 2.0.4 → 2.0.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/cli.rb +4 -0
- data/lib/run_loop/cli/locale.rb +31 -0
- data/lib/run_loop/version.rb +1 -1
- data/scripts/lib/on_alert.js +56 -20
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e74f558ad6dac0b1679f8d2cdd4566810aa922fd
|
4
|
+
data.tar.gz: a81469d91af4d38631e344de86e8176f85b66b06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 512cf1830f6ee0a79e00879ad72c38c2f20563867128995652c58dc2d6f34d5200a289f5d08c148c8b16bc8f293409be0e3b3cae965601855caa481e33cd7eaa
|
7
|
+
data.tar.gz: 110fc79bc875f364d9cf3a1b020467c0649a3d39e7c4f2c701bfb0c812d352d399bc3ce3561df0a83000b941044d7bdb0e8762f9c71f2123189c40245456ae75
|
data/lib/run_loop/cli/cli.rb
CHANGED
@@ -3,6 +3,7 @@ require 'run_loop'
|
|
3
3
|
require 'run_loop/cli/errors'
|
4
4
|
require 'run_loop/cli/instruments'
|
5
5
|
require 'run_loop/cli/simctl'
|
6
|
+
require "run_loop/cli/locale"
|
6
7
|
|
7
8
|
trap 'SIGINT' do
|
8
9
|
puts 'Trapped SIGINT - exiting'
|
@@ -31,6 +32,9 @@ module RunLoop
|
|
31
32
|
desc 'simctl', "Interact with Xcode's command-line simctl"
|
32
33
|
subcommand 'simctl', RunLoop::CLI::Simctl
|
33
34
|
|
35
|
+
desc "locale", "Tools for interacting with locales"
|
36
|
+
subcommand "locale", RunLoop::CLI::Locale
|
37
|
+
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "run_loop"
|
3
|
+
require "run_loop/cli/errors"
|
4
|
+
|
5
|
+
module RunLoop
|
6
|
+
module CLI
|
7
|
+
class Locale < Thor
|
8
|
+
|
9
|
+
desc "print-alert-regexes", "Print privacy alert regular expressions"
|
10
|
+
|
11
|
+
def print_alert_regexes
|
12
|
+
dir = File.expand_path(File.dirname(__FILE__))
|
13
|
+
scripts_dir = File.join(dir, "..", "..", "..", "scripts")
|
14
|
+
on_alert = File.join(scripts_dir, "lib", "on_alert.js")
|
15
|
+
|
16
|
+
lines = []
|
17
|
+
File.read(on_alert).force_encoding("UTF-8").split($-0).each do |line|
|
18
|
+
if line[/\[\".+\", \/.+\/\]/, 0]
|
19
|
+
line.chomp!
|
20
|
+
if line[-1,1] == ","
|
21
|
+
line = line[0, line.length - 1]
|
22
|
+
end
|
23
|
+
lines << line
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
puts lines.join(",#{$-0}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/run_loop/version.rb
CHANGED
data/scripts/lib/on_alert.js
CHANGED
@@ -1,18 +1,31 @@
|
|
1
|
-
function
|
1
|
+
function findAlertTitle(alert) {
|
2
2
|
if (!alert) {
|
3
3
|
return false;
|
4
4
|
}
|
5
|
-
var
|
6
|
-
|
7
|
-
if (txt == null) {
|
8
|
-
txts = alert.staticTexts();
|
9
|
-
if (txts != null && txts.length > 0) {
|
5
|
+
var title = alert.name();
|
6
|
+
var staticTexts;
|
10
7
|
|
11
|
-
|
8
|
+
if (title == null) {
|
9
|
+
staticTexts = alert.staticTexts();
|
10
|
+
if (staticTexts != null && staticTexts.length > 0) {
|
11
|
+
|
12
|
+
title = staticText[0].name();
|
12
13
|
}
|
13
14
|
|
14
15
|
}
|
15
|
-
return
|
16
|
+
return title;
|
17
|
+
}
|
18
|
+
|
19
|
+
function findAlertButtonNames(alert) {
|
20
|
+
if (!alert) {
|
21
|
+
return false;
|
22
|
+
}
|
23
|
+
|
24
|
+
var buttons = alert.buttons();
|
25
|
+
var leftButton = buttons[0].name();
|
26
|
+
var rightButton = buttons[1].name();
|
27
|
+
|
28
|
+
return leftButton + "," + rightButton;
|
16
29
|
}
|
17
30
|
|
18
31
|
function englishLocalizations() {
|
@@ -30,8 +43,7 @@ function englishLocalizations() {
|
|
30
43
|
["OK", /Would Like to Access Your Motion & Fitness Activity/],
|
31
44
|
["OK", /Would Like Access to Twitter Accounts/],
|
32
45
|
["OK", /data available to nearby bluetooth devices/],
|
33
|
-
["OK", /
|
34
|
-
["OK", /would like to send you Push Notifications/]
|
46
|
+
["OK", /[Ww]ould [Ll]ike to [Ss]end [Yy]ou( Push)? Notifications/]
|
35
47
|
];
|
36
48
|
}
|
37
49
|
|
@@ -72,6 +84,21 @@ function russianLocalizations() {
|
|
72
84
|
];
|
73
85
|
}
|
74
86
|
|
87
|
+
function frenchLocalizations() {
|
88
|
+
return [
|
89
|
+
["OK", /vous envoyer des notifications/],
|
90
|
+
["Autoriser", /à accéder à vos données de localisation lorsque vous utilisez l’app/],
|
91
|
+
["Autoriser", /à accéder à vos données de localisation même lorsque vous n’utilisez pas l’app/],
|
92
|
+
["OK", /souhaite accéder à vos contacts/],
|
93
|
+
["OK", /souhaite accéder à votre calendrier/],
|
94
|
+
["OK", /souhaite accéder à vos rappels/],
|
95
|
+
["OK", /souhaite accéder à vos mouvements et vos activités physiques/],
|
96
|
+
["OK", /souhaite accéder à vos photos/],
|
97
|
+
["OK", /souhaite accéder à l’appareil photo/],
|
98
|
+
["OK", /souhaite accéder aux comptes Twitter/]
|
99
|
+
];
|
100
|
+
}
|
101
|
+
|
75
102
|
function localizations() {
|
76
103
|
return [].concat(
|
77
104
|
danishLocalizations(),
|
@@ -79,23 +106,32 @@ function localizations() {
|
|
79
106
|
englishLocalizations(),
|
80
107
|
germanLocalizations(),
|
81
108
|
russianLocalizations(),
|
82
|
-
spanishLocalizations()
|
109
|
+
spanishLocalizations(),
|
110
|
+
frenchLocalizations()
|
83
111
|
);
|
84
112
|
}
|
85
113
|
|
86
114
|
function isPrivacyAlert(alert) {
|
87
115
|
|
88
|
-
var
|
116
|
+
var expressions = localizations();
|
117
|
+
|
118
|
+
var title = findAlertTitle(alert);
|
119
|
+
|
120
|
+
// Comment this out if you are capturing regexes. See comment below.
|
121
|
+
Log.output({"output":"alert: " + title}, true);
|
89
122
|
|
90
|
-
|
123
|
+
// When debugging or trying to capture the regexes for a new
|
124
|
+
// localization, uncomment these lines and comment out the line above.
|
125
|
+
// var buttonNames = findAlertButtonNames(alert);
|
126
|
+
// Log.output({"output":"alert: " + title + "," + buttonNames}, true);
|
91
127
|
|
92
|
-
|
93
|
-
|
94
|
-
for (var i = 0; i <
|
95
|
-
|
96
|
-
|
97
|
-
if (
|
98
|
-
return
|
128
|
+
var answer;
|
129
|
+
var expression;
|
130
|
+
for (var i = 0; i < expressions.length; i++) {
|
131
|
+
answer = expressions[i][0];
|
132
|
+
expression = expressions[i][1];
|
133
|
+
if (expression.test(title)) {
|
134
|
+
return answer;
|
99
135
|
}
|
100
136
|
}
|
101
137
|
return false;
|
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.0.
|
4
|
+
version: 2.0.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: 2016-01-
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- lib/run_loop/cli/cli.rb
|
277
277
|
- lib/run_loop/cli/errors.rb
|
278
278
|
- lib/run_loop/cli/instruments.rb
|
279
|
+
- lib/run_loop/cli/locale.rb
|
279
280
|
- lib/run_loop/cli/simctl.rb
|
280
281
|
- lib/run_loop/core.rb
|
281
282
|
- lib/run_loop/core_simulator.rb
|