Author: sboehme
Date: Sun Mar 29 12:57:02 2015
New Revision: 1669906

URL: http://svn.apache.org/r1669906
Log:
SLING-4462 Resource Editor:
o removed 'grunt-contrib-jasmine' as its phantomjs configuration is broken. See 
https://github.com/gruntjs/grunt-contrib-jasmine/issues/156
karma-jasmine via phantomjs is equivalent and good.
o configured the env var 'PHANTOMJS_BIN' for the 'karma-phantomjs-launcher' 
o extracted the static content folder to a variable in the gruntfile
o separated the Karma task in a desktop_build target with Firefox and Chrome 
that can be triggered manually and into a target that will be used be default 
in the build

Modified:
    sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js
    sling/trunk/contrib/explorers/resourceeditor/frontend/package.json
    sling/trunk/contrib/explorers/resourceeditor/pom.xml

Modified: sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js?rev=1669906&r1=1669905&r2=1669906&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js 
(original)
+++ sling/trunk/contrib/explorers/resourceeditor/frontend/Gruntfile.js Sun Mar 
29 12:57:02 2015
@@ -1,5 +1,13 @@
 module.exports = function(grunt) {
+       
+       var staticContentFolder = 
'../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content';
+       
        grunt.initConfig({
+               env : {
+                   build : {
+                       PHANTOMJS_BIN : 
'node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs',
+                   }
+               },
            less: {
              compileCore: {
                options: {
@@ -7,10 +15,10 @@ module.exports = function(grunt) {
                  sourceMap: true,
                  outputSourceFiles: true,
                  sourceMapURL: 'bootstrap.css.map',
-                 sourceMapFilename: 
'../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/css/bootstrap.css.map'
+                 sourceMapFilename: 
staticContentFolder+'/css/bootstrap.css.map'
                },
                src: '../src/main/less/reseditor.less',
-               dest: 
'../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/css/bootstrap.css'
+               dest: staticContentFolder+'/css/bootstrap.css'
              }
            }, 
            watch: {
@@ -33,7 +41,7 @@ module.exports = function(grunt) {
                                  'bootbox/bootbox.min.js',
                                  'jstree/dist/jstree.min.js'
                                 ], // Actual pattern(s) to match.
-                           dest: 
'../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/3rd_party',
   // Destination path prefix.
+                           dest: staticContentFolder+'/js/3rd_party',   // 
Destination path prefix.
                            flatten: true
                          },
                        ],
@@ -48,49 +56,31 @@ module.exports = function(grunt) {
                          'select2/select2.png',
                          'animate.css/animate.min.css',
                         ], // Actual pattern(s) to match.
-                   dest: 
'../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/css/3rd_party',
   // Destination path prefix.
+                   dest: staticContentFolder+'/css/3rd_party',   // 
Destination path prefix.
                    flatten: true
                  },
                ],
              }
            },
-           jasmine: {
-               main: {
-                 src: 
['../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/jquery.min.js',
-                       
'../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/**/*.js'],
-                 options: {
-                   specs: '../src/test/javascript/spec/*spec.js',
-                   helpers: '../src/test/javascript/spec/*Helper.js',
-                   version: '2.2.1',
-                   summary: true
-                 }
-               }
-           },
            karma: {
                options: {
                    runnerPort: 9999,
                    singleRun: true,
-                   browsers: ['PhantomJS'],
-                   plugins : ['karma-jasmine', 'karma-phantomjs-launcher'],
-                   frameworks: ['jasmine']
-               },
-               build: {
+                   browsers: ['Chrome', 'Firefox', 'PhantomJS'],
+                   plugins : ['karma-jasmine', 'karma-phantomjs-launcher', 
'karma-chrome-launcher', 'karma-firefox-launcher', 'karma-ie-launcher'],
+                   frameworks: ['jasmine'],
+                           files: ['../src/test/javascript/spec/*spec.js',
+                                   
staticContentFolder+'/js/3rd_party/jquery.min.js',
+                                   staticContentFolder+'/js/**/*.js'
+                                  ]
+               },  
+               desktop_build: {
                    singleRun: true,
-                   files: [
-                           { src: 
['../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/3rd_party/jquery.min.js']},
-                           { src: ['../src/test/javascript/spec/*spec.js']},
-                           { src: 
['../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/**/*.js']}
-                         ]
+                   browsers: ['Chrome', 'Firefox']
                },
-               local_build: {
+               build: {
                    singleRun: true,
-                   browsers: ['Chrome', 'Firefox', 'PhantomJS'],
-                   plugins : ['karma-jasmine', 'karma-phantomjs-launcher', 
'karma-chrome-launcher', 'karma-firefox-launcher', 'karma-ie-launcher'],
-                   files: [
-                           { src: ['../src/test/javascript/spec/*spec.js']},
-                           { src: 
['../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/3rd_party/jquery.min.js']},
-                           { src: 
['../src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/**/*.js']}
-                         ]
+                   browsers: ['PhantomJS']
                },
                watch: {
                    reporters: 'dots',
@@ -101,9 +91,6 @@ module.exports = function(grunt) {
            },
         webdriver: {
             options: {
-//                desiredCapabilities: {
-//                    browserName: 'chrome'
-//                }
             },
             chrome: {
                 tests: ['../src/test/javascript/e2e/spec/**/*spec.js'],
@@ -129,11 +116,11 @@ module.exports = function(grunt) {
     // These plugins provide necessary tasks.
     require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
 
-//     grunt.registerTask('build', ['less', 'copy', 'jasmine', 'karma:build']);
-       grunt.registerTask('build', ['less', 'copy', 'karma:build']);
+       grunt.registerTask('setup', ['env:build']);
+       grunt.registerTask('build', ['setup', 'less', 'copy', 'karma:build']);
 
        grunt.registerTask('default', ['build']);
        
 
-    grunt.registerTask('local_build', ['less', 'copy', 'karma:local_build', 
'webdriver:chrome', 'webdriver:firefox', 'build']);
+    grunt.registerTask('desktop_build', ['setup', 'less', 'copy', 
'karma:desktop_build', 'webdriver:chrome', 'webdriver:firefox']);
 };
\ No newline at end of file

Modified: sling/trunk/contrib/explorers/resourceeditor/frontend/package.json
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/frontend/package.json?rev=1669906&r1=1669905&r2=1669906&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/frontend/package.json 
(original)
+++ sling/trunk/contrib/explorers/resourceeditor/frontend/package.json Sun Mar 
29 12:57:02 2015
@@ -17,14 +17,13 @@
     "grunt": "0.4.5",
     "load-grunt-tasks": "2.0.0",
     "grunt-cli": "0.1.13",
+    "grunt-env": "0.4.4",
     "grunt-contrib-less": "1.0.0",
     "grunt-contrib-copy": "0.8.0",
     "grunt-contrib-watch": "0.6.1",
-    "jasmine":"2.2.1",
-    "grunt-contrib-jasmine":"0.8.2",
     "grunt-karma": "0.10.1",
-    "karma-phantomjs-launcher": "0.1.2",
     "karma-jasmine": "0.3.5",
+    "karma-phantomjs-launcher": "~0.1.4",
     "karma-chrome-launcher": "0.1.7",
     "karma-firefox-launcher": "0.1.4",
     "karma-ie-launcher": "0.1.5",

Modified: sling/trunk/contrib/explorers/resourceeditor/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/pom.xml?rev=1669906&r1=1669905&r2=1669906&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/pom.xml (original)
+++ sling/trunk/contrib/explorers/resourceeditor/pom.xml Sun Mar 29 12:57:02 
2015
@@ -35,6 +35,9 @@
                        <resource>
                                <directory>src/main/resources</directory>
                        </resource>
+                       <resource>
+                               <directory>src/test/javascript</directory>
+                       </resource>
                </resources>
                <plugins>
                        <plugin>


Reply via email to