terrestrial-cli 0.6.0 → 0.6.1.debug
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/terrestrial +3 -0
- data/lib/terrestrial/cli/detects_project_type.rb +2 -0
- data/lib/terrestrial/cli/editor/storyboard.rb +6 -0
- data/lib/terrestrial/cli/init.rb +5 -2
- data/lib/terrestrial/cli/language_name.rb +64 -0
- data/lib/terrestrial/cli/mixpanel_client.rb +1 -2
- data/lib/terrestrial/cli/pull/processes_translations.rb +6 -0
- data/lib/terrestrial/cli/pull.rb +9 -0
- data/lib/terrestrial/cli/string_registry.rb +2 -0
- data/lib/terrestrial/cli/unity_formatter.rb +20 -0
- data/lib/terrestrial/cli/unity_parser.rb +17 -0
- data/lib/terrestrial/cli/version.rb +1 -1
- data/lib/terrestrial/cli/version_checker.rb +25 -0
- data/lib/terrestrial/cli.rb +4 -0
- data/lib/terrestrial/config.rb +6 -0
- data/lib/terrestrial/yaml_helper.rb +7 -1
- metadata +8 -5
- data/lib/terrestrial/creates_terrestrial_yml.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33b4a8914ad9b9274894f60f7e49908aa2098707
|
4
|
+
data.tar.gz: 8a0c5b41b0f425bd502b1c4b157362381eef2ad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5859c78be839d1c040fb290afb7932ba8fe330dfb8303c5df9049016a542e10dcf75d809d9cc812cc07d3d42ae1586e6e69513cd36e9ae5481941ef0c9d7790
|
7
|
+
data.tar.gz: c04ebd295a7243a8ea61330ffaa27d4d2167ee6a0e3bea354045a20ca011de17e902113ac5ffc7b81e459bb49e1e2f636c71ac3580d67e7e054c00c262501464
|
data/bin/terrestrial
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'terrestrial'
|
4
4
|
require 'optparse'
|
5
5
|
|
6
|
+
puts "DEBUG: This is a debug version of Terrestrial."
|
7
|
+
|
6
8
|
command = ARGV[0]
|
7
9
|
options = {}
|
8
10
|
|
@@ -41,4 +43,5 @@ end.parse!
|
|
41
43
|
abort "Terrestrial CLI #{Terrestrial::Cli::VERSION}" if command.nil?
|
42
44
|
abort "Terrestrial: '#{command}' does not compute?" unless Terrestrial::Cli::COMMANDS.include? command
|
43
45
|
|
46
|
+
Terrestrial::Cli::VersionChecker.run
|
44
47
|
Terrestrial::Cli.start(command, options, ARGV[1..-1])
|
@@ -37,8 +37,14 @@ module Terrestrial
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def insert_attribute
|
40
|
+
puts "DEBUG: Finding node #{@storyboard_id} in file #{@path}"
|
40
41
|
node = find_node
|
41
42
|
|
43
|
+
if node.nil?
|
44
|
+
puts "DEBUG: Was not able to find node!"
|
45
|
+
abort "Node was not found."
|
46
|
+
end
|
47
|
+
|
42
48
|
# TODO, There was a case when "node" was nil in this point, after
|
43
49
|
# trying to find it by type + ID.
|
44
50
|
#
|
data/lib/terrestrial/cli/init.rb
CHANGED
@@ -4,8 +4,8 @@ module Terrestrial
|
|
4
4
|
|
5
5
|
def run
|
6
6
|
# Fail early if project already exists
|
7
|
+
Config.touch_global_config!
|
7
8
|
Config.load!({}, project: false)
|
8
|
-
MixpanelClient.track("cli-init-command")
|
9
9
|
|
10
10
|
if Config.project_config_exist?
|
11
11
|
abort "Looks like there already exists a project in this directory. Are you in the correct folder?"
|
@@ -28,6 +28,7 @@ module Terrestrial
|
|
28
28
|
|
29
29
|
if @response.success?
|
30
30
|
update_config
|
31
|
+
MixpanelClient.track("cli-init-command")
|
31
32
|
|
32
33
|
puts "-- Success!"
|
33
34
|
puts "App platform added to project! You can view your app at https://mission.terrestrial.io/projects/#{Config[:project_id]}/apps/#{Config[:app_id]}"
|
@@ -49,7 +50,7 @@ module Terrestrial
|
|
49
50
|
puts "For more information, see http://docs.terrestrial.io or jump on Slack at https://terrestrial-slack.herokuapp.com/ if you have any questions."
|
50
51
|
else
|
51
52
|
puts "Oh snap. There was an error initializing your project."
|
52
|
-
puts response.body.inspect
|
53
|
+
puts @response.body.inspect
|
53
54
|
abort
|
54
55
|
end
|
55
56
|
end
|
@@ -78,6 +79,8 @@ module Terrestrial
|
|
78
79
|
Dir[Config[:directory] + "/**/*.strings"].map {|f| relative_path(f) }
|
79
80
|
elsif @platform == "android"
|
80
81
|
Dir[Config[:directory] + "/**/*/res/values/strings.xml"].map {|f| relative_path(f) }
|
82
|
+
elsif @platform == "unity"
|
83
|
+
[] # Not tracking files now
|
81
84
|
else
|
82
85
|
raise "Unknown platform #{@platform}"
|
83
86
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Terrestrial
|
2
|
+
module Cli
|
3
|
+
module LanguageName
|
4
|
+
|
5
|
+
LANGUAGES = {
|
6
|
+
"af" => "Afrikaans",
|
7
|
+
"ar" => "Arabic",
|
8
|
+
"eu" => "Basque",
|
9
|
+
"be" => "Belarusian",
|
10
|
+
"bg" => "Bulgarian",
|
11
|
+
"ca" => "Catalan",
|
12
|
+
"cs" => "Czech",
|
13
|
+
"da" => "Danish",
|
14
|
+
"nl" => "Dutch",
|
15
|
+
"en" => "English",
|
16
|
+
"et" => "Estonian",
|
17
|
+
"fo" => "Faroese",
|
18
|
+
"fi" => "Finnish",
|
19
|
+
"fr" => "French",
|
20
|
+
"de" => "German",
|
21
|
+
"el" => "Greek",
|
22
|
+
"he" => "Hebrew",
|
23
|
+
"is" => "Icelandic",
|
24
|
+
"id" => "Indonesian",
|
25
|
+
"it" => "Italian",
|
26
|
+
"ja" => "Japanese",
|
27
|
+
"ko" => "Korean",
|
28
|
+
"lv" => "Latvian",
|
29
|
+
"lt" => "Lithuanian",
|
30
|
+
"no" => "Norwegian",
|
31
|
+
"pl" => "Polish",
|
32
|
+
"pt" => "Portuguese",
|
33
|
+
"ro" => "Romanian",
|
34
|
+
"ru" => "Russian",
|
35
|
+
"sr" => "SerboCroatian",
|
36
|
+
"sk" => "Slovak",
|
37
|
+
"sl" => "Slovenian",
|
38
|
+
"es" => "Spanish",
|
39
|
+
"sv" => "Swedish",
|
40
|
+
"th" => "Thai",
|
41
|
+
"tr" => "Turkish",
|
42
|
+
"uk" => "Ukrainian",
|
43
|
+
"vi" => "Vietnamese",
|
44
|
+
"zh" => "ChineseSimplified",
|
45
|
+
"zh-tw" => "ChineseTraditional",
|
46
|
+
"hu" => "Hungarian"
|
47
|
+
}
|
48
|
+
|
49
|
+
def initialize(language_code)
|
50
|
+
@code = language_code
|
51
|
+
end
|
52
|
+
|
53
|
+
def human_readable_name
|
54
|
+
LANGUAGES.fetch(code) { abort "Unkown language '#{code}' encountered." }
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def code
|
60
|
+
@code
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -10,8 +10,7 @@ module Terrestrial
|
|
10
10
|
URL = "https://api.mixpanel.com/track"
|
11
11
|
|
12
12
|
def track(event)
|
13
|
-
|
14
|
-
if Config[:api_url] == "https://mission.terrestrial.io"
|
13
|
+
unless Config.testing?
|
15
14
|
`curl -silent -X POST #{URL}?data=#{format_event(event)} &`
|
16
15
|
end
|
17
16
|
end
|
@@ -18,11 +18,17 @@ module Terrestrial
|
|
18
18
|
process_ios
|
19
19
|
when "android"
|
20
20
|
process_android
|
21
|
+
when "unity"
|
22
|
+
process_unity
|
21
23
|
else
|
22
24
|
raise "Unknown platform"
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
28
|
+
def process_unity
|
29
|
+
process_android
|
30
|
+
end
|
31
|
+
|
26
32
|
def process_android
|
27
33
|
translations
|
28
34
|
.reject {|entry| entry["translation"].nil? || entry["translation"].empty? }
|
data/lib/terrestrial/cli/pull.rb
CHANGED
@@ -41,6 +41,8 @@ module Terrestrial
|
|
41
41
|
ios_translation_file_path(language)
|
42
42
|
elsif Config[:platform] == "android"
|
43
43
|
android_translation_file_path(language)
|
44
|
+
elsif Config[:platform] == "unity"
|
45
|
+
Config[:directory] + "/Assets/Terrestrial/" + human_readable_language_name(language) + ".xml"
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
@@ -72,6 +74,9 @@ module Terrestrial
|
|
72
74
|
elsif Config[:platform] == "android"
|
73
75
|
f.write "<!-- Updated by Terrestrial #{Time.now.to_s} -->\n\n"
|
74
76
|
f.write AndroidXmlFormatter.new(translations).format_foreign_translation
|
77
|
+
elsif Config[:platform] == "unity"
|
78
|
+
f.write "<!-- Updated by Terrestrial #{Time.now.to_s} -->\n\n"
|
79
|
+
f.write UnityFormatter.new(translations).format_foreign_translation
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
@@ -86,6 +91,10 @@ module Terrestrial
|
|
86
91
|
end
|
87
92
|
end
|
88
93
|
|
94
|
+
def human_readable_language_name(language_code)
|
95
|
+
LanguageName.new(language_code).human_readable_name
|
96
|
+
end
|
97
|
+
|
89
98
|
def fetch_translations
|
90
99
|
@response = web_client.get_translations(Config[:project_id], Config[:app_id])
|
91
100
|
end
|
@@ -9,6 +9,8 @@ module Terrestrial
|
|
9
9
|
DotStringsParser.parse_file(Config[:directory] + "/#{file}")
|
10
10
|
elsif Config[:platform] == "android"
|
11
11
|
AndroidXmlParser.parse_file(Config[:directory] + "/#{file}")
|
12
|
+
elsif Config[:platform] == "unity"
|
13
|
+
UnityParser.parse_file(Config[:directory] + "/#{file}")
|
12
14
|
end
|
13
15
|
rescue Errno::ENOENT
|
14
16
|
abort "Could not find #{file}. If the file is no longer in your project, remove it from your tracked files in terrestrial.yml."
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Terrestrial
|
2
|
+
module Cli
|
3
|
+
class UnityFormatter
|
4
|
+
|
5
|
+
def initialize(entries)
|
6
|
+
@formatter = AndroidXmlFormatter.new(entries)
|
7
|
+
end
|
8
|
+
|
9
|
+
def format_foreign_translation
|
10
|
+
formatter.format_foreign_translation
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def formatter
|
16
|
+
@formatter
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Terrestrial
|
2
|
+
module Cli
|
3
|
+
class UnityParser
|
4
|
+
|
5
|
+
def self.parse_file(file)
|
6
|
+
# Same file format as Android, so we delegate directly.
|
7
|
+
result = AndroidXmlParser.parse_file(file)
|
8
|
+
|
9
|
+
# Map over the results to change the types
|
10
|
+
# to be unity instead of the Android default.
|
11
|
+
result.map do |entry|
|
12
|
+
entry["type"] = "unity"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Terrestrial
|
4
|
+
module Cli
|
5
|
+
class VersionChecker
|
6
|
+
|
7
|
+
URL = 'https://api.github.com/repos/terrestrial-io/terrestrial-cli/releases/latest'
|
8
|
+
|
9
|
+
def self.run
|
10
|
+
response = Net::HTTP.get_response(URI(URL))
|
11
|
+
json = JSON.load(response.body)
|
12
|
+
|
13
|
+
# Ignore the "v" in "v1.1.1"
|
14
|
+
version = json["tag_name"][1..-1]
|
15
|
+
|
16
|
+
if version != Terrestrial::Cli::VERSION
|
17
|
+
puts "There is an update for Terrestrial: #{version} (your version: #{Terrestrial::Cli::VERSION})"
|
18
|
+
puts "Run 'gem update terrestrial-cli' to update."
|
19
|
+
puts ""
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/lib/terrestrial/cli.rb
CHANGED
@@ -6,9 +6,11 @@ require "terrestrial/cli/ignite"
|
|
6
6
|
require "terrestrial/cli/push"
|
7
7
|
require "terrestrial/cli/pull"
|
8
8
|
require "terrestrial/cli/photoshoot"
|
9
|
+
require "terrestrial/cli/version_checker"
|
9
10
|
require "terrestrial/cli/version"
|
10
11
|
require "terrestrial/cli/variable_normalizer"
|
11
12
|
require "terrestrial/cli/terminal_ui"
|
13
|
+
require "terrestrial/cli/language_name"
|
12
14
|
require "terrestrial/cli/entry_collection_differ"
|
13
15
|
require "terrestrial/cli/detects_project_type"
|
14
16
|
require "terrestrial/cli/file_picker"
|
@@ -19,6 +21,8 @@ require "terrestrial/cli/android_xml_parser"
|
|
19
21
|
require "terrestrial/cli/android_xml_formatter"
|
20
22
|
require "terrestrial/cli/dot_strings_parser"
|
21
23
|
require "terrestrial/cli/dot_strings_formatter"
|
24
|
+
require "terrestrial/cli/unity_parser"
|
25
|
+
require "terrestrial/cli/unity_formatter"
|
22
26
|
require "terrestrial/cli/parser"
|
23
27
|
require "terrestrial/cli/editor"
|
24
28
|
require "terrestrial/cli/engine_mapper"
|
data/lib/terrestrial/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module Terrestrial
|
2
4
|
module Config
|
3
5
|
class << self
|
@@ -57,6 +59,10 @@ module Terrestrial
|
|
57
59
|
self[:api_url] != DEFAULTS[:api_url]
|
58
60
|
end
|
59
61
|
|
62
|
+
def touch_global_config!
|
63
|
+
FileUtils.touch(_global_config_path)
|
64
|
+
end
|
65
|
+
|
60
66
|
private
|
61
67
|
|
62
68
|
def _load_project_config
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terrestrial-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1.debug
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niklas Begley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: terminal-table
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/terrestrial/cli/flight/table_workflow.rb
|
140
140
|
- lib/terrestrial/cli/ignite.rb
|
141
141
|
- lib/terrestrial/cli/init.rb
|
142
|
+
- lib/terrestrial/cli/language_name.rb
|
142
143
|
- lib/terrestrial/cli/mixpanel_client.rb
|
143
144
|
- lib/terrestrial/cli/parser.rb
|
144
145
|
- lib/terrestrial/cli/parser/android_xml.rb
|
@@ -154,10 +155,12 @@ files:
|
|
154
155
|
- lib/terrestrial/cli/scan.rb
|
155
156
|
- lib/terrestrial/cli/string_registry.rb
|
156
157
|
- lib/terrestrial/cli/terminal_ui.rb
|
158
|
+
- lib/terrestrial/cli/unity_formatter.rb
|
159
|
+
- lib/terrestrial/cli/unity_parser.rb
|
157
160
|
- lib/terrestrial/cli/variable_normalizer.rb
|
158
161
|
- lib/terrestrial/cli/version.rb
|
162
|
+
- lib/terrestrial/cli/version_checker.rb
|
159
163
|
- lib/terrestrial/config.rb
|
160
|
-
- lib/terrestrial/creates_terrestrial_yml.rb
|
161
164
|
- lib/terrestrial/web.rb
|
162
165
|
- lib/terrestrial/web/response.rb
|
163
166
|
- lib/terrestrial/yaml_helper.rb
|
@@ -177,9 +180,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
180
|
version: '0'
|
178
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
182
|
requirements:
|
180
|
-
- - '
|
183
|
+
- - '>'
|
181
184
|
- !ruby/object:Gem::Version
|
182
|
-
version:
|
185
|
+
version: 1.3.1
|
183
186
|
requirements: []
|
184
187
|
rubyforge_project:
|
185
188
|
rubygems_version: 2.4.8
|