terrestrial-cli 0.6.5 → 0.6.6

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: 19809fc36efca682a72fa29685608946f2497e03
4
- data.tar.gz: f61adc168c76bfd95be3dcf1af38e93e3cf35c76
3
+ metadata.gz: fc57490459267dbe6b4c2df4e559a120027a12be
4
+ data.tar.gz: d27387494081c26bea5e60c1855af88882918eff
5
5
  SHA512:
6
- metadata.gz: d1918ad3963dcd5e562326fdc9ead7252176611c2db7aa75a34e7a45510ba85c6044c0caec5787244d3d38e06ff88088dfe676b92adf648d19bac896c6dcfaae
7
- data.tar.gz: 35c563e0a6c36ac769119e5b42e16d98bf1d60255f147f75ff50e5a25b37beb7b865a336ece743e7bdad669eca1dc01af0c4bc777b972da74261ae521f299ea5
6
+ metadata.gz: 93030b56a6442be1d388838042a35cbf9cae43de63a2e8f1abbcdab21a9f4f3df24f35e7783abf6ab5850341da3a30d81fd5d31afe8954039272e78ade245c6e
7
+ data.tar.gz: c684228655afbef79bd750e03c5e810ef064935a12eb3540215b8dae1c36e59d5a88805c3e7a723f8c0393250e817c793f8cab927d886f5897a19563dbfd64a3
data/circle.yml CHANGED
@@ -4,7 +4,8 @@ machine:
4
4
 
5
5
  dependencies:
6
6
  pre:
7
- - gem update bundler
7
+ - rvm install rubygems 2.4.8 --force
8
+ - gem install bundler -v 1.11.2
8
9
 
9
10
  test:
10
11
  override:
@@ -7,9 +7,32 @@ module Terrestrial
7
7
  def run
8
8
  Config.load!
9
9
  MixpanelClient.track("cli-ignite-command")
10
- lang = opts[:language]
11
- scheme = opts[:scheme]
10
+ @lang = opts[:language]
11
+ @scheme = opts[:scheme]
12
12
 
13
+ validate_inputs!
14
+ print_progress_message
15
+
16
+ TerminalUI.show_spinner do
17
+ launcher = SimulatorLauncher.new(scheme: scheme, args: {
18
+ 'AppleLanguages' => "(#{lang})",
19
+ })
20
+
21
+ launcher.run
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def lang
28
+ @lang
29
+ end
30
+
31
+ def scheme
32
+ @scheme
33
+ end
34
+
35
+ def validate_inputs!
13
36
  if Config[:platform] != "ios"
14
37
  abort "Unfortunately launching your app in a locale via 'ignite' is only supported on iOS at this time."
15
38
  end
@@ -17,55 +40,14 @@ module Terrestrial
17
40
  if lang.nil? || lang.empty?
18
41
  abort "Please provide a locale to launch the simulator in.\n e.g. 'terrestrial ignite es'"
19
42
  end
43
+ end
20
44
 
45
+ def print_progress_message
21
46
  if scheme
22
47
  puts "Starting simulator in locale \"#{lang}\" with scheme \"#{scheme}\"..."
23
48
  else
24
49
  puts "Starting simulator in locale \"#{lang}\"..."
25
50
  end
26
-
27
- TerminalUI.show_spinner do
28
- ensure_var_folder_exists
29
-
30
- workspace = Dir["#{Config[:directory]}/*.xcworkspace"][0]
31
- project = Dir["#{Config[:directory]}/*.xcodeproj"][0]
32
-
33
- # Kill simulator and
34
- system("killall \"Simulator\" &> /dev/null")
35
- `rm -rf #{WORKING_DIR}`
36
-
37
- if workspace
38
- # If a workspace exists we want to build it instead of the project.
39
- # We assume the scheme we want to use is simply the application name
40
- app_name = File.basename(workspace).split(".").first
41
- `xcodebuild -workspace "#{workspace}" -destination 'platform=iOS Simulator,name=iPhone 6s' -scheme #{scheme || app_name} -configuration Debug clean build CONFIGURATION_BUILD_DIR=#{WORKING_DIR}`
42
- else
43
- app_name = File.basename(project).split(".").first
44
- `xcodebuild -project "#{project}" -destination 'platform=iOS Simulator,name=iPhone 6s' -scheme #{scheme || app_name} -configuration Debug clean build CONFIGURATION_BUILD_DIR=#{WORKING_DIR}`
45
- end
46
- `open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app`
47
-
48
- # Here we literally sleep until the Simulator has been booted
49
- wait_until_booted = %{
50
- count=`xcrun simctl list | grep Booted | wc -l | sed -e 's/ //g'`
51
- while [ $count -lt 1 ]
52
- do
53
- sleep 1
54
- count=`xcrun simctl list | grep Booted | wc -l | sed -e 's/ //g'`
55
- done
56
- }
57
- `#{wait_until_booted}`
58
-
59
- # Here we magically find the bundle identifier of the app
60
- command = "defaults read \"#{Dir[WORKING_DIR + '/*.app/Info.plist'].first}\" CFBundleIdentifier"
61
- bundle_name = `#{command}`.chop
62
-
63
- # Reinstall the app,
64
- # Run it with the locale we want
65
- `xcrun simctl uninstall booted #{bundle_name}`
66
- `xcrun simctl install booted "#{Dir[WORKING_DIR + "/" + app_name + ".app"].first}"`
67
- `xcrun simctl launch booted #{bundle_name} --args -AppleLanguages \\(#{lang}\\)`
68
- end
69
51
  end
70
52
 
71
53
  def ensure_var_folder_exists
@@ -8,48 +8,48 @@ module Terrestrial
8
8
  Config.load!({}, project: false)
9
9
 
10
10
  if Config.project_config_exist?
11
- abort "Looks like there already exists a project in this directory. Are you in the correct folder?"
11
+ abort 'Looks like there already exists a project in this directory. Are you in the correct folder?'
12
12
  end
13
13
 
14
14
  check_arguments
15
15
  detect_platform
16
16
 
17
- puts "-- Terrestrial Initializing"
18
- puts "Adding new app! Searching for localization files..."
17
+ puts '-- Terrestrial Initializing'
18
+ puts 'Adding new app! Searching for localization files...'
19
19
 
20
20
  TerminalUI.show_spinner do
21
21
  # Otherwise the whole process is too quick for the eye
22
22
  sleep 2 unless Config.testing?
23
23
  end
24
- puts ""
24
+ puts ''
25
25
 
26
26
  select_translation_files
27
27
  create_app_in_web
28
28
 
29
29
  if @response.success?
30
30
  update_config
31
- MixpanelClient.track("cli-init-command")
31
+ MixpanelClient.track('cli-init-command')
32
32
 
33
- puts "-- Success!"
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]}"
35
- puts ""
36
- puts "-- What to do next?"
33
+ puts '-- Success!'
34
+ puts 'App platform added to project! You can view your app at https://mission.terrestrial.io/'
35
+ puts ''
36
+ puts '-- What to do next?'
37
37
 
38
38
  if @translation_files.any?
39
- puts "Run 'terrestrial scan' to see which strings Terrestrial is currently tracking."
40
- puts "When you're ready to upload your strings for translation, run 'terrestrial push'!"
41
- elsif @translation_files.none? && @platform == "ios"
42
- puts "To get started localizing your app, run 'terrestrial flight'."
43
- puts "Terrestrial will scan your code for strings, and generate the necessary localization files."
44
- elsif @translation_files.none? && @platform == "android"
45
- puts "Looks like Terrestrial does not know which strings.xml files to track."
46
- puts "To continue, add your base language strings.xml file to terrestrial.yml."
47
- puts "When you're ready, run 'terrestrial scan' to see which strings Terrestrial is tracking, and 'terrestrial push' to upload."
39
+ puts 'Run "terrestrial scan" to see which strings Terrestrial is currently tracking.'
40
+ puts 'When you\'re ready to upload your strings for translation, run "terrestrial push"!'
41
+ elsif @translation_files.none? && @platform == 'ios'
42
+ puts 'To get started localizing your app, run "terrestrial flight".'
43
+ puts 'Terrestrial will scan your code for strings, and generate the necessary localization files.'
44
+ elsif @translation_files.none? && @platform == 'android'
45
+ puts 'Looks like Terrestrial does not know which strings.xml files to track.'
46
+ puts 'To continue, add your base language strings.xml file to terrestrial.yml.'
47
+ puts 'When you\'re ready, run "terrestrial scan" to see which strings Terrestrial is tracking, and "terrestrial push" to upload.'
48
48
  end
49
- puts ""
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."
49
+ puts ''
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.'
51
51
  else
52
- puts "Oh snap. There was an error initializing your project."
52
+ puts 'Oh snap. There was an error initializing your project.'
53
53
  puts @response.body.inspect
54
54
  abort
55
55
  end
@@ -70,16 +70,16 @@ module Terrestrial
70
70
  puts "Tracking #{@translation_files.count} files!"
71
71
  end
72
72
  else
73
- puts "Could not find any localization files to track."
73
+ puts 'Could not find any localization files to track.'
74
74
  end
75
75
  end
76
76
 
77
77
  def find_platform_translation_files
78
- if @platform == "ios"
79
- Dir[Config[:directory] + "/**/*.strings"].map {|f| relative_path(f) }
80
- elsif @platform == "android"
81
- Dir[Config[:directory] + "/**/*/res/values/strings.xml"].map {|f| relative_path(f) }
82
- elsif @platform == "unity"
78
+ if @platform == 'ios'
79
+ Dir[Config[:directory] + '/**/*.strings'].map {|f| relative_path(f) }
80
+ elsif @platform == 'android'
81
+ Dir[Config[:directory] + '/**/*/res/values/strings.xml'].map {|f| relative_path(f) }
82
+ elsif @platform == 'unity'
83
83
  [] # Not tracking files now
84
84
  else
85
85
  raise "Unknown platform #{@platform}"
@@ -88,7 +88,7 @@ module Terrestrial
88
88
 
89
89
  def update_config
90
90
  Terrestrial::Config.load({
91
- app_id: @response.body["data"]["id"],
91
+ app_id: @response.body['data']['id'],
92
92
  project_id: @project_id,
93
93
  platform: @platform,
94
94
  api_key: @api_key,
@@ -106,11 +106,11 @@ module Terrestrial
106
106
 
107
107
  def check_arguments
108
108
  @api_key = opts[:api_key] || Config[:api_key] ||
109
- abort("No api key provided. You can find your API key at https://mission.terrestrial.io/.")
109
+ abort('No api key provided. You can find your API key at https://mission.terrestrial.io/.')
110
110
 
111
111
  @project_id = opts.fetch(:project_id) { abort(
112
- "No project ID provided. Terrestrial needs to know which project this app belongs to.\n" +
113
- "Visit https://mission.terrestrial.io to find your project ID."
112
+ 'No project ID provided. Terrestrial needs to know which project this app belongs to.\n' +
113
+ 'Visit https://mission.terrestrial.io to find your project ID.'
114
114
  )}
115
115
  end
116
116
 
@@ -1,6 +1,6 @@
1
1
  module Terrestrial
2
2
  module Cli
3
- module LanguageName
3
+ class LanguageName
4
4
 
5
5
  LANGUAGES = {
6
6
  "af" => "Afrikaans",
@@ -2,66 +2,45 @@ module Terrestrial
2
2
  module Cli
3
3
  class Photoshoot < Command
4
4
 
5
- WORKING_DIR = '/usr/local/var/terrestrial'
6
-
7
5
  def run
8
6
  Config.load!
9
7
  MixpanelClient.track("cli-photoshoot-command")
10
- scheme = opts[:scheme]
8
+ @scheme = opts[:scheme]
9
+
10
+ validate_inputs!
11
+ print_progress_message
12
+
13
+ TerminalUI.show_spinner do
14
+ launcher = SimulatorLauncher.new(scheme: scheme, args: {
15
+ 'TerrestrialScreenShotMode' => true,
16
+ 'TerrestrialAPIToken' => Config[:api_key],
17
+ 'TerrestrialAppId' => Config[:app_id],
18
+ 'TerrestrialProjectId' => Config[:project_id],
19
+ 'TerrestrialURL' => Config[:api_url]
20
+ })
21
+
22
+ launcher.run
23
+ end
24
+ end
25
+
26
+ private
11
27
 
28
+ def scheme
29
+ @scheme
30
+ end
31
+
32
+ def validate_inputs!
12
33
  if Config[:platform] != "ios"
13
34
  abort "Unfortunately photoshoot mode is only supported on iOS at this time."
14
35
  end
36
+ end
15
37
 
38
+ def print_progress_message
16
39
  if scheme
17
40
  puts "Starting simulator in photoshoot mode with scheme \"#{scheme}\"..."
18
41
  else
19
42
  puts "Starting simulator in photoshoot mode..."
20
43
  end
21
- ensure_var_folder_exists
22
-
23
- workspace = Dir["#{Config[:directory]}/*.xcworkspace"][0]
24
- project = Dir["#{Config[:directory]}/*.xcodeproj"][0]
25
-
26
- # Kill simulator and
27
- system("killall \"Simulator\" &> /dev/null")
28
- `rm -rf #{WORKING_DIR}`
29
-
30
- if workspace
31
- # If a workspace exists we want to build it instead of the project.
32
- # We assume the scheme we want to use is simply the application name
33
- app_name = File.basename(workspace).split(".").first
34
- `xcodebuild -workspace "#{workspace}" -destination 'platform=iOS Simulator,name=iPhone 6s' -scheme #{scheme || app_name} -configuration Debug clean build CONFIGURATION_BUILD_DIR=#{WORKING_DIR}`
35
- else
36
- app_name = File.basename(project).split(".").first
37
- `xcodebuild -project "#{project}" -destination 'platform=iOS Simulator,name=iPhone 6s' -scheme #{scheme || app_name} -configuration Debug clean build CONFIGURATION_BUILD_DIR=#{WORKING_DIR}`
38
- end
39
- `open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app`
40
-
41
- # Here we literally sleep until the Simulator has been booted
42
- wait_until_booted = %{
43
- count=`xcrun simctl list | grep Booted | wc -l | sed -e 's/ //g'`
44
- while [ $count -lt 1 ]
45
- do
46
- sleep 1
47
- count=`xcrun simctl list | grep Booted | wc -l | sed -e 's/ //g'`
48
- done
49
- }
50
- `#{wait_until_booted}`
51
-
52
- # Here we magically find the bundle identifier of the app
53
- command = "defaults read \"#{Dir[WORKING_DIR + '/*.app/Info.plist'].first}\" CFBundleIdentifier"
54
- bundle_name = `#{command}`.chop
55
-
56
- # Reinstall the app,
57
- # Run it with the locale we want
58
- `xcrun simctl uninstall booted #{bundle_name}`
59
- `xcrun simctl install booted "#{Dir[WORKING_DIR + "/" + app_name + ".app"].first}"`
60
- `xcrun simctl launch booted #{bundle_name} --args -TerrestrialScreenShotMode YES -TerrestrialAPIToken "#{Config[:api_key]}" -TerrestrialAppId "#{Config[:app_id]}" -TerrestrialProjectId "#{Config[:project_id]}" -TerrestrialURL "#{Config[:api_url]}"`
61
- end
62
-
63
- def ensure_var_folder_exists
64
- `mkdir -p #{WORKING_DIR}`
65
44
  end
66
45
  end
67
46
  end
@@ -42,7 +42,7 @@ module Terrestrial
42
42
  elsif Config[:platform] == "android"
43
43
  android_translation_file_path(language)
44
44
  elsif Config[:platform] == "unity"
45
- Config[:directory] + "/Assets/Terrestrial/" + human_readable_language_name(language) + ".xml"
45
+ unity_translation_file_path(language)
46
46
  end
47
47
  end
48
48
 
@@ -66,6 +66,14 @@ module Terrestrial
66
66
  folder + "/strings.xml"
67
67
  end
68
68
 
69
+ def unity_translation_file_path(language)
70
+ folder = Pathname.new(Config[:directory] + "/" + Config[:translation_files].first)
71
+ .parent
72
+ .to_s
73
+
74
+ folder + "/" + human_readable_language_name(language) + ".xml"
75
+ end
76
+
69
77
  def write_translation_file(path, translations)
70
78
  File.open(path, "w+") do |f|
71
79
  if Config[:platform] == "ios"
@@ -0,0 +1,135 @@
1
+ module Terrestrial
2
+ module Cli
3
+ class SimulatorLauncher
4
+
5
+ WORKING_DIR = '/usr/local/var/terrestrial'
6
+
7
+ def initialize(args: nil, scheme: nil)
8
+ @scheme = scheme
9
+ @args = args
10
+ end
11
+
12
+ def run
13
+ cleanup_simulator
14
+ build_app
15
+ launch_simulator
16
+ wait_until_simulator_booted
17
+
18
+ reinstall_app
19
+ launch_app_with_args
20
+ end
21
+
22
+ private
23
+
24
+ def cleanup_simulator
25
+ ensure_var_folder_exists
26
+
27
+ system("killall \"Simulator\" &> /dev/null")
28
+ `rm -rf #{WORKING_DIR}`
29
+ end
30
+
31
+ def build_app
32
+ c = "xcodebuild #{is_workspace? ? '-workspace' : '-project' } \"#{project_path}\" " +
33
+ "-destination 'platform=iOS Simulator,name=iPhone 6s' " +
34
+ "-scheme #{scheme} " +
35
+ "-configuration Debug clean build CONFIGURATION_BUILD_DIR=#{WORKING_DIR}"
36
+
37
+ `#{c}`
38
+ end
39
+
40
+ def launch_simulator
41
+ `open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app`
42
+ end
43
+
44
+ def wait_until_simulator_booted
45
+ wait_until_booted = %{
46
+ count=`xcrun simctl list | grep Booted | wc -l | sed -e 's/ //g'`
47
+ while [ $count -lt 1 ]
48
+ do
49
+ sleep 1
50
+ count=`xcrun simctl list | grep Booted | wc -l | sed -e 's/ //g'`
51
+ done
52
+ }
53
+ `#{wait_until_booted}`
54
+ end
55
+
56
+ def reinstall_app
57
+ `xcrun simctl uninstall booted #{bundle_identifer}`
58
+ `xcrun simctl install booted "#{Dir[WORKING_DIR + "/" + (bundle_name) + ".app"].first}"`
59
+ end
60
+
61
+ def launch_app_with_args
62
+ c = "xcrun simctl launch booted #{bundle_identifer} --args " + LaunchArgsBuilder.build(args)
63
+
64
+ `#{c}`
65
+ end
66
+
67
+ def project_path
68
+ # Try to find a workspace, fall back to project, finally fail
69
+ @project_path ||= Dir["#{Config[:directory]}/*.xcworkspace"][0] ||
70
+ Dir["#{Config[:directory]}/*.xcodeproj"][0] ||
71
+ raise('Could not find workspace or project in folder')
72
+ end
73
+
74
+ def scheme
75
+ @scheme || app_name
76
+ end
77
+
78
+ def app_name
79
+ @app_name ||= File.basename(project_path).split(".").first
80
+ end
81
+
82
+ def args
83
+ @args ||= {}
84
+ end
85
+
86
+ def is_workspace?
87
+ project_path.end_with?('xcworkspace')
88
+ end
89
+
90
+ def ensure_var_folder_exists
91
+ `mkdir -p #{WORKING_DIR}`
92
+ end
93
+
94
+ def bundle_identifer
95
+ # Fetch the bundle identifier from the project's Info.plist folder
96
+ @bundle_identifer ||= `defaults read \"#{Dir[WORKING_DIR + '/*.app/Info.plist'].first}\" CFBundleIdentifier`.chomp
97
+ end
98
+
99
+ def bundle_name
100
+ # Fetch the bundle display name from the project's Info.plist folder
101
+ @bundle_name ||= `defaults read \"#{Dir[WORKING_DIR + '/*.app/Info.plist'].first}\" CFBundleName`.chomp
102
+ end
103
+ end
104
+ end
105
+ end
106
+
107
+ module Terrestrial
108
+ module Cli
109
+ class SimulatorLauncher
110
+ class LaunchArgsBuilder
111
+
112
+ def self.build(args)
113
+ result = []
114
+
115
+ args.each do |key, value|
116
+ result << "-#{key}"
117
+ result << build_value(value)
118
+ end
119
+
120
+ result.join(" ")
121
+ end
122
+
123
+ def self.build_value(value)
124
+ if value.class == TrueClass
125
+ 'YES'
126
+ elsif value.class == FalseClass
127
+ 'NO'
128
+ else
129
+ "\"#{value}\""
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
135
+ end
@@ -10,6 +10,7 @@ module Terrestrial
10
10
  # to be unity instead of the Android default.
11
11
  result.map do |entry|
12
12
  entry["type"] = "unity"
13
+ entry
13
14
  end
14
15
  end
15
16
  end
@@ -1,5 +1,5 @@
1
1
  module Terrestrial
2
2
  module Cli
3
- VERSION = "0.6.5"
3
+ VERSION = "0.6.6"
4
4
  end
5
5
  end
@@ -1,23 +1,57 @@
1
1
  require 'json'
2
+ require 'net/http'
3
+ require 'uri'
2
4
 
3
5
  module Terrestrial
4
6
  module Cli
5
7
  class VersionChecker
6
8
 
7
- URL = 'https://api.github.com/repos/terrestrial-io/terrestrial-cli/releases/latest'
9
+ URL = URI('https://api.github.com/repos/terrestrial-io/terrestrial-cli/releases/latest')
8
10
 
9
11
  def self.run
10
- response = Net::HTTP.get_response(URI(URL))
12
+ http = Net::HTTP.new(URL.host, URL.port)
13
+ http.read_timeout = 3
14
+ http.open_timeout = 3
15
+
16
+ response = http.start() {|client|
17
+ client.get(URL.path)
18
+ }
19
+
11
20
  json = JSON.load(response.body)
12
21
 
13
22
  # Ignore the "v" in "v1.1.1"
14
- version = json["tag_name"][1..-1]
23
+ begin
24
+ version = json["tag_name"][1..-1]
25
+ rescue NoMethodError => e
26
+ # Github ratelimiting will change the JSON response.
27
+ # Keep calm and carry on.
28
+
29
+ version = Terrestrial::Cli::VERSION
30
+ end
15
31
 
16
- if version != Terrestrial::Cli::VERSION
32
+ if higher_version?(version, Terrestrial::Cli::VERSION)
17
33
  puts "There is an update for Terrestrial: #{version} (your version: #{Terrestrial::Cli::VERSION})"
18
34
  puts "Run 'gem update terrestrial-cli' to update."
19
35
  puts ""
20
36
  end
37
+ rescue JSON::ParserError => e
38
+ # Don't worry about JSON parsing errors - just carry on
39
+ rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
40
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
41
+ # Don't worry about Net HTTP errors - just carry on
42
+ end
43
+
44
+ def self.higher_version?(v1, v2)
45
+ # Is v1 a higher semantic versioning number than v2?
46
+ v1 = v1.split('.').reject {|i| i.to_i.to_s != i }.map(&:to_i)
47
+ v2 = v2.split('.').reject {|i| i.to_i.to_s != i }.map(&:to_i)
48
+
49
+ v1.each_with_index do |e, i|
50
+ if e > v2[i]
51
+ return true
52
+ end
53
+ end
54
+ false
21
55
  end
22
56
  end
23
57
  end
@@ -5,6 +5,7 @@ require "terrestrial/cli/scan"
5
5
  require "terrestrial/cli/ignite"
6
6
  require "terrestrial/cli/push"
7
7
  require "terrestrial/cli/pull"
8
+ require "terrestrial/cli/simulator_launcher"
8
9
  require "terrestrial/cli/photoshoot"
9
10
  require "terrestrial/cli/version_checker"
10
11
  require "terrestrial/cli/version"
@@ -52,6 +52,8 @@ module Terrestrial
52
52
  request["AUTHENTICATE"] = @token
53
53
 
54
54
  Response.new(http.request(request))
55
+ rescue Errno::ECONNREFUSED, SocketError
56
+ abort 'Unable to connect to Terrestrial Mission Control. Are you connected to the internet?'
55
57
  end
56
58
 
57
59
  def get(path)
@@ -63,6 +65,8 @@ module Terrestrial
63
65
  request["AUTHENTICATE"] = @token
64
66
 
65
67
  Response.new(http.request(request))
68
+ rescue Errno::ECONNREFUSED, SocketError
69
+ abort 'Unable to connect to Terrestrial Mission Control. Are you connected to the internet?'
66
70
  end
67
71
 
68
72
  def base_url
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.5
4
+ version: 0.6.6
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-03-01 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: terminal-table
@@ -153,6 +153,7 @@ files:
153
153
  - lib/terrestrial/cli/pull/processes_translations.rb
154
154
  - lib/terrestrial/cli/push.rb
155
155
  - lib/terrestrial/cli/scan.rb
156
+ - lib/terrestrial/cli/simulator_launcher.rb
156
157
  - lib/terrestrial/cli/string_registry.rb
157
158
  - lib/terrestrial/cli/terminal_ui.rb
158
159
  - lib/terrestrial/cli/unity_formatter.rb