Split ruby layer into !lang/ruby and !framework/ruby-on-rails
This commit is contained in:
parent
555b8c0ec8
commit
dca6eca3c0
|
@ -0,0 +1,88 @@
|
|||
#+TITLE: Ruby on Rails contribution layer for Spacemacs
|
||||
|
||||
[[file:img/ror.png]]
|
||||
|
||||
* Table of Contents :TOC@4:
|
||||
- [[#description][Description]]
|
||||
- [[#install][Install]]
|
||||
- [[#key-bindings][Key bindings]]
|
||||
- [[#code-navigation][Code Navigation]]
|
||||
- [[#refactoring][Refactoring]]
|
||||
- [[#run-commands][RUN commands]]
|
||||
- [[#ex-commands][Ex-commands]]
|
||||
|
||||
* Description
|
||||
|
||||
This layer aims at providing support for the Ruby on Rails framework.
|
||||
|
||||
* Install
|
||||
|
||||
To use this contribution add it to your =~/.spacemacs=
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq-default dotspacemacs-configuration-layers '(ruby-on-rails))
|
||||
#+END_SRC
|
||||
|
||||
* Key bindings
|
||||
|
||||
** Code Navigation
|
||||
|
||||
| Key binding | Description |
|
||||
|---------------+-----------------------------------------------------------------|
|
||||
| ~SPC m r f a~ | find localization file |
|
||||
| ~SPC m r f c~ | find controller |
|
||||
| ~SPC m r f e~ | find environment file |
|
||||
| ~SPC m r f f~ | find feature |
|
||||
| ~SPC m r f h~ | find helper |
|
||||
| ~SPC m r f i~ | find initializer |
|
||||
| ~SPC m r f j~ | find javascript file |
|
||||
| ~SPC m r f l~ | find library |
|
||||
| ~SPC m r f m~ | find model |
|
||||
| ~SPC m r f n~ | find migration |
|
||||
| ~SPC m r f o~ | find log |
|
||||
| ~SPC m r f p~ | find spec file |
|
||||
| ~SPC m r f r~ | find rake task |
|
||||
| ~SPC m r f s~ | find stylesheet file |
|
||||
| ~SPC m r f t~ | find test |
|
||||
| ~SPC m r f u~ | find fixture |
|
||||
| ~SPC m r f v~ | find view |
|
||||
| ~SPC m r f y~ | find layout |
|
||||
| ~SPC m r f @~ | find mailer |
|
||||
| ~SPC m r g c~ | go to current controller |
|
||||
| ~SPC m r g d~ | go to DB schema |
|
||||
| ~SPC m r g e~ | go to DB seeds |
|
||||
| ~SPC m r g h~ | go to current helper |
|
||||
| ~SPC m r g j~ | go to current javascript |
|
||||
| ~SPC m r g g~ | go to Gemfile |
|
||||
| ~SPC m r g m~ | go to current model |
|
||||
| ~SPC m r g n~ | go to current migration |
|
||||
| ~SPC m r g p~ | go to current spec |
|
||||
| ~SPC m r g r~ | go to routes |
|
||||
| ~SPC m r g s~ | go to current stylesheet |
|
||||
| ~SPC m r g t~ | go to current test |
|
||||
| ~SPC m r g u~ | go to current fixture |
|
||||
| ~SPC m r g v~ | go to current view |
|
||||
| ~SPC m r g z~ | go to spec helper |
|
||||
| ~SPC m r g .~ | go to file at point (faster but less powerful than ~SPC m g g~) |
|
||||
|
||||
** Refactoring
|
||||
|
||||
| Key binding | Description |
|
||||
|---------------+-----------------------------|
|
||||
| ~SPC m r R x~ | extract region into partial |
|
||||
|
||||
** RUN commands
|
||||
|
||||
| Key binding | Description |
|
||||
|---------------+----------------------|
|
||||
| ~SPC m r c c~ | run rails generator |
|
||||
| ~SPC m r i~ | start rails console |
|
||||
| ~SPC m r s r~ | reload Rails project |
|
||||
| ~SPC m r r :~ | run rake task |
|
||||
| ~SPC m r x s~ | start rails server |
|
||||
|
||||
** Ex-commands
|
||||
|
||||
| Key binding | Description |
|
||||
|-------------+-----------------------------------------|
|
||||
| ~:A~ | Switch between implementation and tests |
|
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
|
@ -0,0 +1,90 @@
|
|||
;;; packages.el --- Ruby on Rails Layer packages File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2014 Sylvain Benner
|
||||
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||
;; URL: https://github.com/syl20bnr/spacemacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
(setq ruby-packages
|
||||
'(
|
||||
feature-mode
|
||||
haml-mode
|
||||
projectile-rails
|
||||
slim-mode
|
||||
))
|
||||
|
||||
(defun ruby/init-projectile-rails ()
|
||||
(use-package projectile-rails
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(add-hook 'enh-ruby-mode-hook 'projectile-rails-on))
|
||||
:config
|
||||
(progn
|
||||
(spacemacs|diminish projectile-rails-mode " ⇋" " RoR")
|
||||
|
||||
;; Find files
|
||||
(evil-leader/set-key-for-mode 'enh-ruby-mode
|
||||
"mrfa" 'projectile-rails-find-locale
|
||||
"mrfc" 'projectile-rails-find-controller
|
||||
"mrfe" 'projectile-rails-find-environment
|
||||
"mrff" 'projectile-rails-find-feature
|
||||
"mrfh" 'projectile-rails-find-helper
|
||||
"mrfi" 'projectile-rails-find-initializer
|
||||
"mrfj" 'projectile-rails-find-javascript
|
||||
"mrfl" 'projectile-rails-find-lib
|
||||
"mrfm" 'projectile-rails-find-model
|
||||
"mrfn" 'projectile-rails-find-migration
|
||||
"mrfo" 'projectile-rails-find-log
|
||||
"mrfp" 'projectile-rails-find-spec
|
||||
"mrfr" 'projectile-rails-find-rake-task
|
||||
"mrfs" 'projectile-rails-find-stylesheet
|
||||
"mrft" 'projectile-rails-find-test
|
||||
"mrfu" 'projectile-rails-find-fixture
|
||||
"mrfv" 'projectile-rails-find-view
|
||||
"mrfy" 'projectile-rails-find-layout
|
||||
"mrf@" 'projectile-rails-find-mailer
|
||||
;; Goto file
|
||||
"mrgc" 'projectile-rails-find-current-controller
|
||||
"mrgd" 'projectile-rails-goto-schema
|
||||
"mrge" 'projectile-rails-goto-seeds
|
||||
"mrgh" 'projectile-rails-find-current-helper
|
||||
"mrgj" 'projectile-rails-find-current-javascript
|
||||
"mrgg" 'projectile-rails-goto-gemfile
|
||||
"mrgm" 'projectile-rails-find-current-model
|
||||
"mrgn" 'projectile-rails-find-current-migration
|
||||
"mrgp" 'projectile-rails-find-current-spec
|
||||
"mrgr" 'projectile-rails-goto-routes
|
||||
"mrgs" 'projectile-rails-find-current-stylesheet
|
||||
"mrgt" 'projectile-rails-find-current-test
|
||||
"mrgu" 'projectile-rails-find-current-fixture
|
||||
"mrgv" 'projectile-rails-find-current-view
|
||||
"mrgz" 'projectile-rails-goto-spec-helper
|
||||
"mrg." 'projectile-rails-goto-file-at-point
|
||||
;; Rails external commands
|
||||
"mrcc" 'projectile-rails-generate
|
||||
"mri" 'projectile-rails-console
|
||||
"mrr:" 'projectile-rails-rake
|
||||
"mrxs" 'projectile-rails-server
|
||||
;; Refactoring 'projectile-rails-mode
|
||||
"mrRx" 'projectile-rails-extract-region)
|
||||
;; Ex-commands
|
||||
(evil-ex-define-cmd "A" 'projectile-toggle-between-implementation-and-test))))
|
||||
|
||||
(defun ruby/init-feature-mode ()
|
||||
"Initialize Cucumber feature mode"
|
||||
(use-package feature-mode
|
||||
:mode (("\\.feature\\'" . feature-mode))))
|
||||
|
||||
(defun ruby/init-haml-mode ()
|
||||
(use-package haml-mode
|
||||
:defer t))
|
||||
|
||||
(defun ruby/init-slim-mode ()
|
||||
(use-package slim-mode
|
||||
:defer t))
|
|
@ -1,21 +1,15 @@
|
|||
#+TITLE: Ruby contribution layer for Spacemacs
|
||||
|
||||
[[file:img/ruby.gif]]
|
||||
[[file:img/ruby.png]]
|
||||
|
||||
* Table of Contents :TOC@4:
|
||||
- [[#description][Description]]
|
||||
- [[#install][Install]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#ruby-version-management][Ruby version management]]
|
||||
- [[#rails-support][Rails support]]
|
||||
- [[#key-bindings][Key bindings]]
|
||||
- [[#ruby-enh-ruby-mode-robe-inf-ruby][Ruby (enh-ruby-mode, robe, inf-ruby)]]
|
||||
- [[#ruby-test-mode][ruby-test-mode]]
|
||||
- [[#rails-projectile-rails][Rails (projectile-rails)]]
|
||||
- [[#code-navigation][Code Navigation]]
|
||||
- [[#refactoring][Refactoring]]
|
||||
- [[#run-commands][RUN commands]]
|
||||
- [[#ex-commands][Ex-commands]]
|
||||
|
||||
* Description
|
||||
|
||||
|
@ -66,21 +60,6 @@ To enable it, set the =ruby-version-manager= var in your =~/.spacemacs=:
|
|||
|
||||
Possible values are =rbenv= and =rvm=.
|
||||
|
||||
** Rails support
|
||||
|
||||
Rails support is available through [[https://github.com/asok/projectile-rails][projectile-rails]].
|
||||
To enable it, set the =ruby-enable-ruby-on-rails-support= var in your
|
||||
=~/.spacemacs=:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun dotspacemacs/init ()
|
||||
(setq-default ruby-enable-ruby-on-rails-support t)
|
||||
(setq-default ruby-enable-slim-mode t) ;; if non-nil then slim-mode will be included
|
||||
(setq-default ruby-enable-haml-mode t) ;; if you want haml-mode just set to something non-nil (defaults is enabled)
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
Optionally, you may include support for [[https://github.com/nex3/haml-mode][haml-mode]] (for templates written in [[http://haml.info][haml language]] and/or optionally support for [[https://github.com/slim-template/emacs-slim][slim-mode]], which adds support for files written using the [[http://slim-lang.com][slim language]], as well as [[https://github.com/michaelklishin/cucumber.el][feature-mode]] for [[http://cukes.info][Cucumber]] support.
|
||||
* Key bindings
|
||||
|
||||
** Ruby (enh-ruby-mode, robe, inf-ruby)
|
||||
|
@ -105,67 +84,3 @@ a couple of useful keybindings:
|
|||
|-------------+---------------------|
|
||||
| ~SPC m t b~ | run test file |
|
||||
| ~SPC m t t~ | run test at pointer |
|
||||
|
||||
** Rails (projectile-rails)
|
||||
|
||||
*** Code Navigation
|
||||
|
||||
| Key binding | Description |
|
||||
|---------------+-----------------------------------------------------------------|
|
||||
| ~SPC m r f a~ | find localization file |
|
||||
| ~SPC m r f c~ | find controller |
|
||||
| ~SPC m r f e~ | find environment file |
|
||||
| ~SPC m r f f~ | find feature |
|
||||
| ~SPC m r f h~ | find helper |
|
||||
| ~SPC m r f i~ | find initializer |
|
||||
| ~SPC m r f j~ | find javascript file |
|
||||
| ~SPC m r f l~ | find library |
|
||||
| ~SPC m r f m~ | find model |
|
||||
| ~SPC m r f n~ | find migration |
|
||||
| ~SPC m r f o~ | find log |
|
||||
| ~SPC m r f p~ | find spec file |
|
||||
| ~SPC m r f r~ | find rake task |
|
||||
| ~SPC m r f s~ | find stylesheet file |
|
||||
| ~SPC m r f t~ | find test |
|
||||
| ~SPC m r f u~ | find fixture |
|
||||
| ~SPC m r f v~ | find view |
|
||||
| ~SPC m r f y~ | find layout |
|
||||
| ~SPC m r f @~ | find mailer |
|
||||
| ~SPC m r g c~ | go to current controller |
|
||||
| ~SPC m r g d~ | go to DB schema |
|
||||
| ~SPC m r g e~ | go to DB seeds |
|
||||
| ~SPC m r g h~ | go to current helper |
|
||||
| ~SPC m r g j~ | go to current javascript |
|
||||
| ~SPC m r g g~ | go to Gemfile |
|
||||
| ~SPC m r g m~ | go to current model |
|
||||
| ~SPC m r g n~ | go to current migration |
|
||||
| ~SPC m r g p~ | go to current spec |
|
||||
| ~SPC m r g r~ | go to routes |
|
||||
| ~SPC m r g s~ | go to current stylesheet |
|
||||
| ~SPC m r g t~ | go to current test |
|
||||
| ~SPC m r g u~ | go to current fixture |
|
||||
| ~SPC m r g v~ | go to current view |
|
||||
| ~SPC m r g z~ | go to spec helper |
|
||||
| ~SPC m r g .~ | go to file at point (faster but less powerful than ~SPC m g g~) |
|
||||
|
||||
*** Refactoring
|
||||
|
||||
| Key binding | Description |
|
||||
|---------------+-----------------------------|
|
||||
| ~SPC m r R x~ | extract region into partial |
|
||||
|
||||
*** RUN commands
|
||||
|
||||
| Key binding | Description |
|
||||
|---------------+----------------------|
|
||||
| ~SPC m r c c~ | run rails generator |
|
||||
| ~SPC m r i~ | start rails console |
|
||||
| ~SPC m r s r~ | reload Rails project |
|
||||
| ~SPC m r r :~ | run rake task |
|
||||
| ~SPC m r x s~ | start rails server |
|
||||
|
||||
*** Ex-commands
|
||||
|
||||
| Key binding | Description |
|
||||
|-------------+-----------------------------------------|
|
||||
| ~:A~ | Switch between implementation and tests |
|
||||
|
|
|
@ -16,25 +16,3 @@
|
|||
|
||||
(defvar ruby-version-manager nil
|
||||
"If non nil defines the Ruby version manager (i.e. rbenv, rvm)")
|
||||
|
||||
(defvar ruby-enable-ruby-on-rails-support nil
|
||||
"If non nil we'll load support for Rails (haml and/or slim, features, navigation)")
|
||||
|
||||
(defvar ruby-enable-haml-mode t
|
||||
"When non-nil, well load haml-mode. By default this is enabled.")
|
||||
|
||||
(defvar ruby-enable-slim-mode nil
|
||||
"When non-nil, will load slim-mode")
|
||||
|
||||
;; not supported for now
|
||||
;; (setq ruby/key-binding-prefixes
|
||||
;; '(("mr" . "RoR")
|
||||
;; ("mrc" . "RoR-compile/generate")
|
||||
;; ("mrg" . "RoR-goto")
|
||||
;; ("mrf" . "RoR-find")
|
||||
;; ("mrr" . "RoR-rake")
|
||||
;; ("mrR" . "RoR-refactoring")
|
||||
;; ("mrs" . "RoR-REPL")
|
||||
;; ("mrx" . "RoR-run")))
|
||||
;; (mapc (lambda (x) (spacemacs/declare-prefix (car x) (cdr x)))
|
||||
;; ruby/key-binding-prefixes)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
|
@ -1,3 +1,15 @@
|
|||
;;; packages.el --- Ruby Layer packages File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2014 Sylvain Benner
|
||||
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||
;; URL: https://github.com/syl20bnr/spacemacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
(setq ruby-packages
|
||||
'(
|
||||
bundler
|
||||
|
@ -12,15 +24,6 @@
|
|||
(when ruby-version-manager
|
||||
(add-to-list 'ruby-packages ruby-version-manager))
|
||||
|
||||
(when ruby-enable-ruby-on-rails-support
|
||||
(when ruby-enable-slim-mode
|
||||
(add-to-list 'ruby-packages `slim-mode))
|
||||
(when ruby-enable-haml-mode
|
||||
(add-to-list `ruby-packages `haml-mode))
|
||||
|
||||
(add-to-list 'ruby-packages 'feature-mode)
|
||||
(add-to-list 'ruby-packages 'projectile-rails))
|
||||
|
||||
(defun ruby/init-rbenv ()
|
||||
"Initialize RBENV mode"
|
||||
(use-package rbenv
|
||||
|
@ -74,64 +77,6 @@
|
|||
(evil-leader/set-key-for-mode 'enh-ruby-mode "mbu" 'bundle-update)
|
||||
(evil-leader/set-key-for-mode 'enh-ruby-mode "mbx" 'bundle-exec))))
|
||||
|
||||
(defun ruby/init-projectile-rails ()
|
||||
(use-package projectile-rails
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(add-hook 'enh-ruby-mode-hook 'projectile-rails-on))
|
||||
:config
|
||||
(progn
|
||||
(spacemacs|diminish projectile-rails-mode " ⇋" " RoR")
|
||||
|
||||
;; Find files
|
||||
(evil-leader/set-key-for-mode 'enh-ruby-mode
|
||||
"mrfa" 'projectile-rails-find-locale
|
||||
"mrfc" 'projectile-rails-find-controller
|
||||
"mrfe" 'projectile-rails-find-environment
|
||||
"mrff" 'projectile-rails-find-feature
|
||||
"mrfh" 'projectile-rails-find-helper
|
||||
"mrfi" 'projectile-rails-find-initializer
|
||||
"mrfj" 'projectile-rails-find-javascript
|
||||
"mrfl" 'projectile-rails-find-lib
|
||||
"mrfm" 'projectile-rails-find-model
|
||||
"mrfn" 'projectile-rails-find-migration
|
||||
"mrfo" 'projectile-rails-find-log
|
||||
"mrfp" 'projectile-rails-find-spec
|
||||
"mrfr" 'projectile-rails-find-rake-task
|
||||
"mrfs" 'projectile-rails-find-stylesheet
|
||||
"mrft" 'projectile-rails-find-test
|
||||
"mrfu" 'projectile-rails-find-fixture
|
||||
"mrfv" 'projectile-rails-find-view
|
||||
"mrfy" 'projectile-rails-find-layout
|
||||
"mrf@" 'projectile-rails-find-mailer
|
||||
;; Goto file
|
||||
"mrgc" 'projectile-rails-find-current-controller
|
||||
"mrgd" 'projectile-rails-goto-schema
|
||||
"mrge" 'projectile-rails-goto-seeds
|
||||
"mrgh" 'projectile-rails-find-current-helper
|
||||
"mrgj" 'projectile-rails-find-current-javascript
|
||||
"mrgg" 'projectile-rails-goto-gemfile
|
||||
"mrgm" 'projectile-rails-find-current-model
|
||||
"mrgn" 'projectile-rails-find-current-migration
|
||||
"mrgp" 'projectile-rails-find-current-spec
|
||||
"mrgr" 'projectile-rails-goto-routes
|
||||
"mrgs" 'projectile-rails-find-current-stylesheet
|
||||
"mrgt" 'projectile-rails-find-current-test
|
||||
"mrgu" 'projectile-rails-find-current-fixture
|
||||
"mrgv" 'projectile-rails-find-current-view
|
||||
"mrgz" 'projectile-rails-goto-spec-helper
|
||||
"mrg." 'projectile-rails-goto-file-at-point
|
||||
;; Rails external commands
|
||||
"mrcc" 'projectile-rails-generate
|
||||
"mri" 'projectile-rails-console
|
||||
"mrr:" 'projectile-rails-rake
|
||||
"mrxs" 'projectile-rails-server
|
||||
;; Refactoring 'projectile-rails-mode
|
||||
"mrRx" 'projectile-rails-extract-region)
|
||||
;; Ex-commands
|
||||
(evil-ex-define-cmd "A" 'projectile-toggle-between-implementation-and-test))))
|
||||
|
||||
(defun ruby/init-robe ()
|
||||
"Initialize Robe mode"
|
||||
(use-package robe
|
||||
|
@ -165,19 +110,6 @@
|
|||
'(lambda ()
|
||||
(define-key yaml-mode-map "\C-m" 'newline-and-indent)))))
|
||||
|
||||
(defun ruby/init-feature-mode ()
|
||||
"Initialize Cucumber feature mode"
|
||||
(use-package feature-mode
|
||||
:mode (("\\.feature\\'" . feature-mode))))
|
||||
|
||||
(defun ruby/init-haml-mode ()
|
||||
(use-package haml-mode
|
||||
:defer t))
|
||||
|
||||
(defun ruby/init-slim-mode ()
|
||||
(use-package slim-mode
|
||||
:defer t))
|
||||
|
||||
(defun ruby/init-ruby-test-mode ()
|
||||
"Define keybindings for ruby test mode"
|
||||
(use-package ruby-test-mode
|
||||
|
|
Loading…
Reference in New Issue