vim_dl_url = "http://www.vim.org/download.php" vim_version = "1.2.3" vim_regex = '".*vim.*\.exe"' vim_version_regex = '\d+.*\d' appLogFileName = "appLog" validQuery, applications = db_wrapper.get_applications(mydb) print 'All Applicaitons:', applications if validQuery and not vim_name in applications: print 'adding vim to the db.' db_wrapper.add_app(mydb, vim_name, vim_version, vim_dl_url, vim_url) db_wrapper.add_exe_regex(mydb, vim_name, [vim_regex]) db_wrapper.add_version_regex(mydb, vim_name, [vim_version_regex]) vim = app(vim_name, mydb, appLogFileName) updatesAvail = vim.checkUpdates() print 'gvim update available?', updatesAvail if updatesAvail: vim.dlUpdates() putty_name = 'putty' putty_url = 'http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html' putt_dl_url = 'http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html' putty_version = '1.0' putty_regex = '".*putty.*\.exe"' putty_version_regex = '\d+.*\d'
db_wrapper.update_main_url(mydb, "latestApp", "http://newTest.com/index.php") print("After Change main URL", db_wrapper.get_app_urls(mydb, "latestApp")) db_wrapper.update_download_url(mydb, "latestApp", "http://newTest.com/dl") print("After Change dl URL", db_wrapper.get_app_urls(mydb, "latestApp")) print("Update Version", db_wrapper.add_update_file(mydb, "latestApp", "1.5")) print("Get Version", db_wrapper.get_app_version(mydb, "latestApp")) # Test Operations on Dependency Table print("\nTest Operations on Dependency Table") print("Add Dependencies", db_wrapper.add_dependencies(mydb, "App", ["latestApp", "latestApp"])) print("Get Dependency Name", db_wrapper.get_app_dependencies(mydb, "App")) print("Add Dependencies - Error", db_wrapper.add_dependencies(mydb, "App", ["DNE"])) # Test Regex Tables print("\nTest Regex Tables") print("Add Version Regex", db_wrapper.add_version_regex(mydb, "App", ["[a,b]", "[c-f]"])) print("Get Version Regex", db_wrapper.get_app_version_regex(mydb, "App")) print("Delete Version Regex", db_wrapper.del_app_version_regex(mydb, "App", ["[a,b]"])) print("Get Version Regex - After Deletions", db_wrapper.get_app_version_regex(mydb, "App")) print("Add EXE Regex", db_wrapper.add_exe_regex(mydb, "App", ["[4,2]", "[1-3]"])) print("Delete EXE Regex", db_wrapper.del_app_exe_regex(mydb, "App")) print("Get EXE Regex - After Deletions", db_wrapper.get_app_exe_regex(mydb, "App")) # Test Scripts Tables (Defaults to pre-install scripts) print("\nTest Scripts Tables") print("Get Scripts - Empty", db_wrapper.get_app_scripts(mydb, "latestApp")) print("Add Scripts - Pre", db_wrapper.add_scripts(mydb, "latestApp", ["scr1", "scr2pre", "scr1pre"])) print("Add Scripts - Post", db_wrapper.add_scripts(mydb, "latestApp", ["scr1post", "scr2post", "scr1post"], False)) print("Add Scripts - Post(Names span pre/post)", db_wrapper.add_scripts(mydb, "latestApp", ["scr2post", "scr1"], False)) print("Get Scripts - Pre", db_wrapper.get_app_scripts(mydb, "latestApp")) print("Get Scripts - Post", db_wrapper.get_app_scripts(mydb, "latestApp", False))