Sha256: d03895a693f591a312c6f9354c13f999a13898a3ba73f01f3a85ff3d154b5485

Contents?: true

Size: 836 Bytes

Versions: 5

Compression:

Stored size: 836 Bytes

Contents

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

      def initialize(output = $stdout)
        @output = output
      end

      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

5 entries across 5 versions & 1 rubygems

Version Path
localeapp-0.5.2 lib/localeapp/cli/pull.rb
localeapp-0.5.1 lib/localeapp/cli/pull.rb
localeapp-0.5.0 lib/localeapp/cli/pull.rb
localeapp-0.4.3 lib/localeapp/cli/pull.rb
localeapp-0.4.2 lib/localeapp/cli/pull.rb