text
stringlengths
0
828
endpoint = yass.config.get(""hosting.%s"" % target)
if not endpoint:
raise ValueError(""%s endpoint is missing in the config"" % target.upper())
if target == ""s3"":
p = publisher.S3Website(sitename=sitename,
aws_access_key_id=endpoint.get(""aws_access_key_id""),
aws_secret_access_key=endpoint.get(""aws_secret_access_key""),
region=endpoint.get(""aws_region""))
if not p.website_exists:
print("">>>"")
print(""Setting S3 site..."")
if p.create_website() is True:
# Need to give it enough time to create it
# Should be a one time thing
time.sleep(10)
p.create_www_website()
print(""New bucket created: %s"" % p.sitename)
if rebuild_manifest:
print("">>>"")
print(""Rebuilding site's manifest..."")
p.create_manifest_from_s3_files()
if purge_files is True or endpoint.get(""purge_files"") is True:
print("">>>"")
print(""Purging files..."")
exclude_files = endpoint.get(""purge_exclude_files"", [])
p.purge_files(exclude_files=exclude_files)
if not skip_upload:
print("">>>"")
print(""Uploading your site..."")
p.upload(yass.build_dir)
else:
print("">>>"")
print(""WARNING: files upload was skipped because of the use of --skip-upload"")
print("""")
print(""Yass! Your site has been successfully published to: "")
print(p.website_endpoint_url)
footer()"
4469,"def setup_dns(endpoint):
""""""Setup site domain to route to static site""""""
print(""Setting up DNS..."")
yass = Yass(CWD)
target = endpoint.lower()
sitename = yass.sitename
if not sitename:
raise ValueError(""Missing site name"")
endpoint = yass.config.get(""hosting.%s"" % target)
if not endpoint:
raise ValueError(
""%s endpoint is missing in the hosting config"" % target.upper())
if target == ""s3"":
p = publisher.S3Website(sitename=sitename,
aws_access_key_id=endpoint.get(""aws_access_key_id""),
aws_secret_access_key=endpoint.get(""aws_secret_access_key""),
region=endpoint.get(""aws_region""))
print(""Setting AWS Route53 for: %s ..."" % p.sitename)
p.setup_dns()
print("""")
print(""Yass! Route53 setup successfully!"")
print(""You can now visit the site at :"")
print(p.sitename_endpoint)
footer()"
4470,"def create_site(sitename):
""""""Create a new site directory and init Yass""""""
sitepath = os.path.join(CWD, sitename)
if os.path.isdir(sitepath):
print(""Site directory '%s' exists already!"" % sitename)
else:
print(""Creating site: %s..."" % sitename)
os.makedirs(sitepath)
copy_resource(""skel/"", sitepath)
stamp_yass_current_version(sitepath)
print(""Site created successfully!"")
print(""CD into '%s' and run 'yass serve' to view the site"" % sitename)
footer()"
4471,"def init():
""""""Initialize Yass in the current directory """"""
yass_conf = os.path.join(CWD, ""yass.yml"")
if os.path.isfile(yass_conf):
print(""::ALERT::"")
print(""It seems like Yass is already initialized here."")
print(""If it's a mistake, delete 'yass.yml' in this directory"")
else:
print(""Init Yass in %s ..."" % CWD)
copy_resource(""skel/"", CWD)
stamp_yass_current_version(CWD)
print(""Yass init successfully!"")