diff --git a/dist/hawkular-ui-service.js b/dist/hawkular-ui-service.js index 9bb5500..51f4b5c 100644 --- a/dist/hawkular-ui-service.js +++ b/dist/hawkular-ui-service.js @@ -1,20 +1,25 @@ -/// +/// Copyright 2014-2015 Red Hat, Inc. and/or its affiliates +/// and other contributors as indicated by the @author tags. +/// +/// Licensed 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. var hawkularRest; (function (hawkularRest) { hawkularRest._module = angular.module('hawkular.services', ['ngResource']); })(hawkularRest || (hawkularRest = {})); -/** - * @ngdoc provider - * @name hawkular.rest.HawkularAlert - * @description - * # HawkularAlert - * Provider in the hawkular.rest. - */ var hawkularRest; (function (hawkularRest) { hawkularRest._module.provider('HawkularAlert', function () { - // time (in ms) the notifications are shown this.host = 'localhost'; this.port = 8080; this.setHost = function (host) { @@ -171,17 +176,9 @@ var hawkularRest; }); })(hawkularRest || (hawkularRest = {})); -/** - * @ngdoc provider - * @name hawkular.rest.HawkularInventory - * @description - * # HawkularInventory - * Provider in the hawkular.rest. - */ var hawkularRest; (function (hawkularRest) { hawkularRest._module.provider('HawkularInventory', function () { - // time (in ms) the notifications are shown this.host = 'localhost'; this.port = 8080; this.setHost = function (host) { @@ -213,17 +210,9 @@ var hawkularRest; }); })(hawkularRest || (hawkularRest = {})); -/** - * @ngdoc provider - * @name hawkular.rest.HawkularMetric - * @description - * # HawkularRest - * Provider in the hawkular.rest. - */ var hawkularRest; (function (hawkularRest) { hawkularRest._module.provider('HawkularMetric', function () { - // time (in ms) the notifications are shown this.host = 'localhost'; this.port = 8080; this.setHost = function (host) { diff --git a/dist/hawkular-ui-service.min.js b/dist/hawkular-ui-service.min.js new file mode 100644 index 0000000..6b5b8f9 --- /dev/null +++ b/dist/hawkular-ui-service.min.js @@ -0,0 +1 @@ +var hawkularRest;!function(t){t._module=angular.module("hawkular.services",["ngResource"])}(hawkularRest||(hawkularRest={}));var hawkularRest;!function(t){t._module.provider("HawkularAlert",function(){this.host="localhost",this.port=8080,this.setHost=function(t){return this.host=t,this},this.setPort=function(t){return this.port=t,this},this.$get=["$resource",function(t){var r="http://"+this.host+":"+this.port,i={};return i.Alert=t(r+"/hawkular/alerts",{},{reload:{method:"GET",url:r+"/hawkular/alerts/reload"}}),i.Trigger=t(r+"/hawkular/alerts/triggers/:triggerId",{triggerId:"@triggerId"},{save:{method:"POST",url:r+"/hawkular/alerts/triggers/"},put:{method:"PUT"},conditions:{method:"GET",url:r+"/hawkular/alerts/triggers/:triggerId/conditions",isArray:!0,params:{triggerId:"@triggerId"}}}),i.Dampening=t(r+"/hawkular/alerts/trigger/dampening/:triggerId",{triggerId:"@triggerId"},{save:{method:"POST",url:r+"/hawkular/alerts/trigger/dampening/"},put:{method:"PUT"}}),i.AvailabilityCondition=t(r+"/hawkular/alerts/conditions/availability/:conditionId",{conditionId:"@conditionId"},{put:{method:"PUT"},trigger:{method:"GET",url:r+"/hawkular/alerts/conditions/availability/trigger/:triggerId",isArray:!0,params:{triggerId:"@triggerId"}}}),i.CompareCondition=t(r+"/hawkular/alerts/conditions/compare/:conditionId",{conditionId:"@conditionId"},{put:{method:"PUT"},trigger:{method:"GET",url:r+"/hawkular/alerts/conditions/compare/trigger/:triggerId",isArray:!0,params:{triggerId:"@triggerId"}}}),i.StringCondition=t(r+"/hawkular/alerts/conditions/string/:conditionId",{conditionId:"@conditionId"},{put:{method:"PUT"},trigger:{method:"GET",url:r+"/hawkular/alerts/conditions/string/trigger/:triggerId",isArray:!0,params:{triggerId:"@triggerId"}}}),i.ThresholdCondition=t(r+"/hawkular/alerts/conditions/threshold/:conditionId",{conditionId:"@conditionId"},{put:{method:"PUT"},trigger:{method:"GET",url:r+"/hawkular/alerts/conditions/threshold/trigger/:triggerId",isArray:!0,params:{triggerId:"@triggerId"}}}),i.ThresholdRangeCondition=t(r+"/hawkular/alerts/conditions/range/:conditionId",{conditionId:"@conditionId"},{put:{method:"PUT"},trigger:{method:"GET",url:r+"/hawkular/alerts/conditions/range/trigger/:triggerId",isArray:!0,params:{triggerId:"@triggerId"}}}),i.NotifierType=t(r+"/hawkular/alerts/notifierType/:notifierType",{notifierType:"@notifierType"},{get:{method:"GET",isArray:!0}}),i.Notifier=t(r+"/hawkular/alerts/notifiers/:notifierId",{notifierId:"@notifierId"},{put:{method:"PUT",url:r+"/hawkular/alerts/notifiers/:notifierId",params:{notifierId:"@notifierId"}},notifierType:{method:"GET",isArray:!0,url:r+"/hawkular/alerts/notifiers/type/:notifierType",params:{notifierType:"@notifierType"}}}),i}]})}(hawkularRest||(hawkularRest={}));var hawkularRest;!function(t){t._module.provider("HawkularInventory",function(){this.host="localhost",this.port=8080,this.setHost=function(t){return this.host=t,this},this.setPort=function(t){return this.port=t,this},this.$get=["$resource",function(t){var r="http://"+this.host+":"+this.port,i={};return i.Resource=t(r+"/hawkular/inventory/:tenantId/resources/:resourceId",{tenantId:"@tenantId",resourceId:"@resourceId"}),i.Metric=t(r+"/hawkular/inventory/:tenantId/resources/:resourceId/metrics/:metricId",{tenantId:"@tenantId",resourceId:"@resourceId",metricId:"@metricId"},{put:{method:"PUT"}}),i}]})}(hawkularRest||(hawkularRest={}));var hawkularRest;!function(t){t._module.provider("HawkularMetric",function(){this.host="localhost",this.port=8080,this.setHost=function(t){return this.host=t,this},this.setPort=function(t){return this.port=t,this},this.$get=["$resource",function(t){var r="http://"+this.host+":"+this.port,i="/rhq-metrics",e=r+i,a={};return a.Tenant=t(e+"/tenants",{}),a.Metric=t(e+"/:tenantId/metrics",{tenantId:"@tenantId"},{queryNum:{method:"GET",isArray:!0,params:{type:"num"}},queryAvail:{method:"GET",isArray:!0,params:{type:"avail"}},queryLog:{method:"GET",isArray:!0,params:{type:"log"}}}),a.NumericMetric=t(e+"/:tenantId/metrics/numeric",{tenantId:"@tenantId"}),a.NumericMetricData=t(e+"/:tenantId/metrics/numeric/:numericId/data",{tenantId:"@tenantId",numericId:"@numericId"},{queryMetrics:{method:"GET",isArray:!1,params:{type:"num"}},queryMetricsTimeRange:{method:"GET",isArray:!1,params:{type:"num",buckets:60,start:"@startTimestamp",end:"@endTimestamp"}}}),a.NumericMetricMeta=t(e+"/:tenantId/metrics/numeric/:numericId/meta",{tenantId:"@tenantId",numericId:"@numericId"},{update:"PUT"}),a.NumericMetricMultiple=t(e+"/:tenantId/metrics/numeric/data",{tenantId:"@tenantId",numericId:"@numericId"}),a.AvailabilityMetric=t(e+"/:tenantId/metrics/availability",{tenantId:"@tenantId"}),a.AvailabilityMetricData=t(e+"/:tenantId/metrics/availability/:availabilityId/data",{tenantId:"@tenantId",availabilityId:"@availabilityId"}),a.AvailabilityMetricMultiple=t(e+"/:tenantId/metrics/availability/data",{tenantId:"@tenantId"}),a}]})}(hawkularRest||(hawkularRest={})); \ No newline at end of file diff --git a/gulp/scripts.js b/gulp/scripts.js index 84ea954..0f6b221 100644 --- a/gulp/scripts.js +++ b/gulp/scripts.js @@ -1,7 +1,7 @@ 'use strict'; var gulp = require('gulp'), - tslint = require('gulp-tslint'); + tslintRules = require('../tslint.json'); var paths = gulp.paths; @@ -11,18 +11,29 @@ var $ = require('gulp-load-plugins')({ gulp.task('tslint', function () { gulp.src([paths.src + '/hawkRest.ts', paths.src + '/hawkRest-*.ts']) - .pipe(tslint()) - .pipe(tslint.report('verbose')); + .pipe($.tslint({ + rulesDirectory: './tslint-rules/' + })) + .pipe($.tslint.report('verbose')); }); gulp.task('scripts', function () { + + var license = tslintRules.rules['license-header'][1]; + return gulp.src([paths.src + '/hawkRest.ts', paths.src + '/hawkRest-*.ts']) - .pipe($.typescript()) + .pipe($.typescript({ + removeComments: true + })) .on('error', function handleError(err) { console.error(err.toString()); this.emit('end'); }) .pipe($.concat('hawkular-ui-service.js')) + .pipe($.header(license)) + .pipe(gulp.dest(paths.dist + '/')) + .pipe($.concat('hawkular-ui-service.min.js')) + .pipe($.uglify()) .pipe(gulp.dest(paths.dist + '/')); }); diff --git a/package.json b/package.json index b27ca9a..f1bff40 100644 --- a/package.json +++ b/package.json @@ -3,20 +3,22 @@ "version": "0.0.0", "dependencies": {}, "devDependencies": { + "chalk": "~0.5.1", + "del": "~0.1.3", "gulp": "~3.8.10", - "gulp-autoprefixer": "~2.0.0", "gulp-angular-templatecache": "~1.4.2", - "del": "~0.1.3", + "gulp-autoprefixer": "~2.0.0", "gulp-concat": "2.4.2", - "gulp-load-plugins": "~0.7.1", + "gulp-header": "1.2.2", "gulp-karma": "~0.0.4", + "gulp-load-plugins": "~0.7.1", + "gulp-tslint": "1.4.3", "gulp-typescript": "~2.3.0", - "gulp-tslint": "1.4.2", - "wiredep": "~2.2.0", + "gulp-uglify": "1.1.0", "karma-jasmine": "~0.3.1", "karma-phantomjs-launcher": "~0.1.4", "require-dir": "~0.1.0", - "chalk": "~0.5.1" + "wiredep": "~2.2.0" }, "engines": { "node": ">=0.10.0" diff --git a/src/rest/hawkRest-alert-provider.ts b/src/rest/hawkRest-alert-provider.ts index 7842c5c..5afe6a9 100644 --- a/src/rest/hawkRest-alert-provider.ts +++ b/src/rest/hawkRest-alert-provider.ts @@ -1,3 +1,18 @@ +/// Copyright 2014-2015 Red Hat, Inc. and/or its affiliates +/// and other contributors as indicated by the @author tags. +/// +/// Licensed 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. + /** * @ngdoc provider * @name hawkular.rest.HawkularAlert diff --git a/src/rest/hawkRest-inventory-provider.ts b/src/rest/hawkRest-inventory-provider.ts index 044f5b9..ecf6cfd 100644 --- a/src/rest/hawkRest-inventory-provider.ts +++ b/src/rest/hawkRest-inventory-provider.ts @@ -1,3 +1,18 @@ +/// Copyright 2014-2015 Red Hat, Inc. and/or its affiliates +/// and other contributors as indicated by the @author tags. +/// +/// Licensed 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. + /** * @ngdoc provider * @name hawkular.rest.HawkularInventory diff --git a/src/rest/hawkRest-metric-factory.ts b/src/rest/hawkRest-metric-factory.ts index 4fd70ec..bc70557 100644 --- a/src/rest/hawkRest-metric-factory.ts +++ b/src/rest/hawkRest-metric-factory.ts @@ -1,3 +1,18 @@ +/// Copyright 2014-2015 Red Hat, Inc. and/or its affiliates +/// and other contributors as indicated by the @author tags. +/// +/// Licensed 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. + /** * @ngdoc provider * @name hawkular.rest.HawkularMetric diff --git a/src/rest/hawkRest.ts b/src/rest/hawkRest.ts index 07b05d6..a0619cd 100644 --- a/src/rest/hawkRest.ts +++ b/src/rest/hawkRest.ts @@ -1,3 +1,18 @@ +/// Copyright 2014-2015 Red Hat, Inc. and/or its affiliates +/// and other contributors as indicated by the @author tags. +/// +/// Licensed 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 hawkularRest { diff --git a/tslint-rules/licenseHeaderRule.js b/tslint-rules/licenseHeaderRule.js new file mode 100644 index 0000000..0e18d33 --- /dev/null +++ b/tslint-rules/licenseHeaderRule.js @@ -0,0 +1,28 @@ +function Rule() { + Lint.Rules.AbstractRule.apply(this, arguments); +} + +Rule.prototype = Object.create(Lint.Rules.AbstractRule.prototype); +Rule.prototype.apply = function(sourceFile) { + return this.applyWithWalker(new LicenseHeaderWalker(sourceFile, this.getOptions())); +}; + +function LicenseHeaderWalker() { + Lint.RuleWalker.apply(this, arguments); +} + +LicenseHeaderWalker.prototype = Object.create(Lint.RuleWalker.prototype); +LicenseHeaderWalker.prototype.visitSourceFile = function (node) { + // create a failure at the current position + var sourceText = this.getSourceFile().text; + + var licenceHeader = this.getOptions()[0]; + + if ( sourceText.indexOf(licenceHeader) !== 0 ){ + this.addFailure(this.createFailure(0, 0, "Missing or incorrect project license header.")); + } + + Lint.RuleWalker.prototype.visitSourceFile.call(this, node); +}; + +exports.Rule = Rule; diff --git a/tslint.json b/tslint.json index b600ce4..b01d1f3 100644 --- a/tslint.json +++ b/tslint.json @@ -11,19 +11,15 @@ "no-arg": true, "no-bitwise": true, "no-console": [true, - "debug", - "info", - "time", - "timeEnd", - "trace" + "trace" ], "no-construct": true, - "no-debugger": true, + "no-debugger": false, "no-duplicate-key": true, "no-duplicate-variable": true, "no-empty": true, "no-eval": true, - "no-string-literal": true, + "no-string-literal": false, "no-switch-case-fall-through": true, "no-trailing-comma": true, "_no-trailing-whitespace": true, @@ -32,22 +28,25 @@ "no-unreachable": true, "no-use-before-declare": true, "one-line": [true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" ], "_quotemark": [true, "double"], "radix": true, "semicolon": true, "triple-equals": [true, "allow-null-check"], "variable-name": false, - "whitespace": [true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "_check-type" + "whitespace": [false, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "_check-type" + ], + "license-header": [ true, + "/// Copyright 2014-2015 Red Hat, Inc. and/or its affiliates\n/// and other contributors as indicated by the @author tags.\n///\n/// Licensed under the Apache License, Version 2.0 (the \"License\");\n/// you may not use this file except in compliance with the License.\n/// You may obtain a copy of the License at\n///\n/// http://www.apache.org/licenses/LICENSE-2.0\n///\n/// Unless required by applicable law or agreed to in writing, software\n/// distributed under the License is distributed on an \"AS IS\" BASIS,\n/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n/// See the License for the specific language governing permissions and\n/// limitations under the License.\n" ] } }