Class: PolyglotCli::Command::Push

Inherits:
Object
  • Object
show all
Includes:
Helper::General, Helper::Nest, Helper::Terminal
Defined in:
lib/polyglot_cli/commands/push.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helper::General

#config, #languages, #project, #project_id, #remote_translations, #server_changed?, #token, #update_config

Methods included from Helper::Terminal

#prompt, #success

Methods included from Helper::Nest

#denest, #nest

Constructor Details

#initialize(options) ⇒ Push

Returns a new instance of Push.



12
13
14
# File 'lib/polyglot_cli/commands/push.rb', line 12

def initialize(options)
  @options = options
end

Class Method Details

.init(options) ⇒ Object



8
9
10
# File 'lib/polyglot_cli/commands/push.rb', line 8

def self.init(options)
  new(options).call
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/polyglot_cli/commands/push.rb', line 16

def call
  if server_changed?
    prompt.error('Changes have been made on the server. Please pull before pushing.')
  else
    languages(option_locale).each do |language|
      prompt.say("Processing push for #{language.name}...")
      process(language)
    end
    update_config
    success
  end
end