You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2014/05/14 07:17:08 UTC
[8/9] AMBARI-5754. Create Slider view entry in Ambari views dropdown.
(srimanth)
http://git-wip-us.apache.org/repos/asf/ambari/blob/7eab2dcd/contrib/views/slider/src/main/resources/ui/generators/view/view.js.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/generators/view/view.js.hbs b/contrib/views/slider/src/main/resources/ui/generators/view/view.js.hbs
new file mode 100755
index 0000000..4c43ecd
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/generators/view/view.js.hbs
@@ -0,0 +1,23 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you 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.
+}}
+
+'use strict';
+
+module.exports = App.{{#camelize}}{{name}}{{/camelize}}View = Ember.View.extend({
+ templateName: '{{name}}'
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7eab2dcd/contrib/views/slider/src/main/resources/ui/karma.conf.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/karma.conf.js b/contrib/views/slider/src/main/resources/ui/karma.conf.js
new file mode 100755
index 0000000..c323a29
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/karma.conf.js
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+'use strict';
+
+// Karma configuration
+// Generated on Fri Sep 06 2013 16:44:32 GMT-0400 (AST)
+
+module.exports = function(config) {
+ config.set({
+
+ // base path, that will be used to resolve files and exclude
+ basePath: '',
+
+
+ // frameworks to use
+ frameworks: ['qunit'],
+
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'public/javascripts/vendor.js',
+ 'public/javascripts/app.js',
+ 'test/helpers.js',
+ 'test/**/*_test.js'
+ ],
+
+
+ // list of files to exclude
+ exclude: [
+
+ ],
+
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
+ reporters: ['progress'],
+
+
+ // web server port
+ port: 9876,
+
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values:
+ // config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN ||
+ // config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+
+ // enable / disable watching file and executing
+ // tests whenever any file changes
+ autoWatch: true,
+
+
+ // Start these browsers, currently available:
+ // - Chrome
+ // - ChromeCanary
+ // - Firefox
+ // - Opera
+ // - Safari (only Mac)
+ // - PhantomJS
+ // - IE (only Windows)
+ browsers: ['PhantomJS'],
+
+
+ // If browser does not capture in given timeout [ms], kill it
+ captureTimeout: 60000,
+
+
+ // Continuous Integration mode
+ // if true, it capture browsers, run tests and exit
+ singleRun: false
+ });
+};
http://git-wip-us.apache.org/repos/asf/ambari/blob/7eab2dcd/contrib/views/slider/src/main/resources/ui/package.json
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/package.json b/contrib/views/slider/src/main/resources/ui/package.json
new file mode 100755
index 0000000..e8efe2e
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/package.json
@@ -0,0 +1,36 @@
+{
+ "author": "Giovanni Collazo",
+ "name": "brunch-with-ember-reloaded",
+ "description": "A new and up-to-date Brunch skeleton for developing Ember applications",
+ "version": "1.2.0",
+ "homepage": "https://github.com/gcollazo/brunch-with-ember-reloaded",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/gcollazo/brunch-with-ember-reloaded.git"
+ },
+ "engines": {
+ "node": "~0.6.10 || 0.8 || 0.9"
+ },
+ "scripts": {
+ "test": "./node_modules/karma/bin/karma start --single-run --browsers PhantomJS",
+ "start": "brunch watch --server",
+ "build": "brunch build",
+ "build:production": "brunch build --production",
+ "update:ember": "node setup.js update:ember",
+ "update:skeleton": "node setup.js update:skeleton"
+ },
+ "dependencies": {
+ "javascript-brunch": "~1.7.0",
+ "css-brunch": "~1.7.0",
+ "stylus-brunch": "~1.7.0",
+ "uglify-js-brunch": "~1.7.0",
+ "clean-css-brunch": "~1.7.0",
+ "auto-reload-brunch": "~1.7.0",
+ "ember-handlebars-brunch": "git://github.com/gcollazo/ember-handlebars-brunch.git#master"
+ },
+ "devDependencies": {
+ "karma": "*",
+ "karma-qunit": "*",
+ "karma-phantomjs-launcher": "~0.1.2"
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7eab2dcd/contrib/views/slider/src/main/resources/ui/setup.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/setup.js b/contrib/views/slider/src/main/resources/ui/setup.js
new file mode 100644
index 0000000..5287233
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/setup.js
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+'use strict';
+
+var command = process.argv[2],
+ exec = require('child_process').exec;
+
+
+var skeletonURL = 'https://codeload.github.com/gcollazo/brunch-with-ember-reloaded/zip/master';
+var fileSources = [
+ {
+ src: 'http://builds.emberjs.com/release/ember.js',
+ dest: 'vendor/scripts/development/ember.js'
+ },
+ {
+ src: 'http://builds.emberjs.com.s3.amazonaws.com/ember-data-latest.js',
+ dest: 'vendor/scripts/development/ember-data.js'
+ },
+ {
+ src: 'http://builds.emberjs.com/release/ember.prod.js',
+ dest: 'vendor/scripts/production/ember.js'
+ },
+ {
+ src: 'http://builds.emberjs.com.s3.amazonaws.com/ember-data-latest.prod.js',
+ dest: 'vendor/scripts/production/ember-data.js'
+ }
+];
+
+
+switch (command) {
+ case 'update:ember':
+ console.log('-> Downloading files...');
+ fileSources.forEach(function(file) {
+ exec('curl ' + file.src + ' > ' + file.dest);
+ });
+ break;
+
+ case 'update:skeleton':
+ exec('curl ' + skeletonURL + '> master.zip', function() {
+ exec('unzip master.zip', function() {
+ exec('cat brunch-with-ember-reloaded-master/config.js > config.js');
+ exec('cat brunch-with-ember-reloaded-master/karma.conf.js > karma.conf.js');
+ exec('cat brunch-with-ember-reloaded-master/package.json > package.json');
+ exec('cat brunch-with-ember-reloaded-master/README.md > README.md');
+ exec('cat brunch-with-ember-reloaded-master/setup.js > setup.js');
+ exec('rm -rf generators', function() {
+ exec('mv brunch-with-ember-reloaded-master/generators/ generators/', function() {
+ exec('rm -rf brunch-with-ember-reloaded-master');
+ exec('rm -r master.zip');
+ });
+ });
+ });
+ });
+ break;
+
+ default:
+ console.log();
+ console.log('Usage:');
+ console.log('\tnpm run update:ember Updates ember.js an ember-data.js');
+ console.log('\tnpm run update:skeleton Updates all skeleton files');
+ console.log();
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7eab2dcd/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js b/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js
new file mode 100755
index 0000000..08e3693
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/test/demo/demo_integration_test.js
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+test("/", function() {
+ visit("/").then(function() {
+ equal(find("h2").text(), "Welcome to Ember.js", "Application header is rendered");
+ equal(find("li").length, 3, "There are three items in the list");
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7eab2dcd/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js b/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js
new file mode 100755
index 0000000..84d2758
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/test/demo/demo_unit_test.js
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+test('this is always true', function() {
+ equal(1, 1, '1 is not 1... ooooh!');
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7eab2dcd/contrib/views/slider/src/main/resources/ui/test/helpers.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/helpers.js b/contrib/views/slider/src/main/resources/ui/test/helpers.js
new file mode 100755
index 0000000..54c9edb
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/test/helpers.js
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+require('initialize');
+
+document.write('<div id="ember-testing"></div>');
+App.rootElement = '#ember-testing';
+App.setupForTesting();
+App.injectTestHelpers();
+
+module('Integration tests', {
+ setup: function() {
+ Ember.run(App, App.advanceReadiness);
+ },
+
+ teardown: function() {
+ App.reset();
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7eab2dcd/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/console-polyfill.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/console-polyfill.js b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/console-polyfill.js
new file mode 100755
index 0000000..615d1f9
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/console-polyfill.js
@@ -0,0 +1,13 @@
+// Console-polyfill. MIT license.
+// https://github.com/paulmillr/console-polyfill
+// Make it safe to do console.log() always.
+(function (con) {
+ var method;
+ var dummy = function() {};
+ var methods = ('assert,count,debug,dir,dirxml,error,exception,group,' +
+ 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,' +
+ 'time,timeEnd,trace,warn').split(',');
+ while (method = methods.pop()) {
+ con[method] = con[method] || dummy;
+ }
+})(window.console = window.console || {});