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

[RDY] Add emberjs layer #4958

Merged
merged 1 commit into from
Jul 19, 2018
Merged
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
115 changes: 115 additions & 0 deletions layers/+frameworks/emberjs/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#+TITLE: emberjs layer
#+CAPTION: logo
[[file:img/ember.png]]

* Table of Contents :TOC_4_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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note how to configure this -- I'm not going to make it work with ivy.

* 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 |
Binary file added layers/+frameworks/emberjs/img/ember.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions layers/+frameworks/emberjs/packages.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
;;; packages.el --- emberjs layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Robert O'Connor <robby.oconnor@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

;;; Commentary:

;;; Code:

(defconst emberjs-packages
'(ember-mode
ember-yasnippets))


(defun emberjs/init-ember-mode ()
(use-package ember-mode
:defer t
:init
(spacemacs/declare-prefix-for-mode 'ember-mode "ff" "file")
(spacemacs/declare-prefix-for-mode 'ember-mode "fg" "generate")
(spacemacs/declare-prefix-for-mode 'ember-mode "fd" "destroy")
(spacemacs/declare-prefix-for-mode 'ember-mode "fr" "run")
;; key bindings
(spacemacs/set-leader-keys-for-minor-mode 'ember-mode
"ffc" 'ember-open-controller
"ffm" 'ember-open-model
"ffo" 'ember-open-router
"ffp" 'ember-open-component
"ffr" 'ember-open-route
"ffj" 'ember-open-javascript
"fft" 'ember-open-template
"ffx" 'ember-open-mixin
"ffi" 'ember-open-initializer
"ffu" 'ember-open-util
"ffs" 'ember-open-service
"fgc" 'ember-generate-controller
"fgm" 'ember-generate-model
"fgo" 'ember-generate-router
"fgp" 'ember-generate-component
"fgr" 'ember-generate-route
"fgj" 'ember-generate-javascript
"fgt" 'ember-generate-template
"fgx" 'ember-generate-mixin
"fgi" 'ember-generate-initializer
"fgu" 'ember-generate-util
"fgs" 'ember-generate-service
"fgg" 'ember-generate
"fdc" 'ember-destroy-controller
"fdm" 'ember-destroy-model
"fdo" 'ember-destroy-router
"fdp" 'ember-destroy-component
"fdr" 'ember-destroy-route
"fdj" 'ember-destroy-javascript
"fdt" 'ember-destroy-template
"fdx" 'ember-destroy-mixin
"fdi" 'ember-destroy-initializer
"fdu" 'ember-destroy-util
"fds" 'ember-destroy-service
"fdd" 'ember-destroy
"frb" 'ember-build
"frs" 'ember-serve-or-display
"frt" 'ember-test)))




(defun emberjs/init-ember-yasnippets ()
(use-package ember-yasnippets
:defer t))

;;; packages.el ends here