Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental Travis-Transifex integration
- Loading branch information
Showing
3 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |