From 17df7221566eba5b8bffbaadaf542105c2228dd3 Mon Sep 17 00:00:00 2001
From: Jan Mach <jan.mach@cesnet.cz>
Date: Fri, 15 Feb 2019 18:49:07 +0100
Subject: [PATCH] Removed unnecessary tasks and functions from Gruntfile.

There were deprecated deployment related tasks in Gruntfile related to previous package building and deployment mechanism. There are no longer valid and used, so I have removed them to make the file more clear. All package build and deployment related tasks should be moved to master makefile and Grunt should be used only to the stuff related to web interface. So the next task will be to rewrite the Debian package generation into the master makefile. (Redmine issue: #4216,#3387)
---
 Gruntfile.js   | 108 +++++++++----------------------------------------
 gruntconf.json |   9 +----
 2 files changed, 19 insertions(+), 98 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index 43bee360b..b14a612b2 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -93,10 +93,6 @@ module.exports = function(grunt) {
             yarn_install: {
                 command: 'yarn install'
             },
-            // Upgrade Yarn managed packages (web interface frontend packages).
-            yarn_upgrade: {
-                command: 'yarn upgrade'
-            },
             // Clean precompiled Python modules.
             pyclean: {
                 command: 'find lib/ -name *.pyc -delete'
@@ -115,54 +111,10 @@ module.exports = function(grunt) {
                     callback: cbk_dir_size
                 }
             },
-            // Archive previously built DEB packages from build directory.
-            deb_archive: {
-                command: 'pkgs=`find <%= project_paths.deploy_dir %> -maxdepth 1 -name *.deb` && if [ -n "$pkgs" ]; then mv -f <%= project_paths.deploy_dir %>*.deb <%= project_paths.archive_dir %>; fi;'
-            },
             // Build DEB package.
             deb_build: {
                 command: '/usr/bin/fakeroot /usr/bin/dpkg-deb --build <%= project_paths.package_dir %> <%= project_paths.deploy_dir %>' + deb_package_filename()
             },
-            // Duplicate package from deb_package_filename() to deb_package_latest_filename().
-            deb_duplicate: {
-                command: 'cp -f <%= project_paths.deploy_dir %>' + deb_package_filename() + ' <%= project_paths.deploy_dir %>' + deb_package_latest_filename()
-            },
-            // SCP deployment - upload built DEB packages to repository server.
-            deb_scp_upload_repo: {
-                command: '/usr/bin/scp <%= project_paths.deploy_dir %>' + deb_package_filename() + ' <%= meta.pkg_server %>:<%= meta.pkg_location %>/stable'
-            },
-            // SCP deployment - upload built DEB packages to development server.
-            deb_scp_upload_dev: {
-                command: '/usr/bin/scp <%= project_paths.deploy_dir %>' + deb_package_filename() + ' <%= meta.dev_server %>:<%= meta.dev_location %>'
-            },
-            // SCP deployment - upload built DEB packages to demo server.
-            deb_scp_upload_demo: {
-                command: '/usr/bin/scp <%= project_paths.deploy_dir %>' + deb_package_filename() + ' <%= meta.demo_server %>:<%= meta.demo_location %>'
-            },
-            // Refresh DEB repository metadata on repository server.
-            repo_refresh: {
-                command: '/usr/bin/ssh mach@<%= meta.pkg_server %> apt-update mentat'
-            },
-            // Install latest package via APT on production server - step 1.
-            ssh_apt_update_prod: {
-                command: '/usr/bin/ssh root@<%= meta.dep_server %> aptitude update'
-            },
-            // Install latest package via APT on production server - step 2.
-            ssh_apt_install_prod: {
-                command: '/usr/bin/ssh root@<%= meta.dep_server %> aptitude install mentat-ng'
-            },
-            // Install latest package via DPKG on local system.
-            dpkg_install_local: {
-                command: 'sudo dpkg -i <%= project_paths.deploy_dir %>' + deb_package_filename()
-            },
-            // Install latest package via DPKG on development server.
-            dpkg_install_dev: {
-                command: '/usr/bin/ssh root@<%= meta.dev_server %> dpkg -i <%= meta.dev_location %>/' + deb_package_filename()
-            },
-            // Install latest package via DPKG on demo server.
-            dpkg_install_demo: {
-                command: '/usr/bin/ssh root@<%= meta.demo_server %> dpkg -i <%= meta.demo_location %>/' + deb_package_filename()
-            },
         },
 
         // ---------------------------------------------------------------------
@@ -581,48 +533,24 @@ module.exports = function(grunt) {
     // Setup custom task(s).
     // ---------------------------------------------------------------------
 
-    grunt.registerTask('deb-buildbot',
-                       '(RUN) Build Debian packages for Mentat-ng system by Buildbot automation system.',
-                       ['check-version', 'shell:pyclean', 'clean:build', 'shell:deb_archive', 'shell:pybabel_mentat', 'webui', 'copy:deb', 'chmod', 'shell:dir_size', 'template:deb-control', 'shell:deb_build', 'clean:build']
-        );
-    grunt.registerTask('deb-scp-upload',
-                       '(RUN) Upload latest Debian packages to repository server, development server and demo server.',
-                       ['shell:deb_scp_upload_repo', 'shell:repo_refresh', 'shell:deb_scp_upload_dev', 'shell:deb_scp_upload_demo']
-        );
-    grunt.registerTask('deb-ssh-install',
-                       '(RUN) Install latest Debian packages on local system and development and demo servers.',
-                       ['shell:dpkg_install_local', 'shell:dpkg_install_dev', 'shell:dpkg_install_demo']
-        );
-    grunt.registerTask('deb-deploy',
-                       '(RUN) Build Debian packages for Mentat-ng system, upload them to repository, development and demo servers and install them.',
-                       ['deb-build', 'deb-scp-upload', 'deb-ssh-install']
-        );
-    grunt.registerTask('deb-deploy-local',
-                       '(RUN) Build Debian packages for Mentat-ng system and install them on local system.',
-                       ['deb-build', 'shell:dpkg_install_local']
-        );
-    grunt.registerTask('deb-deploy-dev',
-                       '(RUN) Build Debian packages for Mentat-ng system and upload and install them on development server.',
-                       ['deb-build', 'shell:deb_scp_upload_dev', 'shell:dpkg_install_dev']
-        );
-    grunt.registerTask('deb-deploy-demo',
-                       '(RUN) Build Debian packages for Mentat-ng system and upload and install them on demo server.',
-                       ['deb-build', 'shell:deb_scp_upload_demo', 'shell:dpkg_install_demo']
-        );
-    grunt.registerTask('update',
-                       '(RUN) Update internal NPM packages for build suite.',
-                       ['shell:yarn_install', 'shell:yarn_upgrade']
-        );
-    grunt.registerTask('webui',
-                       '(RUN) Build and install web user interface dependencies.',
-                       ['shell:yarn_install', 'shell:pybabel_hawat', 'clean:webui', 'copy:webui', 'comments', 'minify-cldrs']
-        );
-    grunt.registerTask('build',
-                       '(RUN) Build Debian packages for Mentat-ng system.',
-                       ['check-version', 'shell:pyclean', 'clean:build', 'shell:deb_archive', 'shell:pybabel_mentat', 'webui', 'copy:deb', 'chmod', 'shell:dir_size', 'template:deb-control', 'shell:deb_build', 'clean:build']
+    grunt.registerTask(
+        'deb-build',
+        '(RUN) Build Debian packages for Mentat-ng system.',
+        ['check-version', 'shell:pyclean', 'clean:build', 'shell:pybabel_mentat', 'webui', 'copy:deb', 'chmod', 'shell:dir_size', 'template:deb-control', 'shell:deb_build', 'clean:build']
         );
-    grunt.registerTask('default',
-                       '(RUN) Alias for deb-build, only build Debian packages.',
-                       ['deb-build']
+    grunt.registerTask(
+        'deb-buildbot',
+        '(RUN) Build Debian packages for Mentat-ng system by Buildbot automation system.',
+        ['deb-build']
+    );
+    grunt.registerTask(
+        'webui',
+        '(RUN) Build and install web user interface dependencies.',
+        ['shell:yarn_install', 'shell:pybabel_hawat', 'clean:webui', 'copy:webui', 'comments', 'minify-cldrs']
         );
+    grunt.registerTask(
+        'default',
+        '(RUN) Alias for webui.',
+        ['webui']
+    );
 };
diff --git a/gruntconf.json b/gruntconf.json
index eb5ff1429..c9ea8d6ae 100644
--- a/gruntconf.json
+++ b/gruntconf.json
@@ -1,10 +1,3 @@
 {
-    "architecture": "all",
-    "pkg_server": "homeproj",
-    "pkg_location": "/var/reps/apt/certs/incoming",
-    "dev_server": "mentat-dev",
-    "dev_location": "/root",
-    "demo_server": "mentat-demo",
-    "demo_location": "/root",
-    "dep_server": "mentat-hub"
+    "architecture": "all"
 }
-- 
GitLab