Реализовал публикацию в tf с помощью классов Python
This commit is contained in:
parent
6e7135fb35
commit
c2e10d066c
|
|
@ -1,20 +1,12 @@
|
|||
from subprocess import call
|
||||
import os
|
||||
import testflight
|
||||
import testflight as tf
|
||||
|
||||
def PublishToTestFlight(config):
|
||||
sln_path = config['sln_path']
|
||||
sln_dir = os.path.dirname(sln_path)
|
||||
|
||||
cmd_text_pattern = "curl http://testflightapp.com/api/builds.json -F file=@'{0}' -F api_token='{1}' -F team_token='{2}' -F notes='This build was uploaded via the upload API'"
|
||||
ipa_rel_path = 'BuildSample/bin/iPhone/Release/BuildSample-{0}.ipa'.format(config['version'])
|
||||
ipa_abs_path = os.path.join(sln_dir, ipa_rel_path)
|
||||
|
||||
api_token = config['api_token']
|
||||
team_token = config['team_token']
|
||||
cmd_text = cmd_text_pattern.format(ipa_abs_path, api_token, team_token)
|
||||
|
||||
ret_code = call(cmd_text, shell=True)
|
||||
publisher = tf.TestFlightPublisher(api_token, team_token)
|
||||
publisher.Publish(config)
|
||||
|
||||
|
||||
def PrintToConsole(config):
|
||||
print 'Sample post build action!'
|
||||
|
|
@ -1 +1,30 @@
|
|||
from subprocess import call
|
||||
import os
|
||||
|
||||
class TestFlightPublisherBase:
|
||||
DefaultNotes = 'This build was uploaded via the upload API'
|
||||
|
||||
def __init__(self, api_token, team_token, notes=DefaultNotes):
|
||||
self._api_token = api_token
|
||||
self._team_token = team_token
|
||||
self._notes = notes
|
||||
|
||||
def Publish(self, pathToFile):
|
||||
cmd_text_pattern = "curl http://testflightapp.com/api/builds.json -F file=@'{0}' -F api_token='{1}' -F team_token='{2}' -F notes='{3}'"
|
||||
cmd_text = cmd_text_pattern.format(pathToFile, self._api_token, self._team_token, self._notes)
|
||||
|
||||
ret_code = call(cmd_text, shell=True)
|
||||
return ret_code
|
||||
|
||||
class TestFlightPublisher(TestFlightPublisherBase):
|
||||
def __init__(self, api_token, team_token, notes=TestFlightPublisherBase.DefaultNotes):
|
||||
TestFlightPublisherBase.__init__(self, api_token, team_token, notes)
|
||||
|
||||
def Publish(self, config):
|
||||
sln_path = config['sln_path']
|
||||
sln_dir = os.path.dirname(sln_path)
|
||||
|
||||
ipa_rel_path = 'BuildSample/bin/iPhone/Release/BuildSample-{0}.ipa'.format(config['version'])
|
||||
ipa_abs_path = os.path.join(sln_dir, ipa_rel_path)
|
||||
|
||||
return TestFlightPublisherBase.Publish(self, ipa_abs_path)
|
||||
Loading…
Reference in New Issue