incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [2/3] git commit: version assets for caching
Date Tue, 17 Jun 2014 11:30:31 GMT
version assets for caching

Signed-off-by: Chris Rohr <rohr.chris@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/fb34028c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/fb34028c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/fb34028c

Branch: refs/heads/apache-blur-0.2
Commit: fb34028c5e074bfde4ed1f8807b1887aa63a0195
Parents: a121a90
Author: Andrew Avenoso <andrew.va@gmail.com>
Authored: Thu Jun 12 23:54:32 2014 -0400
Committer: Chris Rohr <rohr.chris@gmail.com>
Committed: Tue Jun 17 07:30:22 2014 -0400

----------------------------------------------------------------------
 contrib/blur-console/src/assemble/bin.xml       |  24 +----
 contrib/blur-console/src/main/webapp/.gitignore |   3 +-
 .../blur-console/src/main/webapp/Gruntfile.js   | 103 ++++++++++++++-----
 contrib/blur-console/src/main/webapp/index.html |   4 +-
 .../blur-console/src/main/webapp/package.json   |   4 +-
 .../src/main/webapp/sass/blurconsole.scss       |   2 +-
 pom.xml                                         |   5 +-
 7 files changed, 89 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb34028c/contrib/blur-console/src/assemble/bin.xml
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/assemble/bin.xml b/contrib/blur-console/src/assemble/bin.xml
index 6e3c3ee..d5aadc5 100644
--- a/contrib/blur-console/src/assemble/bin.xml
+++ b/contrib/blur-console/src/assemble/bin.xml
@@ -58,30 +58,8 @@ under the License.
       <outputDirectory></outputDirectory>
     </fileSet>
     <fileSet>
-      <directory>src/main/webapp</directory>
+      <directory>src/main/webapp/public</directory>
       <outputDirectory>webapp</outputDirectory>
-      <!-- Remove unneccessary web files -->
-      <includes>
-          <include>css/**</include>
-          <include>img/**</include>
-          <include>js/**</include>
-          <include>libs/flot/jquery.flot.js</include>
-          <include>libs/flot/jquery.flot.pie.js</include>
-          <include>libs/flot/jquery.flot.categories.js</include>
-          <include>libs/flot/jquery.flot.stack.js</include>
-          <include>libs/jquery/dist/jquery.js</include>
-          <include>libs/modernizr/modernizr.js</include>
-          <include>libs/twbs-bootstrap-sass/vendor/assets/fonts/bootstrap/**</include>
-          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/tooltip.js</include>
-          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/modal.js</include>
-          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/transition.js</include>
-          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/popover.js</include>
-          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/collapse.js</include>
-          <include>libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/tab.js</include>
-          <include>libs/typeahead.js/dist/typeahead.jquery.js</include>
-          <include>views/**</include>
-          <include>index.html</include>
-      </includes>
     </fileSet>
   </fileSets>
 </assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb34028c/contrib/blur-console/src/main/webapp/.gitignore
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/.gitignore b/contrib/blur-console/src/main/webapp/.gitignore
index 0a63380..80661cd 100644
--- a/contrib/blur-console/src/main/webapp/.gitignore
+++ b/contrib/blur-console/src/main/webapp/.gitignore
@@ -1,8 +1,7 @@
 build/
 libs/*
-css/*
 jsc/*
-script
+public/*
 test/reports
 .tmp
 .sass-cache

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb34028c/contrib/blur-console/src/main/webapp/Gruntfile.js
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/Gruntfile.js b/contrib/blur-console/src/main/webapp/Gruntfile.js
index 18e60ca..d19322c 100644
--- a/contrib/blur-console/src/main/webapp/Gruntfile.js
+++ b/contrib/blur-console/src/main/webapp/Gruntfile.js
@@ -28,12 +28,30 @@ module.exports = function (grunt) {
     // Time how long tasks take. Can help when optimizing build times
     require('time-grunt')(grunt);
 
+    var all_js_files = [
+        'libs/jquery/dist/jquery.js',
+        'js/utils/*\.js',
+        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/tooltip.js',
+        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/modal.js',
+        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/transition.js',
+        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/popover.js',
+        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/collapse.js',
+        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/tab.js',
+        'libs/flot/jquery.flot.js',
+        'libs/flot/jquery.flot.pie.js',
+        'libs/flot/jquery.flot.categories.js',
+        'libs/flot/jquery.flot.stack.js',
+        'libs/typeahead.js/dist/typeahead.jquery.js',
+        'js/blurconsole.js',
+        'js/*\.js'
+    ];
+
     // Define the configuration for all the tasks
     grunt.initConfig({
         pkg: grunt.file.readJSON('package.json'),
         banner: grunt.file.read('banner'),
 
-        clean: ['css'],
+        clean: ['public'],
 
         bower: {
             install: {
@@ -63,12 +81,12 @@ module.exports = function (grunt) {
             },
             development: {
                 files: {
-                    'css/blurconsole.css': 'sass/blurconsole.scss'
+                    'public/css/blurconsole.css': 'sass/blurconsole.scss'
                 }
             },
             production: {
                 files: {
-                    'css/blurconsole.css': 'sass/blurconsole.scss'
+                    'public/css/blurconsole.css': 'sass/blurconsole.scss'
                 },
                 options: {
                     style: 'compressed'
@@ -87,23 +105,7 @@ module.exports = function (grunt) {
                     }
                 },
                 files: {
-                    'script/ugly.js': [
-                        'libs/jquery/dist/jquery.js',
-                        'js/utils/*\.js',
-                        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/tooltip.js',
-                        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/modal.js',
-                        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/transition.js',
-                        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/popover.js',
-                        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/collapse.js',
-                        'libs/twbs-bootstrap-sass/vendor/assets/javascripts/bootstrap/tab.js',
-                        'libs/flot/jquery.flot.js',
-                        'libs/flot/jquery.flot.pie.js',
-                        'libs/flot/jquery.flot.categories.js',
-                        'libs/flot/jquery.flot.stack.js',
-                        'libs/typeahead.js/dist/typeahead.jquery.js',
-                        'js/blurconsole.js',
-                        'js/*\.js'
-                    ]
+                    'public/js/blurconsole.js': all_js_files
                 }
             }
         },
@@ -136,11 +138,15 @@ module.exports = function (grunt) {
             },
             css: {
                 files: ['sass/**/*.scss', 'libs/**/*.css', 'libs/**/*.scss'],
-                tasks: ['sass:development', 'notify:css']
+                tasks: ['sass:development', 'version-assets-css-map', 'version-assets-css',
'notify:css']
             },
             js: {
                 files: ['js/**/*.js'],
-                tasks: ['jshint:development', 'combine:js', 'uglify:js']
+                tasks: ['jshint:development', 'uglify:js', 'version-assets-js-map', 'version-assets-js']
+            },
+            html: {
+                files: ['index.html', 'views/*.html'],
+                tasks: ['copy:main', 'version-assets']
             },
             livereload: {
                 options: {
@@ -193,7 +199,8 @@ module.exports = function (grunt) {
                 port: 3000,
                 livereload: 4000,
                 // Change this to '0.0.0.0' to access the server from outside
-                hostname: '0.0.0.0'
+                hostname: '0.0.0.0',
+                base: 'public'
             },
             livereload: {
                 options: {
@@ -201,6 +208,16 @@ module.exports = function (grunt) {
                 }
             }
         },
+
+        copy: {
+            main: {
+                files: [
+                    {expand: true, src: ['index.html','img/*','views/*'], dest: 'public/'},
+                    {expand: true, flatten: true, src: ['libs/modernizr/modernizr.js'], dest:
'public/js'},
+                    {expand: true, flatten: true, src: ['libs/twbs-bootstrap-sass/vendor/assets/fonts/bootstrap/*'],
dest: 'public/css'}
+                ]
+            }
+        }
     });
 
     grunt.loadNpmTasks('grunt-bower-task');
@@ -213,6 +230,7 @@ module.exports = function (grunt) {
     grunt.loadNpmTasks('grunt-mocha-selenium');
     grunt.loadNpmTasks('grunt-karma');
     grunt.loadNpmTasks('grunt-contrib-uglify');
+    grunt.loadNpmTasks('grunt-contrib-copy');
 
     var initialHintSrc = grunt.config('jshint.development.src');
     grunt.event.on('watch', function(action, filepath){
@@ -227,8 +245,41 @@ module.exports = function (grunt) {
     grunt.registerTask('test:unit', 'Run JavaScript Unit Tests', ['karma']);
     grunt.registerTask('test:style', 'Run JavaScript CodeStyle reports', ['jshint:ci'/*,
'plato:ci' */]);
     grunt.registerTask('style:development', 'Run JavaScript CodeStyle reports', ['jshint:development']);
-    grunt.registerTask('development', 'Build for development', ['sass:development', 'uglify:js']);
-    grunt.registerTask('production', 'Build for production', ['sass:production', 'uglify:js']);
-    grunt.registerTask('serve', 'Run development server', ['clean','sass:development', 'uglify:js',
'connect:livereload','watch']);
+    grunt.registerTask('development', 'Build for development', ['clean', 'sass:development',
'uglify:js', 'copy:main', 'version-assets']);
+    grunt.registerTask('production', 'Build for production', ['clean', 'sass:production',
'uglify:js', 'copy:main', 'version-assets']);
+    grunt.registerTask('serve', 'Run development server', ['clean','development', 'connect:livereload','watch']);
     grunt.registerTask('default', ['clean', 'style:development', 'development', 'watch']);
+    grunt.registerTask('version-assets-css-map', function() {
+        var Version = require("node-version-assets");
+        var versionInstance = new Version({
+            assets: ['public/css/blurconsole.css.map'],
+            grepFiles: ['public/css/blurconsole.css']
+        });
+        versionInstance.run(this.async());
+    });
+    grunt.registerTask('version-assets-js-map', function() {
+        var Version = require("node-version-assets");
+        var versionInstance = new Version({
+            assets: ['public/js/blurconsole.js.map'],
+            grepFiles: ['public/js/blurconsole.js']
+        });
+        versionInstance.run(this.async());
+    });
+    grunt.registerTask('version-assets-js', function() {
+        var Version = require("node-version-assets");
+        var versionInstance = new Version({
+            assets: ['public/js/blurconsole.js'],
+            grepFiles: ['public/index.html']
+        });
+        versionInstance.run(this.async());
+    });
+    grunt.registerTask('version-assets-css', function() {
+        var Version = require("node-version-assets");
+        var versionInstance = new Version({
+            assets: ['public/css/blurconsole.css'],
+            grepFiles: ['public/index.html']
+        });
+        versionInstance.run(this.async());
+    });
+    grunt.registerTask('version-assets', 'version the static assets just created', ['version-assets-js-map',
'version-assets-js', 'version-assets-css-map', 'version-assets-css']);
 };

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb34028c/contrib/blur-console/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/index.html b/contrib/blur-console/src/main/webapp/index.html
index b36686e..e1f521f 100644
--- a/contrib/blur-console/src/main/webapp/index.html
+++ b/contrib/blur-console/src/main/webapp/index.html
@@ -30,7 +30,7 @@ under the License.
         <meta name="description" content="System Monitor and Console for Blur">
         <meta name="viewport" content="width=device-width">
         <link rel="stylesheet" href="css/blurconsole.css">
-        <script src="libs/modernizr/modernizr.js"></script>
+        <script src="js/modernizr.js"></script>
 
     </head>
     <body>
@@ -60,7 +60,7 @@ under the License.
             </ul>
         </nav>
         <div id="blurconsole"></div>
-        <script src="script/ugly.js"></script>
+        <script src="js/blurconsole.js"></script>
         <script type="text/javascript">
             $(function () { blurconsole.initModule( $('#blurconsole') ); });
         </script>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb34028c/contrib/blur-console/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/package.json b/contrib/blur-console/src/main/webapp/package.json
index 58235aa..f534dfa 100644
--- a/contrib/blur-console/src/main/webapp/package.json
+++ b/contrib/blur-console/src/main/webapp/package.json
@@ -33,7 +33,9 @@
     "karma-script-launcher": "~0.1.0",
     "load-grunt-tasks": "~0.2.0",
     "time-grunt": "~0.2.0",
-    "grunt-contrib-connect": "~0.5.0"
+    "grunt-contrib-connect": "~0.5.0",
+    "node-version-assets": "~0.2.0",
+    "grunt-contrib-copy": "~0.5.0"
   },
   "scripts": {
     "test": "karma start --single-run"

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb34028c/contrib/blur-console/src/main/webapp/sass/blurconsole.scss
----------------------------------------------------------------------
diff --git a/contrib/blur-console/src/main/webapp/sass/blurconsole.scss b/contrib/blur-console/src/main/webapp/sass/blurconsole.scss
index 7996945..797d17b 100644
--- a/contrib/blur-console/src/main/webapp/sass/blurconsole.scss
+++ b/contrib/blur-console/src/main/webapp/sass/blurconsole.scss
@@ -18,7 +18,7 @@ specific language governing permissions and limitations
 under the License.
  */
 
-$icon-font-path: "../libs/twbs-bootstrap-sass/vendor/assets/fonts/bootstrap/";
+$icon-font-path: "";
 
 @import 'twbs-bootstrap-sass/vendor/assets/stylesheets/bootstrap';
 @import 'colors';

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fb34028c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6b9ffdd..ea97058 100644
--- a/pom.xml
+++ b/pom.xml
@@ -248,7 +248,10 @@ under the License.
 						<!-- exclude>contrib/blur-console/src/main/webapp/test/bower_components/**</exclude
-->
 
 						<!-- JS Libraries that could not be included through bower -->
-						<exclude>**/src/main/webapp/js/utils/**</exclude>
+						<exclude>**/src/main/webapp/js/utils/*</exclude>
+						<exclude>**/src/main/webapp/public/js/modernizr.js</exclude>
+						<exclude>**/src/main/webapp/public/css/*.map</exclude>
+						<exclude>**/src/main/webapp/public/css/glyphicons*</exclude>
 	
 						<!-- Files used for building the UI -->
 						<exclude>**/src/main/webapp/node_modules/**</exclude>


Mime
View raw message