Beispiel #1
0
def check_for_updates(force=False):
    # Don't check for updates in local dev mode.
    if os.environ.get('SP_LOCAL_CLI'):
        if force is True:
            print('[dev mode, skipping]')
        return

    # Skip this check if less than 24-hours has passed since the last check.
    if force is False:
        timestamp = Cache.get_update_check_timestamp()
        now = int(time.time())
        threshold = 3600 * 48
        if timestamp and timestamp > (now - threshold):
            return  # already checked for an update recently, so skip this one

    # If we got this far we'll check for an update.
    puts(colored.yellow('Checking for updates...'))
    if get_remote_source_length() != Cache.get_installation_length():
        # Length mis-match, we need to do an update
        msg = 'There is an update available for the Siphon command-line ' \
            'tools. Would you like to install it now? [y/N]: '
        try:
            resp = get_input(colored.green(msg))
            if resp in ('y', 'Y'):
                puts(colored.yellow('Updating your local installation of ' \
                    'the Siphon command-line tools...\n'))
                url = 'https://%s/install.sh' % os.environ['SP_HOST']
                bash('curl %s | sh' % url)
        except KeyboardInterrupt:
            pass
    elif force is True:
        puts(colored.green('You are fully up-to-date.'))

    # Bump the timestamp so that we don't check again for 24-hours.
    Cache.set_update_check_timestamp()
Beispiel #2
0
def check_for_updates(force=False):
    # Don't check for updates in local dev mode.
    if os.environ.get('SP_LOCAL_CLI'):
        if force is True:
            print('[dev mode, skipping]')
        return

    # Skip this check if less than 24-hours has passed since the last check.
    if force is False:
        timestamp = Cache.get_update_check_timestamp()
        now = int(time.time())
        threshold = 3600 * 48
        if timestamp and timestamp > (now - threshold):
            return  # already checked for an update recently, so skip this one

    # If we got this far we'll check for an update.
    puts(colored.yellow('Checking for updates...'))
    if get_remote_source_length() != Cache.get_installation_length():
        # Length mis-match, we need to do an update
        msg = 'There is an update available for the Siphon command-line ' \
            'tools. Would you like to install it now? [y/N]: '
        try:
            resp = get_input(colored.green(msg))
            if resp in ('y', 'Y'):
                puts(colored.yellow('Updating your local installation of ' \
                    'the Siphon command-line tools...\n'))
                url = 'https://%s/install.sh' % os.environ['SP_HOST']
                bash('curl %s | sh' % url)
        except KeyboardInterrupt:
            pass
    elif force is True:
        puts(colored.green('You are fully up-to-date.'))

    # Bump the timestamp so that we don't check again for 24-hours.
    Cache.set_update_check_timestamp()
Beispiel #3
0
def prompt_for_upgrade():
    pricing_url = 'https://getsiphon.com/pricing/'
    print('Sorry, publishing is a paid feature and it appears that you do ' \
        'not have a paid subscription yet. Please visit our pricing page ' \
        'to find out how to upgrade:\n\n==> %s' % pricing_url)
    if get_platform_name() == PLATFORM_DARWIN:
        msg = '\nWould you like to open the pricing page now and ' \
            'upgrade? [Y/n]: '
        try:
            if get_input(colored.green(msg)) in ('Y', 'y', ''):
                bash('open %s' % pricing_url)
        except KeyboardInterrupt:
            print()
    else:
        print('\nAfter upgrading, try running this command again to ' \
            'publish your app.')
Beispiel #4
0
def prompt_for_upgrade():
    pricing_url = 'https://getsiphon.com/pricing/'
    print('Sorry, publishing is a paid feature and it appears that you do ' \
        'not have a paid subscription yet. Please visit our pricing page ' \
        'to find out how to upgrade:\n\n==> %s' % pricing_url)
    if get_platform_name() == PLATFORM_DARWIN:
        msg = '\nWould you like to open the pricing page now and ' \
            'upgrade? [Y/n]: '
        try:
            if get_input(colored.green(msg)) in ('Y', 'y', ''):
                bash('open %s' % pricing_url)
        except KeyboardInterrupt:
            print()
    else:
        print('\nAfter upgrading, try running this command again to ' \
            'publish your app.')
def add_repo_to_archive(repo, commit, name, tar_archive, directories=(),
                        files=(), prefix=''):
    with make_temp_dir() as tmp:
        with cd(tmp):
            print('Cloning %s into %s' % (name, tmp))
            bash('git clone %s' % repo)
            bash('cd %s && git checkout %s' % (name, commit))
        for f in files:
            relative_path = os.path.join(name, f)
            src = os.path.join(tmp, relative_path)
            tar_path = os.path.join(prefix, f)
            tar_archive.add(src, tar_path)
        for d in directories:
            relative_path = os.path.join(name, d)
            src = os.path.join(tmp, relative_path)
            tar_path = os.path.join(prefix, d)
            tar_archive.add(src, tar_path, recursive=True)
Beispiel #6
0
def add_repo_to_archive(repo,
                        commit,
                        name,
                        tar_archive,
                        directories=(),
                        files=(),
                        prefix=''):
    with make_temp_dir() as tmp:
        with cd(tmp):
            print('Cloning %s into %s' % (name, tmp))
            bash('git clone %s' % repo)
            bash('cd %s && git checkout %s' % (name, commit))
        for f in files:
            relative_path = os.path.join(name, f)
            src = os.path.join(tmp, relative_path)
            tar_path = os.path.join(prefix, f)
            tar_archive.add(src, tar_path)
        for d in directories:
            relative_path = os.path.join(name, d)
            src = os.path.join(tmp, relative_path)
            tar_path = os.path.join(prefix, d)
            tar_archive.add(src, tar_path, recursive=True)
Beispiel #7
0
def add_repo_to_directory(repo, commit, name, destination, directories=(),
                          files=()):
    with make_temp_dir() as tmp:
        with cd(tmp):
            print('Clone destination: %s' % tmp)
            bash('git clone %s' % repo)
            bash('cd %s && git checkout %s' % (name, commit))

            print('Copying required files & directories...')
            repo_base = os.path.join(tmp, name)
            for f in files:
                src_path = os.path.join(repo_base, f)
                dest_path = os.path.join(destination, f)
                # copyfile does not make intermediate directories if they do
                # not exist
                target_dir = os.path.dirname(dest_path)
                ensure_dir_exists(target_dir)
                copyfile(src_path, dest_path)

            for d in directories:
                src_path = os.path.join(repo_base, d)
                dest_path = os.path.join(destination, d)
                copy_tree(src_path, dest_path, preserve_symlinks=True)
Beispiel #8
0
 def uninstall_app(bundle_identifier=XCODE_BUNDLE_IDENTIFIER):
     bash('xcrun simctl uninstall booted %s' % bundle_identifier,
         hide_stderr=True)
Beispiel #9
0
 def install_and_run(app_path, bundle_identifier=XCODE_BUNDLE_IDENTIFIER):
     bash('xcrun simctl install booted %s' % app_path)
     bash('xcrun simctl launch booted %s' % bundle_identifier)
Beispiel #10
0
 def quit():
     bash('killall \'Simulator\'')
Beispiel #11
0
 def boot_simulator(self):
     # Note that we suppress error messages here since xctool raises a funny
     # 'template not specified error'.
     bash('xcrun instruments -w "%s"' % self.udid, hide_stderr=True)
     IOSSimulator.wait_for_ready()