run_loop 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9c68f1e0cd883ed6796d16d7af7dd49f6f6e777
4
- data.tar.gz: a6f8130ab34d01005a3651a7a54beae831361348
3
+ metadata.gz: e74f558ad6dac0b1679f8d2cdd4566810aa922fd
4
+ data.tar.gz: a81469d91af4d38631e344de86e8176f85b66b06
5
5
  SHA512:
6
- metadata.gz: b7ddaa8a86996843f70b4d53a5c0b901dce4e437d1767c68a5e8ab38d5363db28a20c033c61d417ef496bf9ffabcf3a8d57baff8d3be55b131a4d2c4e15a73ce
7
- data.tar.gz: 919d5a052d4b47b72f531bc5618a77e8082ac46e4004994fe435148df84510058aae9bc0678c4aeeb4d0a18f58b6e0ba648f650b0d677e94bf8911440bba6218
6
+ metadata.gz: 512cf1830f6ee0a79e00879ad72c38c2f20563867128995652c58dc2d6f34d5200a289f5d08c148c8b16bc8f293409be0e3b3cae965601855caa481e33cd7eaa
7
+ data.tar.gz: 110fc79bc875f364d9cf3a1b020467c0649a3d39e7c4f2c701bfb0c812d352d399bc3ce3561df0a83000b941044d7bdb0e8762f9c71f2123189c40245456ae75
@@ -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
@@ -1,5 +1,5 @@
1
1
  module RunLoop
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
 
4
4
  # A model of a software release version that can be used to compare two versions.
5
5
  #
@@ -1,18 +1,31 @@
1
- function findAlertViewText(alert) {
1
+ function findAlertTitle(alert) {
2
2
  if (!alert) {
3
3
  return false;
4
4
  }
5
- var txt = alert.name(),
6
- txts;
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
- txt = txts[0].name();
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 txt;
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", /Would Like to Send You Notifications/],
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 ans, exp, txt;
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
- var exps = localizations();
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
- txt = findAlertViewText(alert);
93
- Log.output({"output":"alert: "+txt}, true);
94
- for (var i = 0; i < exps.length; i++) {
95
- ans = exps[i][0];
96
- exp = exps[i][1];
97
- if (exp.test(txt)) {
98
- return ans;
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
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-21 00:00:00.000000000 Z
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