This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new e1d431b  Add grunt task to ensure ruby/compass is installed for TP. 
(#4799)
e1d431b is described below

commit e1d431b13455f5f0a57dc25c4a477a8accc9bd37
Author: Steve Hamrick <[email protected]>
AuthorDate: Fri Jun 19 12:18:08 2020 -0600

    Add grunt task to ensure ruby/compass is installed for TP. (#4799)
    
    * Add grunt task to ensure ruby/compass is installed.
    
    * Cleanup and dont commit lock file as the versioning is platform specific
    
    * Add end line
    
    * Collapse task
---
 docs/source/development/traffic_portal.rst | 17 +++++++++--------
 traffic_portal/.gitignore                  |  1 +
 traffic_portal/{.gitignore => Gemfile}     | 12 +++++-------
 traffic_portal/Gruntfile.js                |  1 +
 traffic_portal/grunt/run.js                | 25 +++++++++++++++++++++++++
 traffic_portal/package-lock.json           |  9 +++++++++
 traffic_portal/package.json                |  1 +
 7 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/docs/source/development/traffic_portal.rst 
b/docs/source/development/traffic_portal.rst
index f79f4a1..5f3e5a3 100644
--- a/docs/source/development/traffic_portal.rst
+++ b/docs/source/development/traffic_portal.rst
@@ -44,20 +44,21 @@ Installing The Traffic Portal Developer Environment
 #. Navigate to the ``traffic_portal`` subdirectory of your cloned repository.
 #. Run ``npm install`` to install application dependencies into 
``traffic_portal/node_modules``. Only needs to be done the first time unless 
``traffic_portal/package.json`` changes.
 #. Run ``bower install`` to install client-side dependencies into 
``traffic_portal/app/bower_components``. Only needs to be done the first time 
unless ``traffic_portal/bower.json`` changes.
-#. Make sure that compass is installed and functioning correctly by running 
``compass version``. If ``compass`` is not running, you can install it on macOS 
as follows:
+#. Make sure that compass is installed and functioning correctly by running 
``compass version``. If compass is not available, then it can be installed 
using ``gem``'s manually, or using ``bundle``
 
-    #. macOS comes with its own version of ruby built into it. In order to 
install compass, if you run a command like ``sudo gem install compass``, it 
will take the default ruby available in mac.
+    .. tip:: Bundle will automitcally install the correct version of the gems
 
-       In order to properly install ``compass``, here is what you should be 
doing:
-
-    #. ``brew install ruby``
+    #. ``brew install ruby``/``apt-get install ruby``/``yum install ruby``
 
     #. ``gem update --system``
 
-    #. ``gem install compass``
+    #. At this point, you can either manually install the gems or use bundler
+
+       #. For manually: ``gem install sass compass``
+
+       #. For automatically: ``gem install bundle && bundle install``
 
-        .. tip:: You need to install ``sass`` before you install ``compass``. 
You can do that by running:
-                 ``gem install sass``
+       .. note:: Bundle requires ruby versions > 2.3.0, so if you're using a 
version of ruby < 2.3.0 then this will not work.
 
     #. Make sure that ``compass`` and ``sass`` are part of your ``PATH`` 
environment variable.
 
diff --git a/traffic_portal/.gitignore b/traffic_portal/.gitignore
index 6ce8753..a2b70c0 100644
--- a/traffic_portal/.gitignore
+++ b/traffic_portal/.gitignore
@@ -21,3 +21,4 @@ server/log/access.log
 node_modules
 app/bower_components
 app/dist
+Gemfile.lock
diff --git a/traffic_portal/.gitignore b/traffic_portal/Gemfile
similarity index 90%
copy from traffic_portal/.gitignore
copy to traffic_portal/Gemfile
index 6ce8753..aa18cea 100644
--- a/traffic_portal/.gitignore
+++ b/traffic_portal/Gemfile
@@ -14,10 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#
-.tmp
-.sass-cache
-server/log/access.log
-node_modules
-app/bower_components
-app/dist
+
+source 'https://rubygems.org'
+
+ruby ">= 2.0.0"
+gem "compass", ">= 1.0.0"
diff --git a/traffic_portal/Gruntfile.js b/traffic_portal/Gruntfile.js
index ac0314b..c0ba893 100644
--- a/traffic_portal/Gruntfile.js
+++ b/traffic_portal/Gruntfile.js
@@ -74,6 +74,7 @@ module.exports = function (grunt) {
     ]);
 
     grunt.registerTask('build-css-dev', [
+        'run:which_ruby',
         'compass:dev'
     ]);
 
diff --git a/traffic_portal/grunt/run.js b/traffic_portal/grunt/run.js
new file mode 100644
index 0000000..35598c5
--- /dev/null
+++ b/traffic_portal/grunt/run.js
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+module.exports = {
+    which_ruby: {
+        cmd: "which",
+        args: ["ruby", "compass"]
+    },
+};
diff --git a/traffic_portal/package-lock.json b/traffic_portal/package-lock.json
index 982bfbe..bb3507c 100644
--- a/traffic_portal/package-lock.json
+++ b/traffic_portal/package-lock.json
@@ -2804,6 +2804,15 @@
         "rimraf": "^2.5.2"
       }
     },
+    "grunt-run": {
+      "version": "0.8.1",
+      "resolved": "https://registry.npmjs.org/grunt-run/-/grunt-run-0.8.1.tgz";,
+      "integrity": 
"sha512-+wvoOJevugcjMLldbVCyspRHHntwVIJiTGjx0HFq+UwXhVPe7AaAiUdY4135CS68pAoRLhd7pAILpL2ITe1tmA==",
+      "dev": true,
+      "requires": {
+        "strip-ansi": "^3.0.0"
+      }
+    },
     "grunt-string-replace": {
       "version": "1.3.1",
       "resolved": 
"https://registry.npmjs.org/grunt-string-replace/-/grunt-string-replace-1.3.1.tgz";,
diff --git a/traffic_portal/package.json b/traffic_portal/package.json
index 30d6876..fa69bad 100644
--- a/traffic_portal/package.json
+++ b/traffic_portal/package.json
@@ -21,6 +21,7 @@
     "grunt-html2js": "0.7.1",
     "grunt-install-dependencies": "0.2.0",
     "grunt-newer": "1.3.0",
+    "grunt-run": "^0.8.1",
     "grunt-string-replace": "1.3.1",
     "grunt-usemin": "3.1.1",
     "grunt-wiredep": "3.0.1",

Reply via email to