Beispiel #1
0
def clean_packages(base_path=None):
    compress.revert_js_css_hashes(base_path)
Beispiel #2
0
def clean_packages(base_path=None):
    compress.revert_js_css_hashes(base_path)
Beispiel #3
0
def main():

    start = datetime.datetime.now()

    parser = optparse.OptionParser()

    parser.add_option(
        "-f", "--force", action="store_true", dest="force", help="Force deploy even with local changes", default=False
    )

    parser.add_option(
        "-v", "--version", action="store", dest="version", help="Override the deployed version identifier", default=""
    )

    parser.add_option(
        "-x", "--no-up", action="store_true", dest="noup", help="Don't hg pull/up before deploy", default=""
    )

    parser.add_option(
        "-s",
        "--no-secrets",
        action="store_true",
        dest="nosecrets",
        help="Don't check for production secrets.py file before deploying",
        default="",
    )

    parser.add_option(
        "-d",
        "--dryrun",
        action="store_true",
        dest="dryrun",
        help="Dry run without the final deploy-to-App-Engine step",
        default=False,
    )

    parser.add_option(
        "-c",
        "--clean",
        action="store_true",
        dest="clean",
        help="Clean the old packages and generate them again. If used with -d,the app is not compiled at all and is only cleaned.",
        default=False,
    )

    options, args = parser.parse_args()

    if options.clean:
        print "Cleaning previously generated files"
        tidy_up()
        if options.dryrun:
            return

    includes_local_changes = hg_st()
    if not options.force and includes_local_changes:
        print "Local changes found in this directory, canceling deploy."
        return

    version = -1

    if not options.noup or len(options.version) == 0:
        version = hg_pull_up()
        if version <= 0:
            print "Could not find version after 'hg pull', 'hg up', 'hg tip'."
            return

    if not options.nosecrets:
        if not check_secrets():
            print "Stopping deploy. It doesn't look like you're deploying from a directory with the appropriate secrets.py."
            return

    if len(options.version) > 0:
        version = options.version

    if options.clean:
        compress.hashes = {}

    print "Deploying version " + str(version)
    compress.revert_js_css_hashes()

    if not compile_templates():
        print "Failed to compile templates, bailing."
        return

    compress_js()
    compress_css()

    if not options.dryrun:
        (email, password) = get_app_engine_credentials()
        success = deploy(version, email, password)
        compress.revert_js_css_hashes()
        if success:
            send_hipchat_deploy_message(version, includes_local_changes, email)
            open_browser_to_ka_version(version)
            prime_autocomplete_cache(version)

    end = datetime.datetime.now()
    print "Done. Duration: %s" % (end - start)
Beispiel #4
0
def main():

    start = datetime.datetime.now()

    parser = optparse.OptionParser()

    parser.add_option('-f',
                      '--force',
                      action="store_true",
                      dest="force",
                      help="Force deploy even with local changes",
                      default=False)

    parser.add_option('-v',
                      '--version',
                      action="store",
                      dest="version",
                      help="Override the deployed version identifier",
                      default="")

    parser.add_option('-x',
                      '--no-up',
                      action="store_true",
                      dest="noup",
                      help="Don't hg pull/up before deploy",
                      default="")

    parser.add_option(
        '-s',
        '--no-secrets',
        action="store_true",
        dest="nosecrets",
        help="Don't check for production secrets.py file before deploying",
        default="")

    parser.add_option(
        '-d',
        '--dryrun',
        action="store_true",
        dest="dryrun",
        help="Dry run without the final deploy-to-App-Engine step",
        default=False)

    parser.add_option(
        '-c',
        '--clean',
        action="store_true",
        dest="clean",
        help=
        "Clean the old packages and generate them again. If used with -d,the app is not compiled at all and is only cleaned.",
        default=False)

    options, args = parser.parse_args()

    if (options.clean):
        print "Cleaning previously generated files"
        tidy_up()
        if options.dryrun:
            return

    includes_local_changes = hg_st()
    if not options.force and includes_local_changes:
        print "Local changes found in this directory, canceling deploy."
        return

    version = -1

    if not options.noup or len(options.version) == 0:
        version = hg_pull_up()
        if version <= 0:
            print "Could not find version after 'hg pull', 'hg up', 'hg tip'."
            return

    if not options.nosecrets:
        if not check_secrets():
            print "Stopping deploy. It doesn't look like you're deploying from a directory with the appropriate secrets.py."
            return

    if len(options.version) > 0:
        version = options.version

    if options.clean:
        compress.hashes = {}

    print "Deploying version " + str(version)
    compress.revert_js_css_hashes()

    if not compile_templates():
        print "Failed to compile templates, bailing."
        return

    compress_js()
    compress_css()

    if not options.dryrun:
        (email, password) = get_app_engine_credentials()
        success = deploy(version, email, password)
        compress.revert_js_css_hashes()
        if success:
            send_hipchat_deploy_message(version, includes_local_changes, email)
            open_browser_to_ka_version(version)
            prime_autocomplete_cache(version)

    end = datetime.datetime.now()
    print "Done. Duration: %s" % (end - start)