Реализовал класс абстрактной комманды и одним из наследников сдалал testflight command

This commit is contained in:
Rustam Zaitov 2013-10-02 21:57:39 +04:00
parent 6637c291ae
commit e8fb546a18
7 changed files with 41 additions and 28 deletions

1
scripts/__init__.py Normal file
View File

@ -0,0 +1 @@
__author__ = 'rzaitov'

3
scripts/build_command.py Normal file
View File

@ -0,0 +1,3 @@
class BuildCommand:
def Execute(self):
return None

View File

@ -0,0 +1 @@
__author__ = 'rzaitov'

View File

@ -0,0 +1,33 @@
import os
import inspect
cur_abs_dir_path = os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0])
print('testflight_command', cur_abs_dir_path)
import sys
parent = os.path.split(cur_abs_dir_path)[0]
if parent not in sys.path:
sys.path.append(parent)
import build_command as bcmd
import testflight as tf
class PublishToTestFlightCommand(bcmd.BuildCommand):
def __init__(self, api_token, team_token, notes):
self._publisher = tf.TestFlightPublisherBase(api_token, team_token, notes)
def Execute(self):
self._publisher.Publish()
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('path')
parser.add_argument('-at', '--api_token', required=True, help='api token')
parser.add_argument('-tt', '--team_token', required=True, help='team token')
parser.add_argument('-n', '--notes', default=tf.TestFlightPublisherBase.DefaultNotes, help='upload notes')
args = parser.parse_args()
cmd = PublishToTestFlightCommand(args.api_token, args.team_token, args.notes)
cmd.Execute()

View File

@ -1,8 +0,0 @@
import testflight as tf
def PublishToTestFlight(config):
publisher = tf.TestFlightPublisher(config)
publisher.Publish()
def PrintToConsole(config):
print 'Sample post build action!'

View File

@ -23,8 +23,8 @@ ios_development_root = {
'projects_to_exclude': ['NotCompileApp'],
'info_plist_rel_path': 'BuildSample/Info.plist',
'post_build_file': 'post_build.py',
'post_build_actions' : ['PrintToConsole', 'PublishToTestFlight'],
#'post_build_file': 'post_build.py',
#'post_build_actions' : ['PrintToConsole', 'PublishToTestFlight'],
'patch': patch.PathcIos,
'parent': ios_root

View File

@ -33,21 +33,4 @@ class TestFlightPublisher(TestFlightPublisherBase):
ipa_rel_path = 'BuildSample/bin/iPhone/Release/BuildSample-{0}.ipa'.format(self._config['version'])
ipa_abs_path = os.path.join(sln_dir, ipa_rel_path)
return TestFlightPublisherBase.Publish(self, ipa_abs_path)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('path')
parser.add_argument('-at', '--api_token', required=True, help='api token')
parser.add_argument('-tt', '--team_token', required=True, help='team token')
parser.add_argument('-n', '--notes', default=TestFlightPublisherBase.DefaultNotes, help='upload notes')
args = parser.parse_args()
publisher = TestFlightPublisherBase(args.api_token, args.team_token, args.notes)
publisher.Publish(args.path)
return TestFlightPublisherBase.Publish(self, ipa_abs_path)