Skip to content

Commit

Permalink
only PyShip.ship() instead of .ship_installer() and .ship_update()
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesabel committed Nov 2, 2020
1 parent 866748e commit b0b751d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pyship/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__application_name__ = "pyship"
__author__ = pyship_author
__version__ = "0.0.18"
__version__ = "0.0.19"
__title__ = __application_name__
__author_email__ = "j@abel.co"
__url__ = "https://github.com/jamesabel/pyship"
Expand Down
2 changes: 1 addition & 1 deletion pyship/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def main():
pyship.cloud_id = args.id
if args.secret is not None:
pyship.cloud_secret = args.secret
pyship.ship_installer()
pyship.ship()
16 changes: 3 additions & 13 deletions pyship/pyship.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pyshipupdate import mkdirs, create_bucket_name
from pyship import __application_name__ as pyship_application_name
from pyship import __author__ as pyship_author
from pyship import __version__ as pyship_version
from pyship import AppInfo, get_logger, run_nsis, create_clip, create_launcher, pyship_print, APP_DIR_NAME, create_clip_file, DEFAULT_DIST_DIR_NAME, get_app_info, PyShipCloud

log = get_logger(pyship_application_name)
Expand All @@ -30,14 +31,14 @@ class PyShip:
cloud_access: PyShipCloud = None # making this accessible outside this class aids in testing, especially when mocking

@typechecked(always=True)
def ship_installer(self) -> (Path, None):
def ship(self) -> (Path, None):
"""
Perform all the steps to ship the app, including creating the installer.
:return: the path to the created installer or None if it could not be created
"""

start_time = datetime.now()
pyship_print(f"{pyship_application_name} starting")
pyship_print(f"{pyship_application_name} starting ({str(pyship_version)})")

target_app_info = get_app_info(self.project_dir, self.dist_dir)

Expand Down Expand Up @@ -86,14 +87,3 @@ def ship_installer(self) -> (Path, None):
pyship_print(f"{pyship_application_name} done (elapsed_time={str(elapsed_time)})")

return installer_exe_path

@typechecked(always=True)
def ship_update(self) -> (Path, None):
"""
Create and upload an update of this target app. The update is a zip of a clip directory, with the extension .clip.
"""
target_app_info = AppInfo()
target_app_info.setup_paths(self.project_dir)
app_dir = Path(self.project_dir, APP_DIR_NAME, target_app_info.name).absolute()
# derived classes will take it from here and do what they need to to place the clip in a place the user will get it via a call to Updater.update() ...
return create_clip(target_app_info, app_dir, True, Path(self.project_dir, self.dist_dir), self.cache_dir, self.find_links)
2 changes: 1 addition & 1 deletion test_pyship/test_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_cloud():
py_ship.cloud_bucket = "testawsimple" # awsimple moto mock makes this
py_ship.cloud_profile = os.environ.get("CLOUD_PROFILE", "default") # since we're using moto to mock we don't need a real profile
log.info(f"{py_ship.cloud_profile=}")
py_ship.ship_installer()
py_ship.ship()

uploaded_files = py_ship.cloud_access.s3_access.dir()
pprint(uploaded_files)
Expand Down
2 changes: 1 addition & 1 deletion test_pyship/test_f_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def do_pyship(tst_app_dirs: TstAppDirs):
pyship_print(f"{tst_app_dirs.target_app_version=}")
ps = PyShip(tst_app_dirs.project_dir, dist_dir=tst_app_dirs.dist_dir, cloud_profile="pyshiptest", find_links=find_links) # the local pyship under development
ps.cloud_access = pyship_cloud
inst = ps.ship_installer()
inst = ps.ship()
return ps, inst

original_version = VersionInfo(0, 0, 1)
Expand Down
2 changes: 1 addition & 1 deletion test_pyship/test_y_pyship.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_pyship():
version = VersionInfo.parse("0.0.1")
tst_app_dirs = TstAppDirs(TST_APP_NAME, version)
py_ship = PyShip(tst_app_dirs.project_dir, dist_dir=tst_app_dirs.dist_dir)
py_ship.ship_installer()
py_ship.ship()


if is_main():
Expand Down

0 comments on commit b0b751d

Please sign in to comment.