Sha256: 88042610bc613ae8913a29ec91c5f1bd99bc503427cb5d57e605a2724aacf837

Contents?: true

Size: 763 Bytes

Versions: 26

Compression:

Stored size: 763 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 :export,
          :success => :update_backend,
          :failure => :report_failure,
          :max_connection_attempts => 3
      end

      def update_backend(response)
        @output.puts "Success!"
        @output.puts "Updating backend:"
        Localeapp.updater.dump(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

26 entries across 26 versions & 1 rubygems

Version Path
localeapp-0.6.8 lib/localeapp/cli/pull.rb
localeapp-0.6.7 lib/localeapp/cli/pull.rb
localeapp-0.6.6 lib/localeapp/cli/pull.rb
localeapp-0.6.5 lib/localeapp/cli/pull.rb
localeapp-0.6.4 lib/localeapp/cli/pull.rb
localeapp-0.6.3 lib/localeapp/cli/pull.rb