Class: Localeapp::CLI::Update

Inherits:
Command
  • Object
show all
Defined in:
lib/localeapp/cli/update.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#initialize, #initialize_config, #load_config_file, #set_command_line_arguments

Constructor Details

This class inherits a constructor from Localeapp::CLI::Command

Instance Attribute Details

#pollerObject

Returns the value of attribute poller.



4
5
6
# File 'lib/localeapp/cli/update.rb', line 4

def poller
  @poller
end

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/localeapp/cli/update.rb', line 6

def execute
  self.poller = Localeapp::Poller.new
  if timestamp_too_old?
    @output.puts("Timestamp is missing or too old. Please run `localeapp pull` first.")
  else
    @output.puts("Localeapp update: checking for translations since #{poller.updated_at}")
    success = poller.poll!
    @output.puts(success ? "Found and updated new translations" : "No new translations")
  end
end