Skip to content
Browse files

Add grunt tasks for jshint and jasmine. Refactor and move package.jso…

…n, replace existing with config.json. Add Travis-CI support.
  • Loading branch information...
1 parent 8e43cd8 commit 67a97c2457b1b7d696fc4436da31d144d14294c8 @jasonsanjose jasonsanjose committed Jan 24, 2013
Showing with 255 additions and 3 deletions.
  1. +3 −1 .gitignore
  2. +75 −0 .jshintrc
  3. +5 −0 .travis.yml
  4. +108 −0 Gruntfile.js
  5. +30 −0 package.json
  6. +31 −0 src/brackets.config.json
  7. +1 −0 src/config.json
  8. +2 −2 src/utils/Global.js
View
4 .gitignore
@@ -1,5 +1,6 @@
Thumbs.db
node_modules
+npm-debug.log
src/brackets.css
src/brackets.min.css
@@ -14,4 +15,5 @@ src/extensions/disabled
.DS_Store
# unit test working directory
-test/temp
+test/temp
+test/results
View
75 .jshintrc
@@ -0,0 +1,75 @@
+{
+ "bitwise" : true,
+ "curly" : true,
+ "eqeqeq" : true,
+ "forin" : true,
+ "immed" : true,
+ "latedef" : true,
+ "newcap" : true,
+ "noarg" : true,
+ "noempty" : true,
+ "nonew" : true,
+ "plusplus" : true,
+ "regexp" : true,
+ "undef" : true,
+ "strict" : true,
+ "trailing" : false,
+
+ "asi" : false,
+ "boss" : false,
+ "debug" : false,
+ "eqnull" : false,
+ "es5" : false,
+ "esnext" : false,
+ "evil" : false,
+ "expr" : false,
+ "funcscope" : false,
+ "globalstrict" : false,
+ "iterator" : false,
+ "lastsemic" : false,
+ "laxbreak" : false,
+ "laxcomma" : false,
+ "loopfunc" : false,
+ "multistr" : false,
+ "onecase" : false,
+ "proto" : false,
+ "regexdash" : false,
+ "scripturl" : false,
+ "smarttabs" : false,
+ "shadow" : false,
+ "sub" : false,
+ "supernew" : false,
+ "validthis" : false,
+
+ "browser" : true,
+ "couch" : false,
+ "devel" : false,
+ "dojo" : false,
+ "jquery" : false,
+ "mootools" : false,
+ "node" : false,
+ "nonstandard" : false,
+ "prototypejs" : false,
+ "rhino" : false,
+ "wsh" : false,
+
+ "nomen" : false,
+ "onevar" : false,
+ "passfail" : false,
+ "white" : false,
+
+ "maxerr" : 100,
+ "predef" : [
+ ],
+ "indent" : 4,
+ "globals" : [
+ "require",
+ "define",
+ "brackets",
+ "$",
+ "PathUtils",
+ "window",
+ "navigator",
+ "Mustache"
+ ]
+}
View
5 .travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - 0.8
+before_script:
+ - npm install -g grunt-cli
View
108 Gruntfile.js
@@ -0,0 +1,108 @@
+module.exports = function(grunt) {
+ 'use strict';
+
+ // Project configuration.
+ grunt.initConfig({
+ meta : {
+ src : [
+ 'src/**/*.js',
+ '!src/thirdparty/**',
+ '!src/widgets/bootstrap-*.js',
+ '!src/extensions/**/unittest-files/**/*.js',
+ '!src/**/*-min.js',
+ '!src/**/*.min.js'
+ ],
+ test : [
+ 'test/**/*.js',
+ '!test/perf/*-files/**/*.js',
+ '!test/spec/*-files/**/*.js',
+ '!test/smokes/**',
+ '!test/temp/**',
+ '!test/thirdparty/**'
+ ],
+ /* specs that can run in phantom.js */
+ specs : [
+ 'test/spec/CommandManager-test.js',
+ 'test/spec/PreferencesManager-test.js',
+ 'test/spec/ViewUtils-test.js'
+ ]
+ },
+ watch: {
+ test : {
+ files: ['Gruntfile.js','<%= meta.src %>','<%= meta.test %>'],
+ tasks: 'test'
+ }
+ },
+ /* FIXME (jasonsanjose): how to handle extension tests */
+ jasmine : {
+ src : 'undefined.js', /* trick the default runner to run without importing src files */
+ options : {
+ junit : {
+ path: 'test/results',
+ consolidate: true
+ },
+ specs : '<%= meta.specs %>',
+ vendor : [
+ 'src/thirdparty/jquery-1.7.js',
+ 'src/thirdparty/CodeMirror2/lib/codemirror.js',
+ 'src/thirdparty/CodeMirror2/lib/util/dialog.js',
+ 'src/thirdparty/CodeMirror2/lib/util/searchcursor.js',
+ 'src/thirdparty/mustache/mustache.js'
+ ],
+ template : require('grunt-template-jasmine-requirejs'),
+ templateOptions: {
+ requireConfig : {
+ baseUrl: 'src',
+ paths: {
+ 'test' : '../test',
+ 'perf' : '../test/perf',
+ 'spec' : '../test/spec',
+ 'text' : 'thirdparty/text',
+ 'i18n' : 'thirdparty/i18n'
+ }
+ }
+ }
+ }
+ },
+ jshint: {
+ all: [
+ 'Gruntfile.js',
+ '<%= meta.src %>',
+ '<%= meta.test %>'
+ ],
+ /* use strict options to mimic JSLINT until we migrate to JSHINT in Brackets */
+ options: {
+ jshintrc: '.jshintrc'
+ }
+ }
+ });
+
+ // load dependencies
+ grunt.loadNpmTasks('grunt-contrib-jasmine');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-watch');
+
+ // task: install
+ grunt.registerTask('install', ['write-config']);
+
+ // task: write-config
+ // merge package.json and src/brackets.config.json into src/config.json
+ grunt.registerTask('write-config', function () {
+ var packageJSON = grunt.file.readJSON("package.json"),
+ appConfigJSON = grunt.file.readJSON("src/brackets.config.json");
+
+ Object.keys(packageJSON).forEach(function (key) {
+ if (appConfigJSON[key] === undefined) {
+ appConfigJSON[key] = packageJSON[key];
+ }
+ });
+
+ grunt.file.write("src/config.json", JSON.stringify(appConfigJSON));
+ });
+
+ // task: test
+ grunt.registerTask('test', ['jshint', 'jasmine']);
+
+ // Default task.
+ grunt.registerTask('default', ['test']);
+};
View
30 package.json
@@ -0,0 +1,30 @@
+{
+ "name" : "Brackets",
+ "version" : "0.20.0-0",
+ "homepage" : "http://brackets.io",
+ "issues" :
+ {
+ "url" : "http://github.com/jasonsanjose/brackets/issues"
+ },
+ "repository" :
+ {
+ "type" : "git",
+ "url" : "https://github.com/jasonsanjose/brackets.git",
+ "branch" : "",
+ "SHA" : ""
+ },
+ "devDependencies" :
+ {
+ "grunt" : ">=0.4.0rc5",
+ "grunt-contrib-jshint" : "git://github.com/gruntjs/grunt-contrib-jshint.git#master",
+ "grunt-contrib-watch" : ">=0.2.0rc5",
+ "grunt-contrib-jasmine" : "git://github.com/gruntjs/grunt-contrib-jasmine.git#master",
+ "grunt-template-jasmine-requirejs" : ">=0.1.0",
+ "socket.io" : ">=0.9.13"
+ },
+ "scripts" :
+ {
+ "install" : "grunt install",
+ "test" : "grunt test"
+ }
+}
View
31 src/brackets.config.json
@@ -0,0 +1,31 @@
+{
+ "name" : "Brackets",
+ "homepage" : "http://brackets.io",
+ "issues" :
+ {
+ "url" : "http://github.com/adobe/brackets/issues"
+ },
+ "repository" :
+ {
+ "type" : "git",
+ "url" : "https://github.com/adobe/brackets.git",
+ "branch" : "",
+ "SHA" : ""
+ },
+ "config" :
+ {
+ "app_title" : "Brackets",
+ "app_name_about" : "Brackets",
+ "about_icon" : "styles/images/brackets_icon.svg",
+ "show_debug_menu" : true,
+ "enable_jslint" : true,
+ "update_info_url" : "http://dev.brackets.io/updates/stable/",
+ "how_to_use_url" : "https://github.com/adobe/brackets/wiki/How-to-Use-Brackets",
+ "forum_url" : "https://groups.google.com/forum/?fromgroups#!forum/brackets-dev",
+ "release_notes_url" : "https://github.com/adobe/brackets/wiki/Release-Notes",
+ "report_issue_url" : "https://github.com/adobe/brackets/wiki/How-to-Report-an-Issue",
+ "twitter_url" : "https://twitter.com/brackets",
+ "troubleshoot_url" : "https://github.com/adobe/brackets/wiki/Troubleshooting#wiki-livedev",
+ "twitter_name" : "@brackets"
+ }
+}
View
1 src/config.json
@@ -0,0 +1 @@
+{"name":"Brackets","homepage":"http://brackets.io","issues":{"url":"http://github.com/adobe/brackets/issues"},"repository":{"type":"git","url":"https://github.com/adobe/brackets.git","branch":"","SHA":""},"config":{"app_title":"Brackets","app_name_about":"Brackets","about_icon":"styles/images/brackets_icon.svg","show_debug_menu":true,"enable_jslint":true,"update_info_url":"http://dev.brackets.io/updates/stable/","how_to_use_url":"https://github.com/adobe/brackets/wiki/How-to-Use-Brackets","forum_url":"https://groups.google.com/forum/?fromgroups#!forum/brackets-dev","release_notes_url":"https://github.com/adobe/brackets/wiki/Release-Notes","report_issue_url":"https://github.com/adobe/brackets/wiki/How-to-Report-an-Issue","twitter_url":"https://twitter.com/brackets","troubleshoot_url":"https://github.com/adobe/brackets/wiki/Troubleshooting#wiki-livedev","twitter_name":"@brackets"},"version":"0.20.0-0","devDependencies":{"grunt":">=0.4.0rc5","grunt-contrib-jshint":"git://github.com/gruntjs/grunt-contrib-jshint.git#master","grunt-contrib-watch":">=0.2.0rc5","grunt-contrib-jasmine":"git://github.com/gruntjs/grunt-contrib-jasmine.git#master","grunt-template-jasmine-requirejs":">=0.1.0","socket.io":">=0.9.13"},"scripts":{"install":"grunt install","test":"grunt test"}}
View
4 src/utils/Global.js
@@ -34,7 +34,7 @@
define(function (require, exports, module) {
"use strict";
- var packageJSON = require("text!package.json");
+ var configJSON = require("text!config.json");
// Define core brackets namespace if it isn't already defined
//
@@ -52,7 +52,7 @@ define(function (require, exports, module) {
// Parse src/config.json
try {
- global.brackets.metadata = JSON.parse(packageJSON);
+ global.brackets.metadata = JSON.parse(configJSON);
global.brackets.config = global.brackets.metadata.config;
} catch (err) {
console.log(err);

0 comments on commit 67a97c2

Please sign in to comment.
Something went wrong with that request. Please try again.