Class: Terrestrial::Cli::Init
- Defined in:
- lib/terrestrial/cli/init.rb
Instance Method Summary collapse
Methods inherited from Command
Constructor Details
This class inherits a constructor from Terrestrial::Cli::Command
Instance Method Details
#run ⇒ Object
5 6 7 8 9 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 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/terrestrial/cli/init.rb', line 5 def run # Fail early if project already exists Config.touch_global_config! Config.load!({}, project: false) if Config.project_config_exist? abort 'Looks like there already exists a project in this directory. Are you in the correct folder?' end check_arguments detect_platform puts '-- Terrestrial Initializing' puts 'Adding new app! Searching for localization files...' TerminalUI.show_spinner do # Otherwise the whole process is too quick for the eye sleep 2 unless Config.testing? end puts '' select_translation_files create_app_in_web if @response.success? update_config MixpanelClient.track('cli-init-command') puts '-- Success!' puts 'App platform added to project! You can view your app at https://mission.terrestrial.io/' puts '' puts '-- What to do next?' if @translation_files.any? puts 'Run "terrestrial scan" to see which strings Terrestrial is currently tracking.' puts 'When you\'re ready to upload your strings for translation, run "terrestrial push"!' elsif @translation_files.none? && @platform == 'ios' puts 'To get started localizing your app, run "terrestrial flight".' puts 'Terrestrial will scan your code for strings, and generate the necessary localization files.' elsif @translation_files.none? && @platform == 'android' puts 'Looks like Terrestrial does not know which strings.xml files to track.' puts 'To continue, add your base language strings.xml file to terrestrial.yml.' puts 'When you\'re ready, run "terrestrial scan" to see which strings Terrestrial is tracking, and "terrestrial push" to upload.' end puts '' puts 'For more information, see http://docs.terrestrial.io or jump on Slack at https://terrestrial-slack.herokuapp.com/ if you have any questions.' else puts 'Oh snap. There was an error initializing your project.' puts @response.body.inspect abort end end |