Class: ToptranslationCli::Pull
- Inherits:
-
Object
- Object
- ToptranslationCli::Pull
- Defined in:
- lib/toptranslation_cli/pull.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Pull
constructor
A new instance of Pull.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Pull
14 15 16 17 18 19 20 |
# File 'lib/toptranslation_cli/pull.rb', line 14 def initialize ToptranslationCli.configuration.load @pastel = Pastel.new @spinner_settings = { success_mark: @pastel.green('+'), error_mark: @pastel.red('-') } @spinner = TTY::Spinner.new("[#{@pastel.yellow(':spinner')}] :title", @spinner_settings) end |
Class Method Details
.run ⇒ Object
10 11 12 |
# File 'lib/toptranslation_cli/pull.rb', line 10 def self.run new.run end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/toptranslation_cli/pull.rb', line 22 def run changed = changed_files(remote_files, local_files) download_files(changed) rescue RestClient::BadRequest @spinner.error(@pastel.red('invalid access token')) if @spinner.spinning? exit 1 rescue RestClient::NotFound @spinner.error(@pastel.red('project not found')) if @spinner.spinning? exit 1 end |