Skip to content

Commit

Permalink
jsbeautify removed #40
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte Legenhausen committed Jul 31, 2014
1 parent 8120d49 commit 21261c2
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = function(grunt) {
custom_wrap_options: {
options: {
deps: ['test'],
wrap: 'define( ["angular", "ngResource", "ngCookies"], function() { \n return {%= __ngModule %} \n\n});',
wrap: 'define(["angular", "ngResource", "ngCookies"], function() {\nreturn {%= __ngModule %}\n\n});',
dest: 'tmp/custom_wrap_options.js',
name: 'module2'
},
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ Required

The path where the generated constant module should be saved.

#### options.beautify
Type: `Object|Boolean`
Default value: `{ indent_with_tabs: true }`
Optional

An configuration object for configuring the `js-beautify` module. All options can be found on the [js-beautify](https://github.com/einars/js-beautify) homepage. If you set `beautify` to `false` the beautification will be disabled.

#### options.deps
Type: `Array` or `Boolean`
Default value: `[]`
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
],
"dependencies": {
"lodash": "~2.4.1",
"js-beautify": "^1.4.2",
"tosource": "^0.1.1"
}
}
10 changes: 1 addition & 9 deletions tasks/ngconstant.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var toSource = require('tosource');
var beautify = require('js-beautify').js_beautify;

var MODULE_NAME = 'ngconstant';
var DEFAULT_WRAP = '(function(angular, undefined) {\n\t {%= __ngModule %} \n})(angular);';
var DEFAULT_WRAP = '(function(angular, undefined) {\n{%= __ngModule %}\n})(angular);';
var TEMPLATE_PATH = path.join(__dirname, 'constant.tpl.ejs');
var SERIALIZERS = {
'json': function jsonSerializer(obj) {
Expand Down Expand Up @@ -56,9 +56,6 @@ module.exports = function (grunt) {
wrap: '{%= __ngModule %}',
template: defaultTemplate,
delimiters: MODULE_NAME,
beautify: {
indent_with_tabs: true
},
serializer: 'json',
constants: {},
values: {}
Expand Down Expand Up @@ -105,11 +102,6 @@ module.exports = function (grunt) {
});
}

// Beautify after processing
if (options.beautify) {
result = beautify(result, options.beautify);
}

// Write the module to disk
grunt.log.write('Creating module ' + options.name + ' at ' + options.dest + '...');
grunt.file.write(options.dest, result);
Expand Down
7 changes: 1 addition & 6 deletions test/expected/custom_options.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
angular.module("module2", ["test"])

.constant("constant1", {
"global_key": "global_value",
"key1": 123,
"key2": "value2",
"foobar": false
})
.constant("constant1", {"global_key":"global_value","key1":123,"key2":"value2","foobar":false})

;;
11 changes: 3 additions & 8 deletions test/expected/custom_wrap_options.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
define(["angular", "ngResource", "ngCookies"], function() {
return angular.module("module2", ["test"])
return angular.module("module2", ["test"])

.constant("constant1", {
"global_key": "global_value",
"key1": 123,
"key2": "value2",
"foobar": false
})
.constant("constant1", {"global_key":"global_value","key1":123,"key2":"value2","foobar":false})

;
;

});
10 changes: 2 additions & 8 deletions test/expected/default_options.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
angular.module("module1", [])

.constant("constant1", {
"global_key": "global_value",
"key1": "value1",
"key2": "value2"
})
.constant("constant1", {"global_key":"global_value","key1":"value1","key2":"value2"})

.constant("constant2", undefined)

.value("value1", {
"key1": "value1"
})
.value("value1", {"key1":"value1"})

;;
4 changes: 1 addition & 3 deletions test/expected/global_constants_options.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
angular.module("module1", [])

.constant("constant1", {
"global_key": "overriden_global_value"
})
.constant("constant1", {"global_key":"overriden_global_value"})

;;
6 changes: 1 addition & 5 deletions test/expected/string_constants_options.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
angular.module("stringConstantsOptionsModule", [])

.constant("constant1", {
"global_key": "global_value",
"key1": "value1",
"key2": "value2"
})
.constant("constant1", {"global_key":"global_value","key1":"value1","key2":"value2"})

;;
10 changes: 5 additions & 5 deletions test/expected/template_options.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*jshint -W109*/
define(function(require) {
'use strict';
define(function (require) {
'use strict';

var angular = require('angular');
var angular = require('angular');

angular.module("templateOptionsModule", [])
.constant("constant1", "value1");
angular.module("templateOptionsModule", [])
.constant("constant1", "value1");

});
11 changes: 3 additions & 8 deletions test/expected/wrap_options.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
(function(angular, undefined) {
angular.module("module2", ["test"])
angular.module("module2", ["test"])

.constant("constant1", {
"global_key": "global_value",
"key1": 123,
"key2": "value2",
"foobar": false
})
.constant("constant1", {"global_key":"global_value","key1":123,"key2":"value2","foobar":false})

;
;
})(angular);

0 comments on commit 21261c2

Please sign in to comment.