Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit (0.1.0)

  • Loading branch information...
commit 58637fa0064c3bd2add85f5205a6c8f4412b8a55 1 parent 9b94572
@eduludi authored
View
13 .editorconfig
@@ -0,0 +1,13 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
View
1  .gitattributes
@@ -0,0 +1 @@
+* text=auto
View
2  .gitignore
@@ -0,0 +1,2 @@
+node_modules/
+temp/
View
21 .jshintrc
@@ -0,0 +1,21 @@
+{
+ "node": true,
+ "esnext": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "indent": 4,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "quotmark": "single",
+ "regexp": true,
+ "undef": true,
+ "unused": true,
+ "strict": true,
+ "trailing": true,
+ "smarttabs": true,
+ "white": true
+}
View
4 .travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - '0.8'
+ - '0.10'
View
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright 2013 Eduardo Ludi
+
+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.
View
46 README.md
@@ -1,4 +1,48 @@
generator-lqm
=============
-An Lungo-Quo-Monocle MVC app generator for Yeoman
+An Lungo-Quo-Monocle MVC app generator for [Yeoman](http://yeoman.io).
+
+
+## Getting Started
+
+### What is Yeoman?
+
+Trick question. It's not a thing. It's this guy:
+
+![](http://i.imgur.com/JHaAlBJ.png)
+
+Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.
+
+Not every new computer comes with a Yeoman pre-installed. He lives in the [npm](https://npmjs.org) package repository. You only have to ask for him once, then he packs up and moves into your hard drive. *Make sure you clean up, he likes new and shiny things.*
+
+```
+$ npm install -g yo
+```
+
+### Yeoman Generators
+
+Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.
+
+To install generator-lqm from npm, run:
+
+```
+$ npm install -g generator-lqm
+```
+
+Finally, initiate the generator:
+
+```
+$ yo lqm
+```
+
+### Getting To Know Yeoman
+
+Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.
+
+If you'd like to get to know Yeoman better and meet some of his friends, [Grunt](http://gruntjs.com) and [Bower](http://bower.io), check out the complete [Getting Started Guide](https://github.com/yeoman/yeoman/wiki/Getting-Started).
+
+
+## License
+
+[MIT License](http://en.wikipedia.org/wiki/MIT_License)
View
62 app/index.js
@@ -0,0 +1,62 @@
+'use strict';
+var util = require('util');
+var path = require('path');
+var yeoman = require('yeoman-generator');
+
+
+var LqmGenerator = module.exports = function LqmGenerator(args, options, config) {
+ yeoman.generators.Base.apply(this, arguments);
+
+ this.on('end', function () {
+ this.installDependencies({ skipInstall: options['skip-install'] });
+ });
+
+ this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
+};
+
+util.inherits(LqmGenerator, yeoman.generators.Base);
+
+LqmGenerator.prototype.askFor = function askFor() {
+ var cb = this.async();
+
+ // have Yeoman greet the user.
+ //console.log(this.yeoman);
+
+ var prompts = [{
+ name: 'applicationName',
+ message: 'What do you want to call your app?'
+ }];
+
+ this.prompt(prompts, function (props) {
+ this.applicationName = props.applicationName;
+
+ cb();
+ }.bind(this));
+};
+
+LqmGenerator.prototype.app = function app() {
+ this.mkdir('app');
+ this.mkdir('app/templates');
+ this.mkdir('app/models');
+ this.mkdir('app/controllers');
+ this.mkdir('app/views');
+
+ this.template('Gruntfile.js', 'Gruntfile.js');
+ this.template('index.html', 'app/index.html');
+
+ this.template('_bower.json', 'bower.json');
+ this.template('_config.json', 'config.json');
+ this.template('_package.json', 'package.json');
+};
+
+LqmGenerator.prototype.projectfiles = function projectfiles() {
+ this.copy('editorconfig', '.editorconfig');
+ this.copy('jshintrc', '.jshintrc');
+};
+
+
+LqmGenerator.prototype.runtime = function projectfiles() {
+ this.copy('bowerrc', '.bowerrc');
+ this.copy('gitignore', '.gitignore');
+};
+
View
69 app/templates/Gruntfile.js
@@ -0,0 +1,69 @@
+// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
+'use strict';
+var moment = require('moment');
+
+var LIVERELOAD_PORT = 35729;
+var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
+var mountFolder = function (connect, dir) {
+ return connect.static(require('path').resolve(dir));
+};
+
+module.exports = function (grunt) {
+ // load all grunt tasks
+ require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
+
+ grunt.initConfig({
+ watch: {
+ options: {
+ nospawn: true,
+ livereload: LIVERELOAD_PORT
+ },
+ livereload: {
+ files: [
+ 'app/*.html',
+ 'app/**/*.coffee',
+ 'app/*.js'
+ ],
+ tasks: ['coffee:compile']
+ }
+ },
+ coffee: {
+ compile: {
+ options: {
+ join: true
+ },
+ files: {
+ 'app/app.js': ['app/models/*.coffee', 'app/controllers/*.coffee', 'app/views/*.coffee'] // compile and concat into single file
+ }
+ }
+ },
+ connect: {
+ options: {
+ port: 9000,
+ // change this to '0.0.0.0' to access the server from outside
+ hostname: 'localhost'
+ },
+ livereload: {
+ options: {
+ middleware: function (connect) {
+ return [
+ lrSnippet,
+ mountFolder(connect, 'app/')
+ ];
+ }
+ }
+ }
+ },
+ open: {
+ server: {
+ path: 'http://localhost:<%%= connect.options.port %>'
+ }
+ }
+ });
+
+ grunt.registerTask('server', ['build', 'connect:livereload', 'open', 'watch']);
+
+ grunt.registerTask('build', 'Build your app.', function () {
+ console.log('File change');
+ });
+};
View
8 app/templates/_bower.json
@@ -0,0 +1,8 @@
+{
+ "name": "<%= _.slugify(applicationName) %>",
+ "version": "0.0.1",
+ "dependencies": {
+ "lungo": "latest",
+ "monocle": "latest"
+ }
+}
View
3  app/templates/_config.json
@@ -0,0 +1,3 @@
+{
+ "name": "<%= applicationName %>"
+}
View
20 app/templates/_package.json
@@ -0,0 +1,20 @@
+{
+ "name": "<%= _.slugify(applicationName) %>",
+ "private": true,
+ "devDependencies": {
+ "grunt": "~0.4.1",
+ "bower": "~0.9.2",
+ "grunt-contrib-connect": "~0.2.0",
+ "grunt-contrib-watch": "~0.4.3",
+ "grunt-contrib-coffee": "~0.7.0",
+ "grunt-contrib-jshint": "~0.6.4",
+ "grunt-contrib-uglify": "~0.2.4",
+ "grunt-open": "~0.2.0",
+ "matchdep": "~0.1.2",
+ "connect-livereload": "~0.1.3",
+ "moment": "~2.0.0"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ }
+}
View
3  app/templates/bowerrc
@@ -0,0 +1,3 @@
+{
+ "directory": "app/components"
+}
View
13 app/templates/editorconfig
@@ -0,0 +1,13 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
View
2  app/templates/gitignore
@@ -0,0 +1,2 @@
+node_modules
+*.log
View
45 app/templates/index.html
@@ -0,0 +1,45 @@
+<!doctype html>
+<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
+<!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]-->
+<!--[if IE 8]> <html class="lt-ie9"> <![endif]-->
+<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <title><%= _.capitalize(applicationName) %></title>
+ <link rel="stylesheet" href="components/lungo/lungo.css">
+ <link rel="stylesheet" href="components/lungo/lungo.icon.css">
+ <link rel="stylesheet" href="components/lungo/lungo.theme.css">
+</head>
+<body>
+ <!--[if lt IE 7]>
+ <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
+ <![endif]-->
+ <aside id="options">
+ <header data-title="Options"></header>
+ <article class="active">
+ </article>
+ </aside>
+ <section id="main" data-aside="options-menu">
+ <header data-title="<%= applicationName %>">
+ <nav>
+ <button data-view-aside="options-menu" data-icon="menu"></button>
+ </nav>
+ </header>
+ <article id="main-article" class="active"></article>
+ <footer></footer>
+ </section>
+
+ <script src="components/quojs/quo.js"></script>
+ <script src="components/quojs/quo.debug.js"></script><!-- please disable this in production mode -->
+ <script src="components/lungo/lungo.js"></script>
+ <script src="components/monocle/monocle.js"></script>
+ <script src="app.js"></script>
+ <script>
+ //init here
+ Lungo.init({
+ name: "<%= _.slugify(applicationName) %>"
+ });
+ </script>
+</body>
+</html>
View
21 app/templates/jshintrc
@@ -0,0 +1,21 @@
+{
+ "node": true,
+ "esnext": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "indent": 4,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "quotmark": "single",
+ "regexp": true,
+ "undef": true,
+ "unused": true,
+ "strict": true,
+ "trailing": true,
+ "smarttabs": true,
+ "white": true
+}
View
4 app/templates/travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - '0.8'
+ - '0.10'
View
41 package.json
@@ -0,0 +1,41 @@
+{
+ "name": "generator-lqm",
+ "version": "0.1.0",
+ "description": "An Lungo-Quo-Monocle MVC app generator for Yeoman",
+ "keywords": [
+ "lungo quo monocle yeoman-generator mvc"
+ ],
+ "homepage": "https://github.com/eduludi/generator-lqm",
+ "bugs": "https://github.com/eduludi/generator-lqm/issues",
+ "author": {
+ "name": "Eduardo Ludi",
+ "email": "edu.ludi@gmail.com",
+ "url": "https://github.com/eduludi"
+ },
+ "main": "app/index.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/eduludi/generator-lqm.git"
+ },
+ "scripts": {
+ "test": "mocha"
+ },
+ "dependencies": {
+ "yeoman-generator": "~0.13.0"
+ },
+ "devDependencies": {
+ "mocha": "~1.12.0"
+ },
+ "peerDependencies": {
+ "yo": ">=1.0.0-rc.1"
+ },
+ "engines": {
+ "node": ">=0.8.0",
+ "npm": ">=1.2.10"
+ },
+ "licenses": [
+ {
+ "type": "MIT"
+ }
+ ]
+}
View
38 test/test-creation.js
@@ -0,0 +1,38 @@
+/*global describe, beforeEach, it*/
+'use strict';
+
+var path = require('path');
+var helpers = require('yeoman-generator').test;
+
+
+describe('lqm generator', function () {
+ beforeEach(function (done) {
+ helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
+ if (err) {
+ return done(err);
+ }
+
+ this.app = helpers.createGenerator('lqm:app', [
+ '../../app'
+ ]);
+ done();
+ }.bind(this));
+ });
+
+ it('creates expected files', function (done) {
+ var expected = [
+ // add files you expect to exist here.
+ '.jshintrc',
+ '.editorconfig'
+ ];
+
+ helpers.mockPrompt(this.app, {
+ 'someOption': true
+ });
+ this.app.options['skip-install'] = true;
+ this.app.run({}, function () {
+ helpers.assertFiles(expected);
+ done();
+ });
+ });
+});
View
11 test/test-load.js
@@ -0,0 +1,11 @@
+/*global describe, beforeEach, it*/
+'use strict';
+
+var assert = require('assert');
+
+describe('lqm generator', function () {
+ it('can be imported without blowing up', function () {
+ var app = require('../app');
+ assert(app !== undefined);
+ });
+});
Please sign in to comment.
Something went wrong with that request. Please try again.