Class: Terrestrial::Cli::Flight

Inherits:
Command
  • Object
show all
Defined in:
lib/terrestrial/cli/flight.rb,
lib/terrestrial/cli/flight/ios_workflow.rb,
lib/terrestrial/cli/flight/table_workflow.rb

Defined Under Namespace

Classes: IosWorkflow, TableWorkflow

Instance Method Summary collapse

Methods inherited from Command

#initialize, run

Constructor Details

This class inherits a constructor from Terrestrial::Cli::Command

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/terrestrial/cli/flight.rb', line 10

def run
  Config.load!
  MixpanelClient.track("cli-flight-command")

  if !Config.project_config_exist?
    abort_not_initialized
  end
  if Config[:translation_files].any?
    abort_already_run_flight
  end
  if Config[:platform] != "ios"
    puts "'flight' is not supported on Android."
    puts "  iOS projects often just include strings in their source code instead of extracting them into resource files."
    puts "  We created 'flight' to get iOS project up and running quicker."
    puts "  'R.string' makes localization much easier :)"
    abort 
  end

  puts "- Finding untranslated human readable strings..."
  TerminalUI.show_spinner do
    find_new_strings
  end

  puts "------------------------------------"
  puts "- Found #{strings.all_occurences.count} strings"
  puts ""
  exclusions = TableWorkflow.new(strings).run
  strings.exclude_occurences(exclusions)

  puts "------------------------------------"
  puts "- Done!"
  puts "- Terrestrial will add #{strings.all_occurences.count} strings to your base Localizable.strings."
  puts ""

  IosWorkflow.new(strings).run
end