trip_advisor 0.0.15 → 0.0.21
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/Gemfile.lock +43 -36
- data/lib/trip_advisor/build.rb +2 -2
- data/lib/trip_advisor/db_access.rb +50 -0
- data/lib/trip_advisor/rake_tasks.rb +3 -3
- data/lib/trip_advisor/strings_file.rb +44 -14
- data/lib/trip_advisor/translation_tool.rb +3 -1
- data/lib/trip_advisor/version.rb +1 -1
- data/spec/api_spec.rb +1 -1
- data/spec/builder_spec.rb +2 -2
- data/spec/fixtures/project.git/Podfile +1 -1
- data/spec/fixtures/project.git/Podfile.lock +3 -3
- data/spec/fixtures/project.git/Project.podspec +1 -0
- data/spec/fixtures/project.git/TestProject.xcodeproj/project.pbxproj +512 -1020
- data/spec/fixtures/project.git/config +1 -1
- data/spec/fixtures/project.git/logs/HEAD +1 -0
- data/spec/fixtures/project.git/logs/refs/heads/master +1 -0
- data/spec/fixtures/project.git/objects/01/14a0bc247554a1d6bdd3f00c90995e5de0a4b8 +0 -0
- data/spec/fixtures/project.git/objects/2e/3b949748fe37b27dffef4ecc0a32e165f4e413 +2 -0
- data/spec/fixtures/project.git/objects/2f/e8813120b08b9cdc49a7826481cb9ed959bd70 +0 -0
- data/spec/fixtures/project.git/objects/6d/643e39051d469bb36eadca3ea54cb295dcfbb7 +0 -0
- data/spec/fixtures/project.git/objects/6f/5f6f96ccbf03123b1a2f70f92613e6c7db0b8e +3 -0
- data/spec/fixtures/project.git/objects/af/4d8a17c85da76d7895a60ac4456bb3d5ad33fd +0 -0
- data/spec/fixtures/project.git/objects/f0/61a07472760319eba39d709847e20b198baa80 +2 -0
- data/spec/fixtures/project.git/refs/heads/master +1 -1
- data/trip_advisor.gemspec +2 -2
- metadata +21 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d203e663047d513bed41c728c4bce190b68027b6
|
|
4
|
+
data.tar.gz: 532c455e70d43ddafa6bd4cdf886ab1993a0f22c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f436ed7eb98dfaced6f7ed0f722e50d2d8de56f723267f39bb8327dccba110e858d14827b18a818acf7b5d9c36e3be5ba98c9d9098fb006e38ecdb5a2aeed11a
|
|
7
|
+
data.tar.gz: ceaf49630fdd9161ab7938eb11c0216510f860003d134d14dee6f4d7746cbf03b00cdc885d630a4d4a154ed9a9b67a0fd96cb256d8a4b5f112b79a72ef3ac0f7
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
trip_advisor (0.0.
|
|
4
|
+
trip_advisor (0.0.21)
|
|
5
5
|
addressable (~> 2.3.5)
|
|
6
|
-
cocoapods (~> 0.
|
|
6
|
+
cocoapods (~> 0.38.2)
|
|
7
7
|
highline (~> 1.6.19)
|
|
8
8
|
nokogiri (~> 1.6.0)
|
|
9
9
|
oj (~> 2.1.6)
|
|
@@ -15,38 +15,41 @@ PATH
|
|
|
15
15
|
GEM
|
|
16
16
|
remote: https://rubygems.org/
|
|
17
17
|
specs:
|
|
18
|
-
activesupport (
|
|
19
|
-
i18n (~> 0.
|
|
20
|
-
|
|
18
|
+
activesupport (4.2.4)
|
|
19
|
+
i18n (~> 0.7)
|
|
20
|
+
json (~> 1.7, >= 1.7.7)
|
|
21
|
+
minitest (~> 5.1)
|
|
22
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
23
|
+
tzinfo (~> 1.1)
|
|
21
24
|
addressable (2.3.6)
|
|
22
|
-
claide (0.
|
|
23
|
-
cocoapods (0.
|
|
24
|
-
activesupport (>= 3.2.15
|
|
25
|
-
claide (~> 0.
|
|
26
|
-
cocoapods-core (= 0.
|
|
27
|
-
cocoapods-downloader (~> 0.
|
|
28
|
-
cocoapods-plugins (~> 0.
|
|
29
|
-
cocoapods-
|
|
30
|
-
cocoapods-
|
|
25
|
+
claide (0.9.1)
|
|
26
|
+
cocoapods (0.38.2)
|
|
27
|
+
activesupport (>= 3.2.15)
|
|
28
|
+
claide (~> 0.9.1)
|
|
29
|
+
cocoapods-core (= 0.38.2)
|
|
30
|
+
cocoapods-downloader (~> 0.9.1)
|
|
31
|
+
cocoapods-plugins (~> 0.4.2)
|
|
32
|
+
cocoapods-stats (~> 0.5.3)
|
|
33
|
+
cocoapods-trunk (~> 0.6.1)
|
|
34
|
+
cocoapods-try (~> 0.4.5)
|
|
31
35
|
colored (~> 1.2)
|
|
32
36
|
escape (~> 0.0.4)
|
|
33
|
-
|
|
37
|
+
molinillo (~> 0.3.1)
|
|
34
38
|
nap (~> 0.8)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
cocoapods-core (0.34.4)
|
|
39
|
+
xcodeproj (~> 0.26.3)
|
|
40
|
+
cocoapods-core (0.38.2)
|
|
38
41
|
activesupport (>= 3.2.15)
|
|
39
42
|
fuzzy_match (~> 2.0.4)
|
|
40
|
-
json_pure (~> 1.8)
|
|
41
43
|
nap (~> 0.8.0)
|
|
42
|
-
cocoapods-downloader (0.
|
|
43
|
-
cocoapods-plugins (0.
|
|
44
|
+
cocoapods-downloader (0.9.3)
|
|
45
|
+
cocoapods-plugins (0.4.2)
|
|
44
46
|
nap
|
|
45
|
-
cocoapods-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
cocoapods-stats (0.5.3)
|
|
48
|
+
nap (~> 0.8)
|
|
49
|
+
cocoapods-trunk (0.6.4)
|
|
50
|
+
nap (>= 0.8, < 2.0)
|
|
48
51
|
netrc (= 0.7.8)
|
|
49
|
-
cocoapods-try (0.4.
|
|
52
|
+
cocoapods-try (0.4.5)
|
|
50
53
|
colored (1.2)
|
|
51
54
|
crack (0.4.2)
|
|
52
55
|
safe_yaml (~> 1.0.0)
|
|
@@ -56,23 +59,20 @@ GEM
|
|
|
56
59
|
fuzzy_match (2.0.4)
|
|
57
60
|
highline (1.6.21)
|
|
58
61
|
i18n (0.7.0)
|
|
59
|
-
json (1.8.
|
|
60
|
-
json_pure (1.8.2)
|
|
62
|
+
json (1.8.3)
|
|
61
63
|
mime-types (1.25.1)
|
|
62
64
|
mini_portile (0.6.2)
|
|
65
|
+
minitest (5.8.0)
|
|
66
|
+
molinillo (0.3.1)
|
|
63
67
|
multi_json (1.10.1)
|
|
64
68
|
nap (0.8.0)
|
|
65
69
|
netrc (0.7.8)
|
|
66
70
|
nokogiri (1.6.6.2)
|
|
67
71
|
mini_portile (~> 0.6.0)
|
|
68
72
|
oj (2.1.7)
|
|
69
|
-
open4 (1.3.4)
|
|
70
73
|
rake (10.4.2)
|
|
71
|
-
|
|
72
|
-
json (~> 1.4)
|
|
73
|
-
rest-client (1.6.8)
|
|
74
|
+
rest-client (1.6.9)
|
|
74
75
|
mime-types (~> 1.16)
|
|
75
|
-
rdoc (>= 2.4.2)
|
|
76
76
|
rspec (2.14.1)
|
|
77
77
|
rspec-core (~> 2.14.0)
|
|
78
78
|
rspec-expectations (~> 2.14.0)
|
|
@@ -91,24 +91,28 @@ GEM
|
|
|
91
91
|
multi_json (~> 1.0)
|
|
92
92
|
simplecov-html (~> 0.7.1)
|
|
93
93
|
simplecov-html (0.7.1)
|
|
94
|
+
thread_safe (0.3.5)
|
|
94
95
|
tomdoc (0.2.5)
|
|
95
96
|
colored
|
|
96
97
|
ruby_parser (>= 2.0.4)
|
|
97
98
|
twine (0.4.0)
|
|
98
99
|
rubyzip (~> 0.9.5)
|
|
100
|
+
tzinfo (1.2.2)
|
|
101
|
+
thread_safe (~> 0.1)
|
|
99
102
|
webmock (1.13.0)
|
|
100
103
|
addressable (>= 2.2.7)
|
|
101
104
|
crack (>= 0.3.2)
|
|
102
|
-
xcodeproj (0.
|
|
103
|
-
activesupport (
|
|
105
|
+
xcodeproj (0.26.3)
|
|
106
|
+
activesupport (>= 3)
|
|
107
|
+
claide (~> 0.9.1)
|
|
104
108
|
colored (~> 1.2)
|
|
105
|
-
xcpretty (0.1.
|
|
109
|
+
xcpretty (0.1.12)
|
|
106
110
|
|
|
107
111
|
PLATFORMS
|
|
108
112
|
ruby
|
|
109
113
|
|
|
110
114
|
DEPENDENCIES
|
|
111
|
-
bundler (~> 1.
|
|
115
|
+
bundler (~> 1.10.6)
|
|
112
116
|
excon (~> 0.26.0)
|
|
113
117
|
rake
|
|
114
118
|
rspec (~> 2.14.0)
|
|
@@ -116,3 +120,6 @@ DEPENDENCIES
|
|
|
116
120
|
tomdoc (~> 0.2.5)
|
|
117
121
|
trip_advisor!
|
|
118
122
|
webmock (~> 1.13.0)
|
|
123
|
+
|
|
124
|
+
BUNDLED WITH
|
|
125
|
+
1.10.6
|
data/lib/trip_advisor/build.rb
CHANGED
|
@@ -51,7 +51,7 @@ module TripAdvisor
|
|
|
51
51
|
@path = path
|
|
52
52
|
@repo = Rugged::Repository.new(path)
|
|
53
53
|
@info = BuildInfo.new(repo)
|
|
54
|
-
@pod_repo =
|
|
54
|
+
@pod_repo = 'tripadvisor-mobile-ta-specs'
|
|
55
55
|
@reporter = ConsoleReporter.new
|
|
56
56
|
@version_prefix = 'v'
|
|
57
57
|
end
|
|
@@ -140,7 +140,7 @@ module TripAdvisor
|
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
def push_podspec!
|
|
143
|
-
run("bundle exec pod repo push #{pod_repo} #{podspec_file}")
|
|
143
|
+
run("bundle exec pod repo push --use-libraries --allow-warnings #{pod_repo} #{podspec_file}")
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
def update_staging_area(files)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'pg'
|
|
2
|
+
|
|
3
|
+
module TripAdvisor
|
|
4
|
+
class TranslationDBAccess
|
|
5
|
+
|
|
6
|
+
# Create the connection instance.
|
|
7
|
+
def connect
|
|
8
|
+
@conn = PG.connect(
|
|
9
|
+
:host => 'rivendell.tripadvisor.com',
|
|
10
|
+
:dbname => 'tripmaster',
|
|
11
|
+
:user => 'tripmaster_ro')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Disconnect the back-end connection.
|
|
15
|
+
def disconnect
|
|
16
|
+
@conn.close
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Get translations for keys in array
|
|
20
|
+
def getTranslations(key_names)
|
|
21
|
+
queryString = "SELECT v.locale, k.name, v.value, k.status, k.note
|
|
22
|
+
FROM t_translationkeys k
|
|
23
|
+
INNER JOIN t_translationvalues v ON (k.id = v.translationid)
|
|
24
|
+
WHERE k.name IN ('#{key_names.join("', '")}')
|
|
25
|
+
ORDER BY v.locale DESC;"
|
|
26
|
+
|
|
27
|
+
@conn.exec(queryString) do |result|
|
|
28
|
+
result.each do |row|
|
|
29
|
+
yield row if block_given?
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Get translation for a single key
|
|
35
|
+
def getTranslation(key_name)
|
|
36
|
+
queryString = "SELECT v.locale, k.name, v.value, k.status, k.note
|
|
37
|
+
FROM t_translationkeys k
|
|
38
|
+
INNER JOIN t_translationvalues v ON (k.id = v.translationid)
|
|
39
|
+
WHERE k.name = '#{key_name}'
|
|
40
|
+
ORDER BY v.locale DESC;"
|
|
41
|
+
|
|
42
|
+
@conn.exec(queryString) do |result|
|
|
43
|
+
result.each do |row|
|
|
44
|
+
yield row if block_given?
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -7,7 +7,7 @@ module TripAdvisor
|
|
|
7
7
|
|
|
8
8
|
def initialize
|
|
9
9
|
@platform = 'iOS Simulator'
|
|
10
|
-
@name = 'iPhone
|
|
10
|
+
@name = 'iPhone 6'
|
|
11
11
|
@valid_schemes = []
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -91,8 +91,8 @@ module TripAdvisor
|
|
|
91
91
|
@namespace_name = namespace_name.is_a?(Hash) ? namespace_name.keys.first : namespace_name
|
|
92
92
|
@prepare_dependency = namespace_name.is_a?(Hash) ? namespace_name.values.first : nil
|
|
93
93
|
@schemes_dir = 'Tests/Schemes'
|
|
94
|
-
@ios_versions = %w{
|
|
95
|
-
@xctool_path = '
|
|
94
|
+
@ios_versions = %w{8.4 9.0}
|
|
95
|
+
@xctool_path = 'xctool'
|
|
96
96
|
@xcodebuild_path = 'xcodebuild'
|
|
97
97
|
@runner = :xctool
|
|
98
98
|
@settings = {}
|
|
@@ -4,11 +4,11 @@ require 'twine/stringsfile'
|
|
|
4
4
|
module TripAdvisor
|
|
5
5
|
class StringsFile
|
|
6
6
|
attr_reader :path, :translations
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
def self.read(path)
|
|
9
9
|
self.new.tap { |sf| sf.read(path) }
|
|
10
10
|
end
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
def merge_translations(translations)
|
|
13
13
|
translations.each do |translation|
|
|
14
14
|
if twine_row = twine_row_for_key(translation['en'].to_s)
|
|
@@ -18,7 +18,17 @@ module TripAdvisor
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
def merge_translations_by_key(translations)
|
|
23
|
+
translations.each do |translation|
|
|
24
|
+
if twine_row = twine_row_for_key(translation.key)
|
|
25
|
+
update_twine_row_with_translation(twine_row, translation)
|
|
26
|
+
else
|
|
27
|
+
add_twine_row_for_translation_key(translation)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
22
32
|
def merge_translations_android(translations)
|
|
23
33
|
translations.each do |translation|
|
|
24
34
|
if twine_row = twine_row_for_key(translation.key)
|
|
@@ -28,31 +38,39 @@ module TripAdvisor
|
|
|
28
38
|
end
|
|
29
39
|
end
|
|
30
40
|
end
|
|
31
|
-
|
|
41
|
+
|
|
32
42
|
def loaded?
|
|
33
43
|
@twine_strings_file != nil
|
|
34
44
|
end
|
|
35
|
-
|
|
45
|
+
|
|
36
46
|
def [](key)
|
|
37
47
|
raise "Cannot access translations without reading a Strings file" unless loaded?
|
|
38
48
|
translations.detect { |translation| translation.key == key.to_s }
|
|
39
49
|
end
|
|
40
|
-
|
|
50
|
+
|
|
41
51
|
def read(path)
|
|
42
52
|
@path = path
|
|
43
53
|
@twine_strings_file = Twine::StringsFile.new
|
|
44
54
|
@twine_strings_file.read(path)
|
|
45
55
|
load_translations_from_twine
|
|
46
56
|
end
|
|
47
|
-
|
|
57
|
+
|
|
48
58
|
def write(path = self.path)
|
|
49
59
|
@twine_strings_file.write(path)
|
|
50
60
|
end
|
|
51
|
-
|
|
61
|
+
|
|
52
62
|
def language_tags
|
|
53
63
|
@twine_strings_file.language_codes
|
|
54
64
|
end
|
|
55
65
|
|
|
66
|
+
def keys
|
|
67
|
+
@twine_strings_file.sections.map do |section|
|
|
68
|
+
section.rows.map do |row|
|
|
69
|
+
row.key
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
56
74
|
private
|
|
57
75
|
def load_translations_from_twine
|
|
58
76
|
@translations = @twine_strings_file.sections.collect do |section|
|
|
@@ -65,26 +83,26 @@ module TripAdvisor
|
|
|
65
83
|
end
|
|
66
84
|
end.flatten
|
|
67
85
|
end
|
|
68
|
-
|
|
86
|
+
|
|
69
87
|
# NOTE: For Android, the Twine files are keyed by Translation Tool key, _not_ English translation.
|
|
70
88
|
# NOTE: The Twine files are keyed by English translation, _not_ Translation Tool key
|
|
71
89
|
def twine_row_for_key(key)
|
|
72
|
-
@twine_strings_file.sections.each do |section|
|
|
90
|
+
@twine_strings_file.sections.each do |section|
|
|
73
91
|
if row = section.rows.detect { |row| row.key == key }
|
|
74
92
|
return row
|
|
75
93
|
end
|
|
76
94
|
end
|
|
77
95
|
nil
|
|
78
96
|
end
|
|
79
|
-
|
|
97
|
+
|
|
80
98
|
def update_twine_row_with_translation(twine_row, translation)
|
|
81
99
|
twine_row.comment = translation.note
|
|
82
|
-
translation.localizations.each do |localization|
|
|
100
|
+
translation.localizations.each do |localization|
|
|
83
101
|
@twine_strings_file.add_language_code(localization.locale_identifier)
|
|
84
102
|
twine_row.translations[localization.locale_identifier] = localization.string
|
|
85
103
|
end
|
|
86
104
|
end
|
|
87
|
-
|
|
105
|
+
|
|
88
106
|
def add_twine_row_for_translation(translation)
|
|
89
107
|
# We merge new rows into the first section
|
|
90
108
|
section = @twine_strings_file.sections.first
|
|
@@ -96,7 +114,19 @@ module TripAdvisor
|
|
|
96
114
|
end
|
|
97
115
|
section.rows << row
|
|
98
116
|
end
|
|
99
|
-
|
|
117
|
+
|
|
118
|
+
def add_twine_row_for_translation_key(translation)
|
|
119
|
+
# We merge new rows into the first section
|
|
120
|
+
section = @twine_strings_file.sections.first
|
|
121
|
+
translation_tool_key = translation.key
|
|
122
|
+
raise "Cannot add Translation: No translation tool key." unless translation_tool_key
|
|
123
|
+
row = Twine::StringsRow.new(translation_tool_key).tap do |row|
|
|
124
|
+
row.tags = ["key:#{translation.key}"]
|
|
125
|
+
update_twine_row_with_translation(row, translation)
|
|
126
|
+
end
|
|
127
|
+
section.rows << row
|
|
128
|
+
end
|
|
129
|
+
|
|
100
130
|
def add_twine_row_for_translation_android(translation)
|
|
101
131
|
# We merge new rows into the first section
|
|
102
132
|
section = @twine_strings_file.sections.first
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
require 'trip_advisor/translation'
|
|
2
2
|
require 'rest-client'
|
|
3
3
|
require 'nokogiri'
|
|
4
|
+
require 'active_support'
|
|
4
5
|
require "active_support/core_ext"
|
|
6
|
+
require 'cgi'
|
|
5
7
|
|
|
6
8
|
module TripAdvisor
|
|
7
9
|
class TranslationTool
|
|
@@ -86,7 +88,7 @@ module TripAdvisor
|
|
|
86
88
|
attr_accessor :username, :password, :locale
|
|
87
89
|
|
|
88
90
|
def initialize(attributes = {})
|
|
89
|
-
attributes.each { |k, v| self.send("#{k}=", v) }
|
|
91
|
+
attributes.each { |k, v| self.send("#{k}=", CGI.escape(v)) }
|
|
90
92
|
@locale ||= 'en'
|
|
91
93
|
end
|
|
92
94
|
|
data/lib/trip_advisor/version.rb
CHANGED
data/spec/api_spec.rb
CHANGED
data/spec/builder_spec.rb
CHANGED
|
@@ -121,7 +121,7 @@ describe TripAdvisor::AdHocBuild do
|
|
|
121
121
|
|
|
122
122
|
it "has a proper default for pod_repo" do
|
|
123
123
|
build = TripAdvisor::AdHocBuild.new(@project_dir)
|
|
124
|
-
build.pod_repo.should == 'tripadvisor'
|
|
124
|
+
build.pod_repo.should == 'tripadvisor-mobile-ta-specs'
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
it "has a proper default for version_prefix" do
|
|
@@ -206,7 +206,7 @@ describe TripAdvisor::AdHocBuild do
|
|
|
206
206
|
|
|
207
207
|
it "has a proper default for pod_repo" do
|
|
208
208
|
build = TripAdvisor::ReleaseBuild.new(@project_dir, "1.0.1")
|
|
209
|
-
build.pod_repo.should == 'tripadvisor'
|
|
209
|
+
build.pod_repo.should == 'tripadvisor-mobile-ta-specs'
|
|
210
210
|
end
|
|
211
211
|
|
|
212
212
|
it "has a proper default for version_prefix" do
|