本文整理汇总了Python中utils.confirm函数的典型用法代码示例。如果您正苦于以下问题:Python confirm函数的具体用法?Python confirm怎么用?Python confirm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了confirm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deploy
def deploy(remote="origin"):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require("settings", provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require("branch", provided_by=[stable, master, branch])
if app_config.DEPLOYMENT_TARGET == "production" and env.branch != "stable":
utils.confirm(
"You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?"
% env.branch
)
if app_config.DEPLOY_TO_SERVERS:
checkout_latest(remote)
fabcast("update_copy")
fabcast("assets_sync")
fabcast("update_data")
if app_config.DEPLOY_CRONTAB:
install_crontab()
if app_config.DEPLOY_SERVICES:
deploy_confs()
compiled_includes = render()
render_dorms(compiled_includes)
_gzip("www", ".gzip")
_deploy_to_s3()
_gzip(".dorms_html", ".dorms_gzip")
_deploy_to_s3(".dorms_gzip")
示例2: app_template_bootstrap
def app_template_bootstrap(project_name=None, repository_name=None):
"""
Execute the bootstrap tasks for a new project.
"""
config_files = ' '.join(['PROJECT_README.md', 'app_config.py'])
config = {}
config['$NEW_PROJECT_SLUG'] = os.getcwd().split('/')[-1]
config['$NEW_PROJECT_NAME'] = project_name or config['$NEW_PROJECT_SLUG']
config['$NEW_REPOSITORY_NAME'] = repository_name or config['$NEW_PROJECT_SLUG']
config['$NEW_PROJECT_FILENAME'] = config['$NEW_PROJECT_SLUG'].replace('-', '_')
utils.confirm("Have you created a Github repository named \"%s\"?" % config['$NEW_REPOSITORY_NAME'])
for k, v in config.items():
local('sed -i "" \'s|%s|%s|g\' %s' % (k, v, config_files))
local('rm -rf .git')
local('git init')
local('mv PROJECT_README.md README.md')
local('rm *.pyc')
local('rm LICENSE')
local('git add .')
local('git commit -am "Initial import from app-template."')
local('git remote add origin [email protected]:nprapps/%s.git' % config['$NEW_REPOSITORY_NAME'])
local('git push -u origin master')
local('mkdir ~/Dropbox/nprapps/assets/%s' % config['$NEW_PROJECT_NAME'])
示例3: deploy
def deploy(remote='origin'):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch)
if app_config.DEPLOY_TO_SERVERS:
checkout_latest(remote)
fabcast('update_copy')
fabcast('assets_sync')
fabcast('update_data')
if app_config.DEPLOY_CRONTAB:
install_crontab()
if app_config.DEPLOY_SERVICES:
deploy_confs()
compiled_includes = render.render_all()
render.render_dorms(compiled_includes)
sass()
# _gzip('www', '.gzip')
# _deploy_to_s3()
# _gzip('.dorms_html', '.dorms_gzip')
# _deploy_to_s3('.dorms_gzip')
local('rm -rf dist')
local('cp -r .dorms_html dist')
local('cp -r www/ dist/')
示例4: go
def go(github_username='nprapps', repository_name=None):
"""
Execute the bootstrap tasks for a new project.
"""
config_files = ' '.join(['PROJECT_README.md', 'app_config.py'])
config = {}
config['$NEW_PROJECT_SLUG'] = os.getcwd().split('/')[-1]
config['$NEW_REPOSITORY_NAME'] = repository_name or config['$NEW_PROJECT_SLUG']
config['$NEW_PROJECT_FILENAME'] = config['$NEW_PROJECT_SLUG'].replace('-', '_')
config['$NEW_DISQUS_UUID'] = str(uuid.uuid1())
utils.confirm("Have you created a Github repository named \"%s\"?" % config['$NEW_REPOSITORY_NAME'])
for k, v in config.items():
local('sed -i "" \'s|%s|%s|g\' %s' % (k, v, config_files))
local('rm -rf .git')
local('git init')
local('mv PROJECT_README.md README.md')
local('rm *.pyc')
local('rm LICENSE')
local('git add .')
local('git add -f www/assets/.assetsignore')
local('git commit -am "Initial import from app-template."')
local('git remote add origin [email protected]:%s/%s.git' % (github_username, config['$NEW_REPOSITORY_NAME']))
local('git push -u origin master')
# Update app data
execute('update')
示例5: shiva_the_destroyer
def shiva_the_destroyer():
"""
Deletes the app from s3
"""
require("settings", provided_by=[production, staging])
utils.confirm(
"You are about to destroy everything deployed to %s for this project.\nDo you know what you're doing?"
% app_config.DEPLOYMENT_TARGET
)
with settings(warn_only=True):
sync = 'aws s3 rm %s --recursive --region "us-east-1"'
for bucket in app_config.S3_BUCKETS:
local(sync % ("s3://%s/%s/" % (bucket, app_config.PROJECT_SLUG)))
if app_config.DEPLOY_TO_SERVERS:
run("rm -rf %(SERVER_PROJECT_PATH)s" % app_config.__dict__)
if app_config.DEPLOY_CRONTAB:
uninstall_crontab()
if app_config.DEPLOY_SERVICES:
nuke_confs()
示例6: shiva_the_destroyer
def shiva_the_destroyer():
"""
Deletes the app from s3
"""
require("settings", provided_by=[production, staging])
utils.confirm(
colored(
"You are about to destroy everything deployed to %s for this project.\nDo you know what you're doing?')"
% app_config.DEPLOYMENT_TARGET,
"red",
)
)
with settings(warn_only=True):
flat.delete_folder(app_config.S3_BUCKET, app_config.PROJECT_SLUG)
if app_config.DEPLOY_TO_SERVERS:
servers.delete_project()
if app_config.DEPLOY_CRONTAB:
servers.uninstall_crontab()
if app_config.DEPLOY_SERVICES:
servers.nuke_confs()
示例7: deploy
def deploy(remote='origin'):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm(
colored("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch, "red")
)
servers.checkout_latest(remote)
servers.fabcast('text.update')
servers.fabcast('assets.sync')
servers.fabcast('data.update')
if app_config.DEPLOY_CRONTAB:
servers.install_crontab()
if app_config.DEPLOY_SERVICES:
servers.deploy_confs()
update()
render.render_all()
_gzip('www', '.gzip')
_deploy_to_s3()
示例8: app_template_bootstrap
def app_template_bootstrap(github_username="TylerFisher", project_name=None, repository_name=None):
"""
Execute the bootstrap tasks for a new project.
"""
config_files = " ".join(["PROJECT_README.md", "app_config.py"])
config = {}
config["$NEW_PROJECT_SLUG"] = os.getcwd().split("/")[-1]
config["$NEW_PROJECT_NAME"] = project_name or config["$NEW_PROJECT_SLUG"]
config["$NEW_REPOSITORY_NAME"] = repository_name or config["$NEW_PROJECT_SLUG"]
config["$NEW_PROJECT_FILENAME"] = config["$NEW_PROJECT_SLUG"].replace("-", "_")
utils.confirm('Have you created a Github repository named "%s"?' % config["$NEW_REPOSITORY_NAME"])
for k, v in config.items():
local("sed -i \"\" 's|%s|%s|g' %s" % (k, v, config_files))
local("rm -rf .git")
local("git init")
local("mv PROJECT_README.md README.md")
local("rm *.pyc")
local("rm LICENSE")
local("git add .")
local('git commit -am "Initial import from app-template."')
local("git remote add origin [email protected]:%s/%s.git" % (github_username, config["$NEW_REPOSITORY_NAME"]))
local("git push -u origin master")
bootstrap()
示例9: deploy
def deploy(remote='origin', reload=False):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm(
colored("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch, "red")
)
servers.checkout_latest(remote)
if app_config.DEPLOY_CRONTAB:
servers.install_crontab()
if app_config.DEPLOY_SERVICES:
servers.deploy_confs()
update()
render.render_all()
flat.deploy_folder(
app_config.S3_BUCKET,
'www',
app_config.PROJECT_SLUG,
headers={
'Cache-Control': 'max-age=%i' % app_config.DEFAULT_MAX_AGE
},
ignore=[]
)
示例10: shiva_the_destroyer
def shiva_the_destroyer():
"""
Deletes the app from s3
"""
require('settings', provided_by=[production, staging])
utils.confirm(
colored("You are about to destroy everything deployed to %s for this project.\nDo you know what you're doing?')" % app_config.DEPLOYMENT_TARGET, "red")
)
with settings(warn_only=True):
sync = 'aws s3 rm s3://%s/%s/ --recursive --region "%s"' % (
app_config.S3_BUCKET['bucket_name'],
app_config.PROJECT_SLUG,
app_config.S3_BUCKET['region']
)
local(sync)
if app_config.DEPLOY_TO_SERVERS:
servers.delete_project()
if app_config.DEPLOY_CRONTAB:
servers.uninstall_crontab()
if app_config.DEPLOY_SERVICES:
servers.nuke_confs()
示例11: go
def go(github_username=app_config.GITHUB_USERNAME, repository_name=None):
"""
Execute the bootstrap tasks for a new project.
"""
config_files = " ".join(["PROJECT_README.md", "app_config.py", "crontab"])
config = {}
config["$NEW_PROJECT_SLUG"] = os.getcwd().split("/")[-1]
config["$NEW_REPOSITORY_NAME"] = repository_name or config["$NEW_PROJECT_SLUG"]
config["$NEW_PROJECT_FILENAME"] = config["$NEW_PROJECT_SLUG"].replace("-", "_")
config["$NEW_DISQUS_UUID"] = str(uuid.uuid1())
utils.confirm('Have you created a Github repository named "%s"?' % config["$NEW_REPOSITORY_NAME"])
for k, v in config.items():
local("sed -i \"\" 's|%s|%s|g' %s" % (k, v, config_files))
local("rm -rf .git")
local("git init")
local("mv PROJECT_README.md README.md")
local("rm *.pyc")
local("rm LICENSE")
local("git add .")
local("git add -f www/assets/assetsignore")
local('git commit -am "Initial import from app-template."')
local("git remote add origin [email protected]:%s/%s.git" % (github_username, config["$NEW_REPOSITORY_NAME"]))
local("git push -u origin master")
# Update app data
execute("update")
示例12: deploy
def deploy(remote='origin'):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch)
if app_config.DEPLOY_TO_SERVERS:
checkout_latest(remote)
#fabcast('update_copy')
#fabcast('assets.sync')
#fabcast('update_data')
if app_config.DEPLOY_CRONTAB:
install_crontab()
if app_config.DEPLOY_SERVICES:
deploy_confs()
render()
_gzip('www', '.gzip')
_deploy_to_s3()
_cleanup_minified_includes()
示例13: post
def post(slug):
"""
Set the post to work on.
"""
# Force root path every time
fab_path = os.path.realpath(os.path.dirname(__file__))
root_path = os.path.join(fab_path, '..')
os.chdir(root_path)
env.slug = utils._find_slugs(slug)
if not env.slug:
utils.confirm('This post does not exist. Do you want to create a new post called %s?' % slug)
_new(slug)
return
env.static_path = '%s/%s' % (app_config.POST_PATH, env.slug)
if os.path.exists ('%s/post_config.py' % env.static_path):
# set slug for deployment in post_config
find = "DEPLOY_SLUG = ''"
replace = "DEPLOY_SLUG = '%s'" % env.slug
utils.replace_in_file('%s/post_config.py' % env.static_path, find, replace)
env.post_config = imp.load_source('post_config', '%s/post_config.py' % env.static_path)
env.copytext_key = env.post_config.COPY_GOOGLE_DOC_KEY
else:
env.post_config = None
env.copytext_key = None
env.copytext_slug = env.slug
示例14: create_ami
def create_ami(stackname, name=None):
pname = core.project_name_from_stackname(stackname)
msg = "this will create a new AMI for the project %r" % pname
confirm(msg)
amiid = bakery.create_ami(stackname, name)
print(amiid)
errcho('update project file with new ami %s. these changes must be merged and committed manually' % amiid)
示例15: deploy
def deploy(quick=None, remote='origin', reload=False):
"""
Deploy the latest app to S3 and, if configured, to our servers.
"""
require('settings', provided_by=[production, staging])
if app_config.DEPLOY_TO_SERVERS:
require('branch', provided_by=[stable, master, branch])
if (app_config.DEPLOYMENT_TARGET == 'production' and env.branch != 'stable'):
utils.confirm(
colored("You are trying to deploy the '%s' branch to production.\nYou should really only deploy a stable branch.\nDo you know what you're doing?" % env.branch, "red")
)
servers.checkout_latest(remote)
servers.fabcast('text.update')
servers.fabcast('assets.sync')
servers.fabcast('data.update')
if app_config.DEPLOY_CRONTAB:
servers.install_crontab()
if app_config.DEPLOY_SERVICES:
servers.deploy_confs()
if quick != 'quick':
update()
render.render_all()
# Clear files that should never be deployed
local('rm -rf www/live-data')
flat.deploy_folder(
app_config.S3_BUCKET,
'www',
app_config.PROJECT_SLUG,
headers={
'Cache-Control': 'max-age=%i' % app_config.DEFAULT_MAX_AGE
},
ignore=['www/assets/*', 'www/live-data/*']
)
flat.deploy_folder(
app_config.S3_BUCKET,
'www/assets',
'%s/assets' % app_config.PROJECT_SLUG,
headers={
'Cache-Control': 'max-age=%i' % app_config.ASSETS_MAX_AGE
}
)
if reload:
reset_browsers()
if not check_timestamp():
reset_browsers()