Giter VIP home page Giter VIP logo

iron-cli's Introduction

iron

Join the chat at https://gitter.im/iron-meteor/iron-cli

A command line scaffolding tool for Meteor applications. It automatically creates project structure, files and boilerplate code.

Installation

Install the iron command line tool globally so you can use it from any project directory.

$ npm install -g iron-meteor

This replaces the em command line tool.

You can remove the meteor-em tool like this:

$ npm uninstall -g meteor-em

You can upgrade an existing project either by hande or by using the migrate command like this:

./my-app

$ iron migrate

Usage

Use the help command to get a list of the top level commands.

$ iron help

Use the g command to see a list of generators.

$ iron g

Run Iron in verbose mode (extended logging)

$ IRON_DEBUG=true iron

Directory Structure

The application will have the following directory structure:

my-app/
 .iron/
   config.json
 bin/
 build/
 config/
   development/
     env.sh
     settings.json
 app/
   client/
     collections/
     lib/
     stylesheets/
     templates/
     head.html
   lib/
     collections/
     controllers/
     methods.js
     routes.js
   packages/
   private/
   public/
   server/
     collections/
     lib/
     methods.js
     publish.js
     bootstrap.js

Generators

$ iron g:scaffold todos
$ iron g:template todos/todo_item
$ iron g:collection todos
$ iron g:route webhooks/stripe --where "server"
$ iron g:controller todos/show_todo
$ iron g:route todos/show_todo --action "show"
$ iron g:publish todos
$ iron g:stylesheet main
$ iron g:package package:name

Commands

Create an Application

$ iron create my-app

The following parameters can be specified:

--css=css|scss|less
--js=js|coffee|es6
--html=html|jade
--skip-template-css=true|false
--skip-template-js=true|false
--skip-template-html=true|false
--skip-iron-router
--skip-route-controller
--skip-route-template
--skip-generator-comments

NOTE

Implementing complete customization and configuration is high on the development priority list. See the Github issue if you'd like to contribute.

Run Your Application

$ iron run

This will automatically load your config/development/env.sh and config/development/settings.json files.

Run the Application with a Different Environment

$ iron run --env=staging

This will use the config files in config/staging instead.

Debug Your Application on the Server Side

$ iron debug

Build Your Application

$ iron build

Connect to MongoDB Database

$ cd app/
$ meteor mongo

NOTE

Ideally running iron mongo in the project directory should work but it doesn't for some reason and is being tracked in issue #136

Deployment

Deploy Your Application with Meteor Up

Meteor Up is a command line tool to deploy any Meteor app to your own server.

Configure Meteor Up

The following configuration options are supported in config.json:

"mup": {
  "version": "mup" or "mupx",
  "environment": "/path/to/environment"
}

Initialize Meteor Up

Use iron mup to run Meteor Up commands. To create a mup.json file for an environment run:

iron mup <environment> --init

IMPORTANT

Your mup.json file must contain "enableUploadProgressBar": false to work with Iron.

Create Meteor Up Server

After configuring mup.json, the server can be bootstrapped with a single command:

iron mup <environment> --setup

Deploy to Meteor Up Environment

  'iron mup development' //deploy to development environment
  'iron mup dev' // shortcut for development
  'iron mup production'
  'iron mup prod'
  'iron mup <custom-from-config>'

Deploy Your Application on Heroku

Iron projects require buildpacks to look for the app in /app/ in addition to the root for deployments to work. Currently there is a patched version of the Horse buildpack available that is compatible with Iron based projects. Use this fork until the patches has been added to the main Horse repo.

$ heroku config:set BUILDPACK_URL=https://github.com/lirbank/meteor-buildpack-horse.git

This will build your application and put the resulting bundle into the project's build folder.

Meteor Commands

Meteor commands will automatically be proxied to the meteor command line tool.

Contributing

Contributions and ideas are welcome.

Tests

To run tests

npm test

License

MIT

iron-cli's People

Contributors

afuggini avatar bitio avatar chrisbutler avatar cmather avatar desm avatar francescu avatar fredericlefeurmou avatar fredevery avatar gitter-badger avatar jlouzado avatar josephdburdick avatar kandizzy avatar lirbank avatar maka-io avatar maxim-filimonov avatar nickytonline avatar panphora avatar pem-- avatar raduchiriac avatar rgoomar avatar richsilv avatar scottmcpherson avatar spicemix avatar yubozhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iron-cli's Issues

Initial config ideas

As we've been discussing in #6 it would be nice to have an initial / default config when running em init. I'm thinking something like Ruby on Rails. Things like:

  • A set of popular/frequent packages added by default (Iron Router, Accounts, underscore, etc)
  • Hooks for Account (onLogin, onCreateUser) and other
  • As well as the type of file to work with (coffee/js, less/css, etc)

Let's discuss.

Account-Entry Package (and maybe others) broken

The Setting:

templateNameConverter: 'upperCamelCase'

breaks the accounts-entry package and possible others. With this I must rename all generated Templates from "Dashboard" to "dashboard" and comment out the templateNameConverter setting. Is there an better option?

em g:scaffold resource fails

~/Projects/vonvo:(1h56m|git@add-roles โš‘) ยฑ em g:scaffold resource          โŽ โœฑ โœญ [Genetrix 8:31 PM]
Generate collection
created /Users/carlodicelico/Projects/vonvo/both/collections/resource.js
created /Users/carlodicelico/Projects/vonvo/server/collections/resource.js
created /Users/carlodicelico/Projects/vonvo/client/collections/resource.js
Generate methods
created /Users/carlodicelico/Projects/vonvo/both/methods/resource.js
created /Users/carlodicelico/Projects/vonvo/client/methods/resource.js
created /Users/carlodicelico/Projects/vonvo/server/methods/resource.js
Generate default route
Error creating route: TypeError: Cannot call method 'slice' of null

Using

"iron-router": {
        "git": "https://github.com/EventedMind/iron-router.git",
        "tag": "v0.7.1",
        "commit": "d1ffb3f06ea4c112132b030f2eb1a70b81675ecb"
      }

.gitkeep files

Is it an idea to add .gitkeep files to all empty folders?
When I mess up too much and want to start over I ussually:
git reset --hard
git clean -f -d

This removes all empty folders. Now I manually created a .gitkeep file in every empty folder, but it's quite a chore.

Scaffolding path info

Where can I find a description of each directory created after em init?

I don't understand:

  • ./server/db
  • ./config/development/env.sh (it's for start meteor with specific ambient variables?)

LiveScript support

please add livescript support with .ls extension settings. It will be great fro some users like me.

thanks a lot

.gitkeep to commit empty folders in git

If you create a project and make it a git project only folders which contain files are checked in. A .gitkeep file in all structor folders could help! ;)

new em app missing Router dependency

I've created a new, empty application using the following:

mrt create em-test/
cd em-test/
em init 
mrt 

Starting the application fails with the following:

Stand back while Meteorite does its thing

Done installing smart packages

Ok, everything's ready. Here comes Meteor!

[[[[[ /Library/WebServer/Documents/projects/em-test ]]]]]

=> Started proxy.
=> Started MongoDB.     
W20140403-00:29:38.387(2)? (STDERR) 
W20140403-00:29:38.456(2)? (STDERR) /Library/WebServer/Documents/projects/em-test/.meteor/local/build/programs/server/boot.js:186
W20140403-00:29:38.456(2)? (STDERR) }).run();
W20140403-00:29:38.456(2)? (STDERR)    ^
W20140403-00:29:38.457(2)? (STDERR) ReferenceError: Router is not defined
W20140403-00:29:38.457(2)? (STDERR)     at app/both/router/routes.js:4:1
W20140403-00:29:38.457(2)? (STDERR)     at app/both/router/routes.js:19:3
W20140403-00:29:38.457(2)? (STDERR)     at /Library/WebServer/Documents/projects/em-test/.meteor/local/build/programs/server/boot.js:155:10
W20140403-00:29:38.457(2)? (STDERR)     at Array.forEach (native)
W20140403-00:29:38.457(2)? (STDERR)     at Function._.each._.forEach (/Volumes/working/Users/stuart/.meteor/tools/c2a0453c51/lib/node_modules/underscore/underscore.js:79:11)
W20140403-00:29:38.457(2)? (STDERR)     at /Library/WebServer/Documents/projects/em-test/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8

Everything after the => Started MongoDB. line is repeated three times.

Have I missed some important step? It seems to me that if an em-based app needs Router to successfully start up, there shouldn't be a broken dependency.

OS X 10.6.8
Meteor 0.8.0

Coffeescript

Hello--when I do:

em init --ir --css=sass --js=coffee

I still get app.js and route.js, which I remove and replace with .coffee files. Is it possible to have them all be .coffee files from the start?

Enhancement: --version flag

It would be nice to be able to check the em version without having to type npm list -g|grep meteor-em, eg:

$ em --version

Suggestion: Change the names of view-folder for "layout" and "shared" to become "_layout" and "_shared"

Just a small suggestion:

The current setup means that view names cannot be layout or shared, as those names will collide with the default init setup.

Also, making these two folders start with underscore separates them from the application specific views. Not only by name, but since most of us looks at these in a sorted filelist they will also normally list on top. This would be a "good thing(tm)" I think.

The constraints will then move from not allowing creating layout and shared to not allowing _layout and _shared. Which should reduce the probability of collision.

Feature Request: Remove Scaffolding

Loving em so far, only issue I have run into so far in terms of functionality is that sometimes I make a typo or a mistake, and it's a bit messy to clean up after it.

So to make things easier I would suggest:

 em remove:[template] [path]

Which would undo the added files/folders and lines in the routing file.

Suggestion: How about only one folder for collections?

I'm used to have only one folder/file for collections. Whenever I want to do something on client side only, I use if (Meteor.isClient) {}. I think it's way easier to have everything about the collection X in the same file.
What do you think?

Enhanced project structure

cc @scott-mcpherson.

I'm playing with a slightly new project structure where config stuff isn't in the app directory. It looks like this:

app/
  - both/
  - client/
  - packages/
  - public/
  - server/
config/
  - development/
    - env.sh
    - settings.json
start.sh (auto source the env.sh, cd into the app, and start it with the right settings file)

Enhancement: Add deny rule to prevent user.profile writes

Referring to #22 to further secure default apps I think it would be great to add a collection file for the users collection, eg server/collections/user.js with the following scaffolding:

Meteor.users.deny({
  update: function () {
    return true; }
  }
);

Developers can then remove this as the wish. I for one repeatedly add these lines to most of my projects.

The profile object of the logged in user can to be written to freely (by the logged in user itself), which I am sure there are not a lot of use cases for - so might as well turn it off so you don't have to think about it when you write the rest of the logic.

I guess some people like allow/deny and some prefer to rely solely on Meteor methods for DB manipulation. If you're the later you probably want these lines (turning of client direct writes to the DB completely). If you're the former you can simply remove this file if you like.

Having a collections file for the users collection server/collections/user.js is also useful for other configuration, such as ensuring indexes, eg:

Meteor.users._ensureIndex (
  {handle: 1},
  {unique: true, sparse: true}
);

Enhancement: Overwrite file default action triggered by enter key

Today:

file.html already exists. Do you want to overwrite it? [yYnN]:

On most command line tools and bash scripts the default action is pointed out with a capital letter. To me it would make more sense if only one letter was capital (and no need to point out that you can use uppercase and lowecase letters for the input):

file.html already exists. Do you want to overwrite it? [y/N]:

or possibly even nicer

file.html already exists. Do you want to overwrite it? y/N:

Meaning 'enter', 'n' and 'N' does not overwrite the file and 'y' and 'Y' would overwrite it.

Just taking notes of what I've been thinking about, big and small, while using EM for the last couple of months. Hope to be able to contribute some code soon.

EM not creating all of the files/directories it should

I've made sure everything is up to date and I'm working through the Building an app with Meteor and Iron Router and when I try to use em g:scaffold todos , the following are the only files generated by em

Williams-MacBook-Air-2:newtodos williamjohnson$ em g:scaffold todos
Generate collection
created /Users/williamjohnson/newtodos/both/collections/todos.js
created /Users/williamjohnson/newtodos/server/collections/todos.js
created /Users/williamjohnson/newtodos/client/collections/todos.js

It's only generating the todos.js files in the collections folders, nothing in the methods folders and no index files.

Any idea why this is happening?

Idea: Render 404 on the server

At the moment "Page not found" errors return an http status of 200.
In fact it should be 404 which could be done by rendering the page on the server.

Pluggable generators

People might want to use slightly different project schemes. This can range from file extensions and whether to include a particular file (e.g. how .em/config.json works now) to also actually changing the structure completely. It might be a link in the config.json to the generator package. Also need a more modular way for handling different file types. For example, currently if I use the harmony package and have app.next.js files, em thinks it should use coffeescript.

Migrate old project structures

As we move files around we need a way to upgrade from an existing project. This also applies to a barebones Meteor project (e.g. app.html, app.css, app.js) to an em/iron project structure.

redundant file naming

This is more a question! If I create the scaffold for person i'll have this folder structure:

client/controllers/person
client/controllers/person/person_index.js
client/views/person
client/views/person/person_index
client/views/person/person_index/person_index.html
client/views/person/person_index/person_index.js
client/views/person/person_index/person_index.css

Isn't that person_index kind of redundant if it is in a folder called person? I know that the template must be called PersonIndex because of missing namespaces, but the folder and file names seem wrong to me. Am I missing something?

CRUD idea

Today I had to create a blog for my soon-to-launch startup, and one thing that was kind tedious was to create all of the admin CRUD functionality for the blog. In other words, creating a table view to list all blog posts, a form view to add and edit posts, and the methods and all of the check() functions. When using em, I though it would be kind of nice to either have an additional argument that you could pass in when executing the scaffold command:

~$ em g:scaffold:crud --fields="name:String, isVisible: Boolean, etc.."  

or it could just be an entirely separate generator:

~$ em g:crud --fields="name:String, isVisible: Boolean, etc.."  

I'd be happy to fork this and submit a pull request if you think this could be useful. What do you think?

em init vs em g:project <name>

Is there a difference between the two? I tried creating a project with each method to figure which was right for me, but diff shows no difference between the two projects.

.gitkeep files

Is it an idea to add .gitkeep files to all empty folders?
When I mess up too much and want to start over I ussually:
git reset --hard
git clean -f -d

This removes all empty folders.

Valid spaces cause generator to fail.

[STEPS TO REPRODUCE]

  1. in the both/router/routes.js file enter a space between map (, that is: Router.map (function () {.
  2. attempt to em g:scaffold myObject or em g:route myObject

[ACTUAL BEHAVIOR]
Observe that the command line returns the error: Error creating route: TypeError: Cannot call method 'slice' of null

[EXPECTED BEHAVIOR]
If you remove the space between pace between map (, that is: Router.map(function () {. The generator works as expected.

Create with options fails

It's a minor issue since it's easy enough to meteor create, cd, rm default files, and em init with the options.

em g:create auto --ir --css=stylus --js=coffee --html=jade

returns...

Looks like you're not in a Meteor project directory.
Installing the package iron:router... \

/usr/local/lib/node_modules/meteor-em/lib/command.js:276
        self.logError("Error installing package " + package + ". " + String(er
        ^
ReferenceError: self is not defined
    at /usr/local/lib/node_modules/meteor-em/lib/command.js:276:9
    at ChildProcess.exithandler (child_process.js:652:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Socket.<anonymous> (child_process.js:969:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)

having trouble downloading package

I can't install this package, unfortunately.

Here is my terminal readout:

david-goldbergs-MacBook-Pro:~ davidgoldberg$ sudo npm -g install meteor-em
Password:

[email protected] install /usr/local/lib/node_modules/meteor-em/node_modules/fibers
node ./build.js

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/davidgoldberg/.node-gyp/0.10.34"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/meteor-em/node_modules/fibers/.node-gyp"
/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:873: Warning: 'as' will become a reserved keyword in Python 2.6
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 11, in
import gyp
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 8, in
import gyp.input
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 873
except ImportError as e:
^
SyntaxError: invalid syntax
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Darwin 13.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/meteor-em/node_modules/fibers
gyp ERR! node -v v0.10.34
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
Build failed
npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "-g" "install" "meteor-em"
npm ERR! node v0.10.34
npm ERR! npm v2.1.14
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node ./build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node ./build.js'.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/davidgoldberg/npm-debug.log
david-goldbergs-MacBook-Pro:~ davidgoldberg$

client/views/shared/not_found/not_found.jade

hello i started like

em init --ir --js=coffee --html=jade --css=stylus

and then i got the

client/views/shared/not_found/not_found.jade

bellow my "click me" button on the browser

Why?

resource generation infinitely creating project path within project?

bash-3.2# em g:view todos/todo_item
created /Users/michaelprice/Dev/meteor/class2/todos/client/views/todos
created /Users/michaelprice/Dev/meteor/class2/todos/Users
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2
created /Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos
... and so on until
Error creating view: Error: ENAMETOOLONG, name too long '/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2/todos/Users/michaelprice/Dev/meteor/class2'

Idea: CoffeeScript Support

It would be cool if em would support CoffeeScript. I know there are quite some people who don't like it but something like a --coffee flag would be cool. Any opinions?

Routing doesn't work when doing 'em init' using coffeescript

When I create a new project from scratch using $ em init --ir --css=false --js=coffee and create a route, I still see Iron Router's initial page. Doesn't happen when using Javascript, though. Why could this be?

If I turn router.coffee into router.js it works just fine.

0.2.1-beta.1: CoffeeScript for Router

The ONLY place that lacks CoffeeScript support when em init --js=coffeescript is called, is the both/router/routes.js file.

Need to figure out a way to trim only the beginning of the routes and route templates. The CoffeeScript ejs conditional statements create an empty line when generating the template. The way I got around this in the past was trim the template after it was generated. But with the routes, I can't do that right now, because if there is NO empty line at the end of the routes file, new routes will be generated on top of one another inline.

For now it might be best to just set up the CoffeeScript conditional in the routes template, and just allow an empty line to created at the beginning of the routes file.

App is note defined

hello if i use

em init --js=coffee ....etc
i get a coffee scaffolding

however running meteor gives me an error in my browser

App is not defined

i see in chrome console this red line

_.extend(App, {});

if i use the standard javascript it runs ok

What is the problems with the coffee version?

Thank u

jade

Not an issue but would like to see available an alternative to html
jade for ex.

Question: Trailing newline or not

I use em every day, love it! Makes my life so much easier. I was thinking I should contribute some patches when I have the time.

Anyhow just wanted to check your stance on ending newlines in files. Was it by intention that you removed the ending newline on most files in the latest release?

EM generated files today:

Code
Code <- file ends here

Better way?:

Code
Code 
<- file ends here

Customisation and support for different languages

Hey,
So I was looking through templates code and stumbled on the following.

Concerns

  • Support for variety of different languages is currently done within each template. I believe, it is gonna become difficult to maintain as more languages getting added because template files will become 200 lines of "if/else hell".
  • As different developers use different frameworks the "if else hell" becomes even more complicated. See #30 for example. Additionally, most of us have preferences for formatting and layout which does not necessarily match em defaults. Would be useful to be able to override default templates without creating em fork.

Idea

Following other frameworks example - http://guides.rubyonrails.org/generators.html#generators-lookup
I propose to be able to specify custom generators path either via config (primarily for local customisation) or via an api. Second case is primarily to make support for different languages not a concern of em templates directly.
For example,
When we want to use coffee script em the only thing em will do is

em.config.paths.push('generators/coffee')

Last config path will be searched first and if there is no coffee generator provided for specific item it can fallback to default js generator.

Potentially the API can be called from a package so support for coffeescript can be extracted to em-coffee.

Want to get some thoughts on the idea before doing the PR.

EM installation error

I am running Ubuntu 13.04. When I tried to install EM (sudo npm -g install meteor-em), I get error. Other prerequisite software are installed and I have successfully created several meteor apps on this laptop before. I get the following error in the terminal console. There is a big NPM log file too which I could email to you.

$ sudo npm -g install meteor-em
[sudo] password:
npm http GET https://registry.npmjs.org/meteor-em
npm http 304 https://registry.npmjs.org/meteor-em
npm http GET https://registry.npmjs.org/cli-color/0.2.3
npm http GET https://registry.npmjs.org/minimist/0.0.8
npm http GET https://registry.npmjs.org/underscore/1.3.3
npm http GET https://registry.npmjs.org/cli-table/0.3.0
npm http GET https://registry.npmjs.org/ejs/0.8.5
npm http GET https://registry.npmjs.org/fibers/1.0.1
npm http 304 https://registry.npmjs.org/cli-color/0.2.3
npm http 304 https://registry.npmjs.org/underscore/1.3.3
npm http 304 https://registry.npmjs.org/fibers/1.0.1
npm http 304 https://registry.npmjs.org/minimist/0.0.8
npm http 304 https://registry.npmjs.org/cli-table/0.3.0
npm http 304 https://registry.npmjs.org/ejs/0.8.5
npm http GET https://registry.npmjs.org/colors/0.6.2
npm http GET https://registry.npmjs.org/es5-ext
npm http GET https://registry.npmjs.org/memoizee
npm http 304 https://registry.npmjs.org/colors/0.6.2

[email protected] install /usr/local/lib/node_modules/meteor-em/node_modules/fibers
node ./build.js

gyp ERR! configure error
gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
gyp ERR! stack at install (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:65:16)
gyp ERR! stack at Object.self.commands.(anonymous function) as install
gyp ERR! stack at getNodeDir (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:150:20)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:93:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:719:7)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:107:17)
gyp ERR! stack at maybeClose (child_process.js:991:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1058:5)
gyp ERR! System Linux 3.8.11
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/meteor-em/node_modules/fibers
gyp ERR! node -v v0.11.13-pre
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
Build failed
npm http 304 https://registry.npmjs.org/es5-ext
npm http 304 https://registry.npmjs.org/memoizee
npm http GET https://registry.npmjs.org/event-emitter
npm http GET https://registry.npmjs.org/next-tick
npm ERR! Error: ENOENT, lstat '/usr/local/lib/node_modules/meteor-em/node_modules/cli-color/node_modules/es5-ext/test/Array/of.js'
npm ERR! at Error (native)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! System Linux 3.8.11
npm ERR! command "node" "/usr/local/bin/npm" "-g" "install" "meteor-em"
npm ERR! cwd /home/newgeek
npm ERR! node -v v0.11.13-pre
npm ERR! npm -v 1.4.4
npm ERR! path /usr/local/lib/node_modules/meteor-em/node_modules/cli-color/node_modules/es5-ext/test/Array/of.js
npm ERR! fstream_path /usr/local/lib/node_modules/meteor-em/node_modules/cli-color/node_modules/es5-ext/test/Array/of.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:97:15)
npm ERR! [email protected] install: node ./build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.8.11
npm ERR! command "node" "/usr/local/bin/npm" "-g" "install" "meteor-em"
npm ERR! cwd /home/newgeek
npm ERR! node -v v0.11.13-pre
npm ERR! npm -v 1.4.4
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/event-emitter
npm http 304 https://registry.npmjs.org/next-tick
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/newgeek/npm-debug.log
npm ERR! not ok code 0

npm install -g meteor-em broken under OS X

$ uname -a
Darwin rmbp.local 13.2.0 Darwin Kernel Version 13.2.0: Mon Mar 24 19:18:06 PDT 2014; root:xnu-2422.100.10~2/RELEASE_X86_64 x86_64

$ npm --version
1.3.15

$ npm install -g meteor-em
npm http GET https://registry.npmjs.org/meteor-em
npm http 304 https://registry.npmjs.org/meteor-em
npm http GET https://registry.npmjs.org/cli-color/0.2.3
npm http GET https://registry.npmjs.org/minimist/0.0.8
npm http GET https://registry.npmjs.org/underscore/1.3.3
npm http GET https://registry.npmjs.org/cli-table/0.3.0
npm http GET https://registry.npmjs.org/ejs/0.8.5
npm http GET https://registry.npmjs.org/fibers/1.0.1
npm http 304 https://registry.npmjs.org/underscore/1.3.3
npm http 304 https://registry.npmjs.org/fibers/1.0.1
npm http 304 https://registry.npmjs.org/ejs/0.8.5
npm http 304 https://registry.npmjs.org/cli-color/0.2.3
npm http 304 https://registry.npmjs.org/minimist/0.0.8
npm http 304 https://registry.npmjs.org/cli-table/0.3.0
npm http GET https://registry.npmjs.org/colors/0.6.2
npm http GET https://registry.npmjs.org/es5-ext
npm http GET https://registry.npmjs.org/memoizee

> [email protected] install /usr/local/lib/node_modules/meteor-em/node_modules/fibers
> node ./build.js

  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:222:34: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
                static Handle<Value> New(const Arguments& args) {
                                               ^~~~~~~~~
                                               v8::internal::Arguments
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:141:7: note: 'v8::internal::Arguments' declared
      here
class Arguments;
      ^
../src/fibers.cc:241:34: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
                static Handle<Value> Run(const Arguments& args) {
                                               ^~~~~~~~~
                                               v8::internal::Arguments
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:141:7: note: 'v8::internal::Arguments' declared
      here
class Arguments;
      ^
../src/fibers.cc:279:40: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
                static Handle<Value> ThrowInto(const Arguments& args) {
                                                     ^~~~~~~~~
                                                     v8::internal::Arguments
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:141:7: note: 'v8::internal::Arguments' declared
      here
class Arguments;
      ^
../src/fibers.cc:300:36: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
                static Handle<Value> Reset(const Arguments& args) {
                                                 ^~~~~~~~~
                                                 v8::internal::Arguments
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:141:7: note: 'v8::internal::Arguments' declared
      here
class Arguments;
      ^
../src/fibers.cc:468:37: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
                static Handle<Value> Yield_(const Arguments& args) {
                                                  ^~~~~~~~~
                                                  v8::internal::Arguments
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:141:7: note: 'v8::internal::Arguments' declared
      here
class Arguments;
      ^
../src/fibers.cc:510:65: error: unknown type name 'AccessorInfo'
                static Handle<Value> GetStarted(Local<String> property, const AccessorInfo& info) {
                                                                              ^
../src/fibers.cc:518:65: error: unknown type name 'AccessorInfo'
                static Handle<Value> GetCurrent(Local<String> property, const AccessorInfo& info) {
                                                                              ^
../src/fibers.cc:529:66: error: unknown type name 'AccessorInfo'
                static Handle<Value> GetPoolSize(Local<String> property, const AccessorInfo& info) {
                                                                               ^
../src/fibers.cc:533:77: error: unknown type name 'AccessorInfo'
  ...static void SetPoolSize(Local<String> property, Local<Value> value, const AccessorInfo& info) {
                                                                               ^
../src/fibers.cc:540:71: error: unknown type name 'AccessorInfo'
                static Handle<Value> GetFibersCreated(Local<String> property, const AccessorInfo& info) {
                                                                                    ^
../src/fibers.cc:202:24: error: no matching constructor for initialization of 'String::Utf8Value'
                                        String::Utf8Value stack(fatal_stack);
                                                          ^     ~~~~~~~~~~~
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:1851:14: note: candidate constructor not
      viable: no known conversion from 'Persistent<v8::Value>' to 'Handle<v8::Value>' for 1st argument
    explicit Utf8Value(Handle<v8::Value> obj);
             ^
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:1861:5: note: candidate constructor not viable:
      no known conversion from 'Persistent<v8::Value>' to 'const v8::String::Utf8Value' for 1st argument
    Utf8Value(const Utf8Value&);
    ^
../src/fibers.cc:229:16: error: member reference type 'Persistent<v8::FunctionTemplate>' is not a pointer
                                return tmpl->GetFunction()->NewInstance(1, argv);
                                       ~~~~^
../src/fibers.cc:316:18: error: no viable conversion from 'Persistent<v8::Value>' to 'Handle<v8::Value>'
                        Handle<Value> val = that.yielded;
                                      ^     ~~~~~~~~~~~~
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:210:26: note: candidate constructor
      (the implicit copy constructor) not viable: no known conversion from 'Persistent<v8::Value>' to
      'const v8::Handle<v8::Value> &' for 1st argument
template <class T> class Handle {
                         ^
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:227:32: note: candidate template ignored:
      failed template argument deduction
  template <class S> V8_INLINE Handle(Handle<S> that)
                               ^
../src/fibers.cc:383:18: error: no viable conversion from 'Persistent<v8::Value>' to 'Handle<v8::Value>'
                        Handle<Value> val = yielded;
                                      ^     ~~~~~~~
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:210:26: note: candidate constructor
      (the implicit copy constructor) not viable: no known conversion from 'Persistent<v8::Value>' to
      'const v8::Handle<v8::Value> &' for 1st argument
template <class T> class Handle {
                         ^
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:227:32: note: candidate template ignored:
      failed template argument deduction
  template <class S> V8_INLINE Handle(Handle<S> that)
                               ^
../src/fibers.cc:396:10: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
                        const Arguments* args = (const Arguments*)data[0];
                              ^~~~~~~~~
                              v8::internal::Arguments
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:141:7: note: 'v8::internal::Arguments' declared
      here
class Arguments;
      ^
../src/fibers.cc:396:35: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
                        const Arguments* args = (const Arguments*)data[0];
                                                       ^~~~~~~~~
                                                       v8::internal::Arguments
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:141:7: note: 'v8::internal::Arguments' declared
      here
class Arguments;
      ^
../src/fibers.cc:406:17: error: calling a private constructor of class 'v8::HandleScope'
                                HandleScope scope;
                                            ^
/Users/hipertracker/.node-gyp/0.11.9/deps/v8/include/v8.h:768:13: note: declared private here
  V8_INLINE HandleScope() {}
            ^
../src/fibers.cc:418:20: error: member reference type 'Persistent<v8::Context>' is not a pointer
                                that.v8_context->Enter();
                                ~~~~~~~~~~~~~~~^
../src/fibers.cc:427:23: error: member reference type 'Persistent<v8::Function>' is not a pointer
                                        yielded = that.cb->Call(that.v8_context->Global(), 1, argv);
                                                  ~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/fibers/src/fibers.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node/0.11.9/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:101:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:827:12)
gyp ERR! System Darwin 13.2.0
gyp ERR! command "node" "/usr/local/Cellar/node/0.11.9/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/meteor-em/node_modules/fibers
gyp ERR! node -v v0.11.9
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok 
Build failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.