Sha256: 92a5ea419eb0264d856cdbba670fe1fef9dea3428d48fb61b94de2339a4debdc

Contents?: true

Size: 1.11 KB

Versions: 436

Compression:

Stored size: 1.11 KB

Contents

module DPL
  class Provider
    class Transifex < Provider
      experimental 'Transifex'

      DEFAULT_CLIENT_VERSION = '>=0.11'
      DEFAULT_HOSTNAME = 'https://www.transifex.com'

      def install_deploy_dependencies
        cli_version = options[:cli_version] || DEFAULT_CLIENT_VERSION
        self.class.pip 'transifex', 'transifex', cli_version
      end

      def needs_key?
        false
      end

      def check_auth
        install_deploy_dependencies
        write_transifexrc
        context.shell 'tx status'
      end

      def push_app
        source_push
      end

      def write_transifexrc
        File.open(File.expand_path('~/.transifexrc'), 'w') do |f|
          f.puts [
            "[#{options[:hostname] || DEFAULT_HOSTNAME}]",
            "hostname = #{options[:hostname] || DEFAULT_HOSTNAME}",
            "username = #{options[:username]}",
            "password = #{options[:password]}",
            "token = #{options[:token]}",
          ].join("\n")
        end
      end

      def source_push
        context.shell 'tx push --source --no-interactive', retry: true
      end
    end
  end
end

Version data entries

436 entries across 436 versions & 3 rubygems

Version Path
dpl-transifex-1.9.7.travis.2853.6 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.7.travis.2851.6 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6.travis.2848.6 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6.travis.2837.6 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6.travis.2827.6 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6.travis.2795.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6.travis.2794.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6.travis.2790.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6.travis.2786.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.6.travis.2785.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.5.travis.2783.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.5.travis.2781.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.5.travis.2782.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.5.travis.2775.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.4.travis.2773.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.4 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.4.travis.2768.5 lib/dpl/provider/transifex.rb
dpl-transifex-1.9.4.travis.2766.5 lib/dpl/provider/transifex.rb