Sha256: 555267fb92bdb02b9987d207657019a1ee6d80c170c54a85bf6d39bffc0eb158

Contents?: true

Size: 771 Bytes

Versions: 3

Compression:

Stored size: 771 Bytes

Contents

module Localeapp
  module CLI
    class Pull < Command
      include ::Localeapp::ApiCall

      def execute
        @output.puts "Localeapp Pull"
        @output.puts ""

        @output.puts "Fetching translations:"
        api_call :translations,
          :success => :update_backend,
          :failure => :report_failure,
          :max_connection_attempts => 3
      end

      def update_backend(response)
        @output.puts "Success!"
        @output.puts "Updating backend:"
        Localeapp.updater.update(Localeapp.load_yaml(response))
        @output.puts "Success!"
        Localeapp.poller.write_synchronization_data!(Time.now.to_i, Time.now.to_i)
      end

      def report_failure(response)
        @output.puts "Failed!"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
localeapp-0.6.2 lib/localeapp/cli/pull.rb
localeapp-0.6.1 lib/localeapp/cli/pull.rb
localeapp-0.6.0 lib/localeapp/cli/pull.rb