Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.4.1 #217

Merged
merged 10 commits into from
Oct 11, 2015
Merged

1.4.1 #217

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion History.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
1.3.1 / 2015-09-1
1.4.1 / 2015-10-11
==================
* add package generator
* windows fixes

1.3.1 / 2015-09-01
==================
* fix run error on windows
* template formatting fixes
Expand Down
43 changes: 43 additions & 0 deletions lib/generators/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var path = require('path');
var _ = require('underscore');

Generator.create({
name: 'package',
aliases: ['p'],
usage: 'iron {generate, g}:{package, p} [path/]<name>',
description: 'Generate scaffolding for a Package.',
examples: [
'iron g:package todos:package'
]
}, function (args, opts) {

var file = this.cssCase(opts.resourceName);

var pathToTemplate = this.pathFromApp('packages', opts.dir, file);

var pathFromApp = this.pathFromApp('packages', opts.dir, file, 'package.js');

var context = {
name: opts.resourceName,
className: this.classCase(opts.resourceName),
myPath: path.relative(this.pathFromProject(), pathToTemplate),
fileName: file
};

this.template(
'package/package.js',
pathFromApp,
context
);

var that = this;
_.each(['lib', 'client', 'server', 'test'], function(folder) {
var packageFile = pathToTemplate + '/' + folder + '/' + file + '.js';
that.template(
'package/' + folder + '/package.js',
packageFile,
context
);
});

});
9 changes: 0 additions & 9 deletions lib/generators/stylesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,3 @@ Generator.create({
context
);
});

// use scss index file
// see: https://github.com/fourseven/meteor-scss/#controlling-load-order-since-200-beta_3
var config = CurrentConfig.get();
if (config && config.engines.css == 'scss') {
var destpath = this.pathFromApp('scss.json');
var content = '{\n\t"useIndex" : true,\n\t"indexFilePath" : "client/stylesheets/main.scss"\n}'
this.createFile(destpath, content);
}
5 changes: 5 additions & 0 deletions lib/templates/app/lib/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Router.configure({
layoutTemplate: 'MasterLayout',
loadingTemplate: 'Loading',
notFoundTemplate: 'NotFound'
});
5 changes: 5 additions & 0 deletions lib/templates/app/lib/routes.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Router.configure
layoutTemplate: 'MasterLayout'
loadingTemplate: 'Loading'
notFoundTemplate: 'NotFound'

5 changes: 5 additions & 0 deletions lib/templates/app/lib/routes.js.es6
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Router.configure({
layoutTemplate: 'MasterLayout',
loadingTemplate: 'Loading',
notFoundTemplate: 'NotFound'
});
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
36 changes: 36 additions & 0 deletions lib/templates/package/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Package.describe({
name: "<%= name %>",
summary: "What this does",
version: "1.0.0",
git: "https://github.com/<username>/<%= fileName %>.git",
});

Package.onUse(function (api) {
api.versionsFrom('0.9.0');

api.use('ecmascript');

var packages = [
'iron:router'
];

api.use(packages);
api.imply(packages);

api.addFiles('lib/<%= fileName %>.js', ['client', 'server']);
api.addFiles('client/<%= fileName %>.js', 'client');
api.addFiles('server/<%= fileName %>.js', 'server');

api.export('<%= className %>');
});

Package.onTest(function (api) {
api.use('<%= name %>');
api.use('ecmascript');
api.use('[email protected]');
api.addFiles('test/<%= name %>.js', 'server');
});

Npm.depends({
"package": "X.X.X"
});
Empty file.
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions lib/templates/package/test/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Tinytest.add('example', function (test) {
test.equal(true, true);
});
2 changes: 2 additions & 0 deletions lib/templates/package/test/package.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Tinytest.add 'example', (test) ->
test.equal true, true
3 changes: 3 additions & 0 deletions lib/templates/package/test/package.js.es6
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Tinytest.add('example', function (test) {
test.equal(true, true);
});
4 changes: 2 additions & 2 deletions lib/tools/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports.capitalize = function capitalize(str) {
module.exports.classCase = function classCase(str) {
var self = this;
// '_' or '-' or '.' or '/'
var re = /_|-|\.|\//;
var re = /_|-|:|\.|\//;

if (!str)
return '';
Expand All @@ -38,7 +38,7 @@ module.exports.classCase = function classCase(str) {
};

/**
* Given FooBar, returns fooBar.
* Given FooBar, returns fooBar.
*/
module.exports.camelCase = function camelCase(str) {
var output = this.classCase(str);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iron-meteor",
"version": "1.3.2",
"version": "1.4.1",
"description": "A command line tool for scaffolding Meteor applications.",
"homepage": "https://github.com/iron-meteor/iron-cli",
"bugs": {
Expand Down