Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dwiyatci committed Mar 22, 2016
0 parents commit 8dfb32f
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Created by .ignore support plugin (hsz.mobi)
.idea
node_modules
6 changes: 6 additions & 0 deletions .hg_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repo: ab64366960a6c2ff3f7f03d34fdd856cd59e30d7
node: 87b64cb4450c2ae26e6d1ad5397a6eeaaf1691b3
branch: default
latesttag: null
latesttagdistance: 26
changessincelatesttag: 26
39 changes: 39 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = function (grunt) {
'use strict';

var DEFAULT_HOST = 'developer.cumulocity.com',
DEFAULT_PROTOCOL = 'https',
host = DEFAULT_HOST,
protocol = DEFAULT_PROTOCOL;

if (grunt.option('host')) {
host = grunt.option('host');
}

if (grunt.option('protocol')) {
protocol = grunt.option('protocol');
}

grunt.config('cumulocity.host', host);
grunt.config('cumulocity.protocol', protocol);

grunt.config('paths.root', './');
grunt.config('paths.temp', '.tmp');
grunt.config('paths.build', 'build');
grunt.config('paths.plugins', 'plugins');
grunt.config('paths.bower', 'bower_components');

//Load cumulocity grunt tasks
grunt.loadNpmTasks('grunt-cumulocity-ui-tasks');

grunt.registerTask('server', [
'pluginPreAll',
'connect',
'watch'
]);

grunt.registerTask('build', [
'pluginBuildAll'
]);

};
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2015 Cumulocity GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Boilerplate to create a cumulocity ui plugin

- Get the plugin boilerplate here: https://bitbucket.org/m2m/cumulocity-ui-plugin
- Run *npm install*
- Configure the *cumulocity.json* for application (Select an application name unique in your tenant)
- Register application: *grunt appRegister*
- Configure the *cumulocity.json* for plugin (optional)
- Register plugin: *grunt pluginRegister:<pluginName>* or *grunt pluginRegisterAll*
- Edit the application *cumulocity.json* manifest to include the newly created plugin as an import.
- Re register the application: *grunt appRegister*
- Run local server: *grunt server*
- Open in browser: *http://localhost:8000/apps/<appname>/index.html*
- Code your plugin. Iterate.
- Build your plugin: *grunt build*
- Make sure to re-register if you make changes to manifests: *grunt appRegister*, *grunt pluginRegisterAll*
11 changes: 11 additions & 0 deletions cumulocity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"availability": "PRIVATE",
"contextPath" : "myapplication",
"key" : "myapplication-appkey",
"name" : "My application",
"resourcesUrl": "https://raw.githubusercontent.com/dwiyatci/cumulocity-plugin-helloworld/master/build",
"type" : "HOSTED",
"imports" : [
"core/c8yBranding"
]
}
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name" : "cumulocity-plugin-helloworld",
"version" : "0.0.1",
"dependencies": {
"grunt" : "^0.4.5",
"grunt-contrib-clean" : "^0.5.0",
"grunt-contrib-connect" : "^0.7.1",
"grunt-contrib-copy" : "^0.5.0",
"grunt-contrib-cssmin" : "^0.9.0",
"grunt-contrib-less" : "^0.11.1",
"grunt-contrib-uglify" : "^0.4.0",
"grunt-contrib-watch" : "^0.6.1",
"grunt-angular-templates" : "^0.5.5",
"grunt-cumulocity-ui-tasks": "1.0.3"
}
}
10 changes: 10 additions & 0 deletions plugins/myplugin/cumulocity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name" : "Hello world plugin testing",
"description": "Simple hello world plugin.",
"ngModules" : [
"myapp.helloworld"
],
"js" : [
"index.js"
]
}
28 changes: 28 additions & 0 deletions plugins/myplugin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//Main module name must be defined in ngModules of the plugin manifest
angular.module('myapp.helloworld', []).config(
['c8yNavigatorProvider', 'c8yViewsProvider',
function (c8yNavigatorProvider, c8yViewsProvider) {
'use strict';

c8yNavigatorProvider.addNavigation({
name : 'New plugin',
icon : 'cube',
priority: 100000,
path : 'hello'
});

c8yViewsProvider.when('/hello', {
// Please use this string placeholder where you want to refer you plugin path.
templateUrl: ':::PLUGIN_PATH:::/views/index.html',
controller : 'mh_MainCtrl'
});

}]);

angular.module('myapp.helloworld').controller('mh_MainCtrl',
['$scope', function ($scope) {
'use strict';

$scope.hello = 'Hello world!';

}]);
1 change: 1 addition & 0 deletions plugins/myplugin/views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>{{hello}}</h1>

0 comments on commit 8dfb32f

Please sign in to comment.