1717from .pretext .chapter_pop import manifest_data_to_db
1818import codecs
1919from runestone .server import get_dburl
20- from runestone .server .utils import update_library
20+ from runestone .server .utils import update_library , populate_static
2121
2222if len (sys .argv ) == 2 :
2323 if "--version" in sys .argv :
@@ -447,6 +447,17 @@ def process_manifest(course, manifest):
447447 raise IOError ("You must provide a valid path to a manifest file" )
448448
449449
450+ @cli .command (short_help = "Fetch Javascript/CSS from CDN and copy to _static" )
451+ @click .option ("--course" , help = "Name of the course (base course)" )
452+ def fetch_latest_static (course ):
453+ config = type ("config" , (object ,), {})()
454+ config .dburl = get_dburl ()
455+ os .chdir (findProjectRoot ())
456+ manifest = "runestone-manifest.xml"
457+ mpath = pathlib .Path (os .getcwd (), "published" , course , manifest )
458+ populate_static (config , mpath , course )
459+
460+
450461def main (args = None ):
451462 sys .dont_write_bytecode = True
452463 if not args :
@@ -469,6 +480,8 @@ def findProjectRoot():
469480 while start != prevdir :
470481 if os .path .exists (os .path .join (start , "pavement.py" )):
471482 return start
483+ if os .path .exists (os .path .join (start , "project.ptx" )):
484+ return start
472485 prevdir = start
473486 start = os .path .dirname (start )
474487 raise IOError ("You must be in a runestone project to run runestone" )
0 commit comments