├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── generators └── app │ ├── index.js │ └── templates │ ├── cattle │ ├── 0 │ │ ├── docker-compose.yml │ │ └── rancher-compose.yml │ ├── README.md │ └── config.yml │ ├── kubernetes │ ├── 0 │ │ └── rancher-compose.yml │ ├── README.md │ └── config.yml │ ├── mesos │ ├── 0 │ │ ├── docker-compose.yml │ │ └── rancher-compose.yml │ ├── README.md │ └── config.yml │ ├── swarm │ ├── 0 │ │ ├── docker-compose.yml │ │ └── rancher-compose.yml │ ├── README.md │ └── config.yml │ └── yeoman-logo.svg ├── gulpfile.js ├── package.json └── test └── app.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "6" 4 | - "5" 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Slashgear_ (http://slashgear.github.io/) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # generator-rancher-catalog [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] 2 | > Yeoman generator for creating Rancher catalog 3 | 4 | ## Installation 5 | 6 | First, install [Yeoman](http://yeoman.io) and generator-rancher-catalog using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)). 7 | 8 | ```bash 9 | npm install -g yo 10 | npm install -g generator-rancher-catalog 11 | ``` 12 | 13 | Then generate your new project: 14 | 15 | ```bash 16 | yo rancher-catalog 17 | ``` 18 | 19 | Work is in progress, for the moment it only create the skuleton of the catalog entry. 20 | 21 | ## Getting To Know Yeoman 22 | 23 | * Yeoman has a heart of gold. 24 | * Yeoman is a person with feelings and opinions, but is very easy to work with. 25 | * Yeoman can be too opinionated at times but is easily convinced not to be. 26 | * Feel free to [learn more about Yeoman](http://yeoman.io/). 27 | 28 | ## License 29 | 30 | MIT © [Slashgear_](http://slashgear.github.io/) 31 | 32 | 33 | [npm-image]: https://badge.fury.io/js/generator-rancher-catalog.svg 34 | [npm-url]: https://npmjs.org/package/generator-rancher-catalog 35 | [travis-image]: https://travis-ci.org/Slashgear/generator-rancher-catalog.svg?branch=master 36 | [travis-url]: https://travis-ci.org/Slashgear/generator-rancher-catalog 37 | [daviddm-image]: https://david-dm.org/Slashgear/generator-rancher-catalog.svg?theme=shields.io 38 | [daviddm-url]: https://david-dm.org/Slashgear/generator-rancher-catalog 39 | [coveralls-image]: https://coveralls.io/repos/Slashgear/generator-rancher-catalog/badge.svg 40 | [coveralls-url]: https://coveralls.io/r/Slashgear/generator-rancher-catalog 41 | -------------------------------------------------------------------------------- /generators/app/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var yeoman = require('yeoman-generator'); 3 | var chalk = require('chalk'); 4 | var yosay = require('yosay'); 5 | 6 | module.exports = yeoman.Base.extend({ 7 | prompting: function () { 8 | // Have Yeoman greet the user. 9 | this.log(yosay( 10 | 'Welcome to the good ' + chalk.red('generator-rancher-catalog') + ' generator!' 11 | )); 12 | 13 | var prompts = [{ 14 | type: 'input', 15 | name: 'name', 16 | message: 'What is the name of the catalog entry?', 17 | default: this.appname 18 | }, { 19 | type: 'checkbox', 20 | name: 'clusterTypes', 21 | choices: [ 22 | { 23 | name: 'Cattle', 24 | value: 'cattle', 25 | checked: true 26 | }, 27 | { 28 | name: 'Swarm', 29 | value: 'swarm' 30 | }, 31 | { 32 | name: 'Kubernetes', 33 | value: 'kubernetes' 34 | }, 35 | { 36 | name: 'Mesos', 37 | value: 'mesos' 38 | } 39 | ], 40 | message: 'What are the cluster management types?' 41 | }]; 42 | 43 | return this.prompt(prompts).then(function (props) { 44 | // To access props later use this.props.someAnswer; 45 | this.props = props; 46 | }.bind(this)); 47 | }, 48 | 49 | writing: function () { 50 | this.spawnCommandSync('git', ['init']); 51 | this.props.clusterTypes.forEach(name => { 52 | const prefix = name === 'cattle' ? '' : `${name}-`; 53 | this.fs.copy( 54 | this.templatePath(`${name}`), 55 | this.destinationPath(`${prefix}templates/${this.props.name}`) 56 | ); 57 | this.fs.copy( 58 | this.templatePath('yeoman-logo.svg'), 59 | this.destinationPath(`${prefix}templates/${this.props.name}/catalogIcon-${this.props.name}.svg`) 60 | ); 61 | }); 62 | } 63 | }); 64 | -------------------------------------------------------------------------------- /generators/app/templates/cattle/0/docker-compose.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slashgear/generator-rancher-catalog/c4698198b5c30b3b5f889981f111ac7159060f3e/generators/app/templates/cattle/0/docker-compose.yml -------------------------------------------------------------------------------- /generators/app/templates/cattle/0/rancher-compose.yml: -------------------------------------------------------------------------------- 1 | .catalog: 2 | name: # Name of the versioned template of the Catalog Entry 3 | version: # Version of the versioned template of the Catalog Entry 4 | description: # Description of the versioned template of the Catalog Entry 5 | uuid: # Unique identifier to be used for upgrades. Please see note. 6 | minimum_rancher_version: # The minimum version of Rancher that supports the template 7 | questions: #Used to request user input for configuration options 8 | -------------------------------------------------------------------------------- /generators/app/templates/cattle/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slashgear/generator-rancher-catalog/c4698198b5c30b3b5f889981f111ac7159060f3e/generators/app/templates/cattle/README.md -------------------------------------------------------------------------------- /generators/app/templates/cattle/config.yml: -------------------------------------------------------------------------------- 1 | name: # Name of the Catalog Entry 2 | description: | 3 | # Description of the Catalog Entry 4 | version: # Version of the Catalog to be used 5 | category: # Category to be used for searching catalog entries 6 | maintainer: # The maintainer of the catalog entry 7 | license: # The license 8 | projectURL: # A URL related to the catalog entry 9 | -------------------------------------------------------------------------------- /generators/app/templates/kubernetes/0/rancher-compose.yml: -------------------------------------------------------------------------------- 1 | .catalog: 2 | name: # Name of the versioned template of the Catalog Entry 3 | version: # Version of the versioned template of the Catalog Entry 4 | description: # Description of the versioned template of the Catalog Entry 5 | uuid: # Unique identifier to be used for upgrades. Please see note. 6 | minimum_rancher_version: # The minimum version of Rancher that supports the template 7 | questions: #Used to request user input for configuration options 8 | -------------------------------------------------------------------------------- /generators/app/templates/kubernetes/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slashgear/generator-rancher-catalog/c4698198b5c30b3b5f889981f111ac7159060f3e/generators/app/templates/kubernetes/README.md -------------------------------------------------------------------------------- /generators/app/templates/kubernetes/config.yml: -------------------------------------------------------------------------------- 1 | name: # Name of the Catalog Entry 2 | description: | 3 | # Description of the Catalog Entry 4 | version: # Version of the Catalog to be used 5 | category: # Category to be used for searching catalog entries 6 | maintainer: # The maintainer of the catalog entry 7 | license: # The license 8 | projectURL: # A URL related to the catalog entry 9 | -------------------------------------------------------------------------------- /generators/app/templates/mesos/0/docker-compose.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slashgear/generator-rancher-catalog/c4698198b5c30b3b5f889981f111ac7159060f3e/generators/app/templates/mesos/0/docker-compose.yml -------------------------------------------------------------------------------- /generators/app/templates/mesos/0/rancher-compose.yml: -------------------------------------------------------------------------------- 1 | .catalog: 2 | name: # Name of the versioned template of the Catalog Entry 3 | version: # Version of the versioned template of the Catalog Entry 4 | description: # Description of the versioned template of the Catalog Entry 5 | uuid: # Unique identifier to be used for upgrades. Please see note. 6 | minimum_rancher_version: # The minimum version of Rancher that supports the template 7 | questions: #Used to request user input for configuration options 8 | -------------------------------------------------------------------------------- /generators/app/templates/mesos/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slashgear/generator-rancher-catalog/c4698198b5c30b3b5f889981f111ac7159060f3e/generators/app/templates/mesos/README.md -------------------------------------------------------------------------------- /generators/app/templates/mesos/config.yml: -------------------------------------------------------------------------------- 1 | name: # Name of the Catalog Entry 2 | description: | 3 | # Description of the Catalog Entry 4 | version: # Version of the Catalog to be used 5 | category: # Category to be used for searching catalog entries 6 | maintainer: # The maintainer of the catalog entry 7 | license: # The license 8 | projectURL: # A URL related to the catalog entry 9 | -------------------------------------------------------------------------------- /generators/app/templates/swarm/0/docker-compose.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slashgear/generator-rancher-catalog/c4698198b5c30b3b5f889981f111ac7159060f3e/generators/app/templates/swarm/0/docker-compose.yml -------------------------------------------------------------------------------- /generators/app/templates/swarm/0/rancher-compose.yml: -------------------------------------------------------------------------------- 1 | .catalog: 2 | name: # Name of the versioned template of the Catalog Entry 3 | version: # Version of the versioned template of the Catalog Entry 4 | description: # Description of the versioned template of the Catalog Entry 5 | uuid: # Unique identifier to be used for upgrades. Please see note. 6 | minimum_rancher_version: # The minimum version of Rancher that supports the template 7 | questions: #Used to request user input for configuration options 8 | -------------------------------------------------------------------------------- /generators/app/templates/swarm/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slashgear/generator-rancher-catalog/c4698198b5c30b3b5f889981f111ac7159060f3e/generators/app/templates/swarm/README.md -------------------------------------------------------------------------------- /generators/app/templates/swarm/config.yml: -------------------------------------------------------------------------------- 1 | name: # Name of the Catalog Entry 2 | description: | 3 | # Description of the Catalog Entry 4 | version: # Version of the Catalog to be used 5 | category: # Category to be used for searching catalog entries 6 | maintainer: # The maintainer of the catalog entry 7 | license: # The license 8 | projectURL: # A URL related to the catalog entry 9 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var path = require('path'); 3 | var gulp = require('gulp'); 4 | var eslint = require('gulp-eslint'); 5 | var excludeGitignore = require('gulp-exclude-gitignore'); 6 | var mocha = require('gulp-mocha'); 7 | var istanbul = require('gulp-istanbul'); 8 | var nsp = require('gulp-nsp'); 9 | var plumber = require('gulp-plumber'); 10 | var coveralls = require('gulp-coveralls'); 11 | 12 | gulp.task('static', function () { 13 | return gulp.src('**/*.js') 14 | .pipe(excludeGitignore()) 15 | .pipe(eslint()) 16 | .pipe(eslint.format()) 17 | .pipe(eslint.failAfterError()); 18 | }); 19 | 20 | gulp.task('nsp', function (cb) { 21 | nsp({package: path.resolve('package.json')}, cb); 22 | }); 23 | 24 | gulp.task('pre-test', function () { 25 | return gulp.src('generators/**/*.js') 26 | .pipe(excludeGitignore()) 27 | .pipe(istanbul({ 28 | includeUntested: true 29 | })) 30 | .pipe(istanbul.hookRequire()); 31 | }); 32 | 33 | gulp.task('test', ['pre-test'], function (cb) { 34 | var mochaErr; 35 | 36 | gulp.src('test/**/*.js') 37 | .pipe(plumber()) 38 | .pipe(mocha({reporter: 'spec'})) 39 | .on('error', function (err) { 40 | mochaErr = err; 41 | }) 42 | .pipe(istanbul.writeReports()) 43 | .on('end', function () { 44 | cb(mochaErr); 45 | }); 46 | }); 47 | 48 | gulp.task('watch', function () { 49 | gulp.watch(['generators/**/*.js', 'test/**'], ['test']); 50 | }); 51 | 52 | gulp.task('coveralls', ['test'], function () { 53 | if (!process.env.CI) { 54 | return; 55 | } 56 | 57 | return gulp.src(path.join(__dirname, 'coverage/lcov.info')) 58 | .pipe(coveralls()); 59 | }); 60 | 61 | gulp.task('prepublish', ['nsp']); 62 | gulp.task('default', ['static', 'test', 'coveralls']); 63 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-rancher-catalog", 3 | "version": "1.1.2", 4 | "description": "Yeoman generator for creating Rancher catalog Entry", 5 | "homepage": "https://github.com/Slashgear/generator-rancher-catalog", 6 | "author": { 7 | "name": "Slashgear_", 8 | "email": "antoine395.caron@gmail.com", 9 | "url": "http://slashgear.github.io/" 10 | }, 11 | "files": [ 12 | "generators" 13 | ], 14 | "main": "generators/index.js", 15 | "keywords": [ 16 | "yeoman-generator", 17 | "rancher" 18 | ], 19 | "dependencies": { 20 | "yeoman-generator": "^0.24.1", 21 | "chalk": "^1.0.0", 22 | "yosay": "^1.0.0" 23 | }, 24 | "devDependencies": { 25 | "yeoman-test": "^1.0.0", 26 | "yeoman-assert": "^2.0.0", 27 | "eslint": "^3.2.2", 28 | "eslint-config-xo-space": "^0.14.0", 29 | "gulp": "^3.9.0", 30 | "gulp-eslint": "^2.0.0", 31 | "gulp-exclude-gitignore": "^1.0.0", 32 | "gulp-line-ending-corrector": "^1.0.1", 33 | "gulp-istanbul": "^1.0.0", 34 | "gulp-mocha": "^3.0.0", 35 | "gulp-plumber": "^1.0.0", 36 | "gulp-nsp": "^2.1.0", 37 | "gulp-coveralls": "^0.1.0" 38 | }, 39 | "eslintConfig": { 40 | "extends": "xo-space", 41 | "env": { 42 | "mocha": true 43 | } 44 | }, 45 | "repository": "Slashgear/generator-rancher-catalog", 46 | "scripts": { 47 | "prepublish": "gulp prepublish", 48 | "test": "gulp" 49 | }, 50 | "license": "MIT" 51 | } 52 | -------------------------------------------------------------------------------- /test/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var path = require('path'); 3 | var assert = require('yeoman-assert'); 4 | var helpers = require('yeoman-test'); 5 | 6 | describe('generator-rancher-catalog:app', function () { 7 | const clusterTypes = ['swarm', 'mesos', 'kubernetes', 'cattle']; 8 | const name = 'test'; 9 | before(function () { 10 | return helpers.run(path.join(__dirname, '../generators/app')) 11 | .withPrompts({ 12 | name: name, 13 | clusterTypes: clusterTypes 14 | }) 15 | .toPromise(); 16 | }); 17 | 18 | it('init git repository', function () { 19 | assert.file([ 20 | '.git' 21 | ]); 22 | }); 23 | 24 | it('init cluster template directory', function () { 25 | console.log(clusterTypes); 26 | clusterTypes.forEach(function (it) { 27 | const prefix = it === 'cattle' ? '' : `${it}-`; 28 | assert.file([ 29 | `${prefix}templates/${name}/0/rancher-compose.yml`, 30 | `${prefix}templates/${name}/config.yml`, 31 | `${prefix}templates/${name}/README.md`, 32 | `${prefix}templates/${name}/catalogIcon-${name}.svg` 33 | ]); 34 | if (it !== 'kubernetes') { 35 | assert.file([ 36 | `${prefix}templates/${name}/0/docker-compose.yml` 37 | ]); 38 | } 39 | }); 40 | }); 41 | }); 42 | --------------------------------------------------------------------------------