mirror of
https://github.com/MacDownApp/macdown.git
synced 2026-05-17 12:40:37 +00:00
Experimental Travis-Transifex integration
This commit is contained in:
+13
-6
@@ -1,12 +1,19 @@
|
||||
osx_image: xcode8
|
||||
language: objective-c
|
||||
cache:
|
||||
- bundler
|
||||
- cocoapods
|
||||
- bundler
|
||||
- cocoapods
|
||||
env:
|
||||
global:
|
||||
secure: Vyar5YYP3n5CXQWiGxxT2QGYCcZgrSECmMb0BxeaG60KrKfDuXIoj6+rL/VqSImIlaF7qiVHkhHQba8Gf9QHhktUtfK4PQLfE0DzogoFVp8IXaTVEg9wBDnHAiqdadMmY3Vt2blnIIBLiV5+lFWxuSYlX27TTlr1ieev9Z+fMC0=
|
||||
install:
|
||||
- "bundle install"
|
||||
- "travis_wait bundle exec pod install"
|
||||
- bundle install
|
||||
- travis_wait bundle exec pod install
|
||||
- pip install --user transifex-client
|
||||
before_script:
|
||||
- set -o pipefail
|
||||
- set -o pipefail
|
||||
script:
|
||||
- xcodebuild -workspace MacDown.xcworkspace -scheme MacDown test | xcpretty
|
||||
- xcodebuild -workspace MacDown.xcworkspace -scheme MacDown test | xcpretty
|
||||
- xcodebuild -exportLocalizations -localizationPath Build/Localizations
|
||||
after_success:
|
||||
- python Tools/travis_push_transifex.py
|
||||
|
||||
+4
-5
@@ -1,9 +1,8 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
lang_map = zh_TW:zh-Hant, zh_CN:zh-Hans
|
||||
|
||||
[macdown.localizable]
|
||||
source_file = po/myproj.pot
|
||||
[macdown.macdownxliff]
|
||||
file_filter = Build/Localizations/<lang>.xliff
|
||||
source_lang = en
|
||||
type = PO
|
||||
file_filter = po/<lang>.po
|
||||
trans.fi = translations/fi/LC_MESSAGES/django.po
|
||||
type = XLIFF
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def write_transifex_config():
|
||||
"""Used to setup Travis for Transifex push.
|
||||
|
||||
Requires environ "TRANSIFEX_PASSWORD".
|
||||
"""
|
||||
transifexrc_path = os.path.expanduser('~/.transifexrc')
|
||||
if os.path.exists(transifexrc_path):
|
||||
return
|
||||
with io.open(transifexrc_path, 'w', encoding='utf-8') as f:
|
||||
f.write((
|
||||
'[https://www.transifex.com]\n'
|
||||
'hostname = https://www.transifex.com\n'
|
||||
'password = {password}\n'
|
||||
'token = \n'
|
||||
'username = macdown\n'
|
||||
).format(password=os.environ['TRANSIFEX_PASSWORD']))
|
||||
|
||||
|
||||
def main():
|
||||
if os.getenv('TRAVIS_PULL_REQUEST') != 'false':
|
||||
print('Build triggered by a pull request. Transifex push skipped.',
|
||||
file=sys.stderr)
|
||||
return
|
||||
current_branch = os.getenv('TRAVIS_BRANCH')
|
||||
target_branch = 'master'
|
||||
if current_branch != target_branch:
|
||||
print('Branch {cur} is not {target}. Transifex push skipped.'.format(
|
||||
cur=current_branch, target=target_branch,
|
||||
), file=sys.stderr)
|
||||
return
|
||||
write_transifex_config()
|
||||
os.system('~/.local/bin/tx push -s')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user