#+TITLE: emberjs layer

#+TAGS: framework|layer|programming

[[file:img/ember.png]]

* Table of Contents                     :TOC_5_gh:noexport:
- [[#description][Description]]
  - [[#features][Features:]]
- [[#install][Install]]
- [[#completion-system][Completion System]]
- [[#key-bindings][Key bindings]]
  - [[#file-key-bindings][File key bindings]]
  - [[#generator-key-bindings][Generator key bindings]]
  - [[#destroy-the-inverse-of-generate-key-bindings][Destroy (the inverse of generate) key bindings]]
  - [[#key-bindings-to-build-start-the-server-and-run-tests][Key bindings to build, start the server and run tests]]

* Description
This enables helpers for working with Ember.js projects.

This also includes [[https://github.com/ronco/ember-yasnippets.el][ember-yasnippets]]. See the README for ember-yansippets for the snippet keys.

To use this, you need to add add a =.dir-locals.el= file with the following in the root of your ember project:

#+BEGIN_SRC emacs-lisp
  ((nil . ((mode . ember))))
#+END_SRC

If you do not wish to do the following, you may also just do =M-x ember-mode=, however it will make things easier.

Additionally, temporary backup, autosave, and lockfiles interfere with broccoli watcher, so they need to either be moved out of the way or disabled.

Add the following to your =dotspacemacs/user-config=:

#+BEGIN_SRC emacs-lisp
  (setq backup-directory-alist `((".*" . ,temporary-file-directory)))
  (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
  (setq create-lockfiles nil)
#+END_SRC

** Features:
- Ability to easily switch between various files
- Key bindings for generators and also easily revert generator actions
- Ability to build, start server, and run tests

* Install
To use this contribution add it to your =~/.spacemacs=

#+BEGIN_SRC emacs-lisp
  (setq-default dotspacemacs-configuration-layers '(emberjs))
#+END_SRC

* Completion System
By default this will use =ido=,
but it may be configured to use helm by adding the following in your =dotspacemacs/user-config= function:

#+BEGIN_SRC emacs-lisp
  (setq ember-completion-system 'helm)
#+END_SRC

* Key bindings
** File key bindings

| Key binding | Description            |
|-------------+------------------------|
| SPC m f f c | ember-open-controller  |
| SPC m f f m | ember-open-model       |
| SPC m f f o | ember-open-router      |
| SPC m f f p | ember-open-component   |
| SPC m f f r | ember-open-route       |
| SPC m f f j | ember-open-javascript  |
| SPC m f f t | ember-open-template    |
| SPC m f f x | ember-open-mixin       |
| SPC m f f i | ember-open-initializer |
| SPC m f f u | ember-open-util        |
| SPC m f f s | ember-open-service     |

** Generator key bindings

| Key binding | Description                |
|-------------+----------------------------|
| SPC m f g c | ember-generate-controller  |
| SPC m f g m | ember-generate-model       |
| SPC m f g o | ember-generate-router      |
| SPC m f g p | ember-generate-component   |
| SPC m f g r | ember-generate-route       |
| SPC m f g j | ember-generate-javascript  |
| SPC m f g t | ember-generate-template    |
| SPC m f g x | ember-generate-mixin       |
| SPC m f g i | ember-generate-initializer |
| SPC m f g u | ember-generate-util        |
| SPC m f g s | ember-generate-service     |
| SPC m f g g | ember-generate             |

** Destroy (the inverse of generate) key bindings

| Key binding | Description               |
|-------------+---------------------------|
| SPC m f d c | ember-destroy-controller  |
| SPC m f d m | ember-destroy-model       |
| SPC m f d o | ember-destroy-router      |
| SPC m f d p | ember-destroy-component   |
| SPC m f d r | ember-destroy-route       |
| SPC m f d j | ember-destroy-javascript  |
| SPC m f d t | ember-destroy-template    |
| SPC m f d x | ember-destroy-mixin       |
| SPC m f d i | ember-destroy-initializer |
| SPC m f d u | ember-destroy-util        |
| SPC m f d s | ember-destroy-service     |
| SPC m f d d | ember-destroy             |

** Key bindings to build, start the server and run tests

| Key binding | Description            |
|-------------+------------------------|
| SPC m f r b | ember-build            |
| SPC m f r s | ember-serve-or-display |
| SPC m f r t | ember-test             |
