1. Pedro Ferreira
  2. 2048_game

Commits

Pedro Ferreira  committed 68e295f

- add create_release script (for the website)

  • Participants
  • Parent commits dd15de8
  • Branches default
  • Tags v1.0.0

Comments (0)

Files changed (4)

File create_release/copy_files_config.txt

View file
  • Ignore whitespace
+{
+    "resultingFolder": "2048_game",
+    "basePath": "..",
+    "files":
+        [
+            "css/",
+            "libraries/",
+            "manifest.json"
+        ]
+}

File create_release/create_server_template.py

View file
  • Ignore whitespace
+# python3
+
+import os.path
+import argparse
+import sys
+
+sys.path.append( 'C:/Users/drk/Dropbox/projects/' )
+
+
+import create_release_script.create_server_template as create_server_template
+
+
+    # relative paths
+default_indexPath = '../index.html'
+default_appName = '2048_game'
+default_copyToPath = 'C:/Users/drk/Dropbox/projects/website/templates/{}/'.format( default_appName )
+
+
+def go( indexPath= default_indexPath,
+        appName= default_appName,
+        copyToPath= default_copyToPath,
+        templateName= None ):
+
+    indexPath = os.path.realpath( indexPath )
+    copyToPath = os.path.realpath( copyToPath )
+
+    create_server_template.go( indexPath, appName, copyToPath, templateName )
+
+
+
+if __name__ == '__main__':
+
+    parser = argparse.ArgumentParser( description= 'Create the server template.' )
+
+    parser.add_argument( 'indexPath', nargs= '?', default= default_indexPath )
+    parser.add_argument( 'appName', nargs= '?', default= default_appName )
+    parser.add_argument( 'copyToPath', nargs= '?', default= default_copyToPath )
+
+    args = parser.parse_args()
+
+    go( args.indexPath, args.appName, args.copyToPath )

File create_release/main.py

View file
  • Ignore whitespace
+# python3
+
+import argparse
+import sys
+import os.path
+
+sys.path.append( 'C:/Users/drk/Dropbox/projects/' )
+
+import create_release_script.main as main
+
+
+    # relative paths
+default_htmlFile = "../index.html"
+default_concatenateConfig = "concatenate_config.txt"
+default_copyFilesConfig = "copy_files_config.txt"
+default_resultingFolder = "2048_game"
+
+
+def go( htmlFile= default_htmlFile,
+        copyFilesConfig= default_copyFilesConfig,
+        concatenateConfig= default_concatenateConfig,
+        resultingFolder= default_resultingFolder ):
+
+        # absolute paths
+    htmlFile = os.path.realpath( htmlFile )
+    copyFilesConfig = os.path.realpath( copyFilesConfig )
+    concatenateConfig = os.path.realpath( concatenateConfig )
+    resultingFolder = os.path.realpath( resultingFolder )
+
+    baseDirectory = os.path.realpath( '' )
+
+
+    main.go( htmlFile, copyFilesConfig, concatenateConfig, resultingFolder, baseDirectory )
+
+
+    
+
+if __name__ == '__main__':    
+
+    parser = argparse.ArgumentParser( description= 'Generate the release files of the program.' )
+
+    parser.add_argument( 'htmlFile', help= 'Path to the index.html.', nargs= '?', default= default_htmlFile )
+    parser.add_argument( 'copyFilesConfig', help= 'Path to the configuration file that tells which files to copy.', nargs= '?', default= default_copyFilesConfig )
+    parser.add_argument( 'concatenateConfig', help= 'Path to the configuration file to tell which files to concatenate (and the order).', nargs= '?', default= default_concatenateConfig )
+    parser.add_argument( 'resultingFolder', help= "Name of the folder that is created in the current path and contains the copies.", nargs= "?", default= default_resultingFolder )
+
+
+    args = parser.parse_args()
+
+    go( args.htmlFile, args.copyFilesConfig, args.concatenateConfig, args.resultingFolder )

File index.html

View file
  • Ignore whitespace
     <script type="text/javascript" src="libraries/easeljs-0.7.1.min.js"></script>
     <script type="text/javascript" src="libraries/tweenjs-0.5.1.min.js"></script>
 
+    <!-- CONCATENATE_START -->
     <script type="text/javascript" src="scripts/utilities.js"></script>
     <script type="text/javascript" src="scripts/block.js"></script>
     <script type="text/javascript" src="scripts/game_menu.js"></script>
     <script type="text/javascript" src="scripts/game.js"></script>
     <script type="text/javascript" src="scripts/main.js"></script>
-
+    <!-- CONCATENATE_END -->
 
     <link rel="stylesheet" href="libraries/css/flick/jquery-ui-1.10.4.custom.min.css" />