Skip to content

Instantly share code, notes, and snippets.

@lululau
Last active November 19, 2015 06:39
Show Gist options
  • Save lululau/7e1172550dc4e01d6003 to your computer and use it in GitHub Desktop.
Save lululau/7e1172550dc4e01d6003 to your computer and use it in GitHub Desktop.
Monkey-patched projectile-rails.el
(defun binding-pry-filter (text)
(if (string-match "^ => [0-9]+:" text) (pop-to-buffer (current-buffer))))
(defun projectile-rails-server (port)
(interactive "P")
(require 'inf-ruby)
(if (not port) (setq port 3000))
(projectile-rails-with-root
(progn
(if (not (comint-check-proc inf-ruby-buffer)) (rvm-activate-corresponding-ruby))
(with-current-buffer (run-ruby
(projectile-rails-with-preloader
:spring "bundle exec spring rails server"
:zeus "zeus server"
:vanilla (format "bundle exec rails server -p %d" port)) (concat "*" (projectile-project-name) "railsserver*"))
(projectile-rails-mode +1)
(add-hook 'comint-output-filter-functions 'binding-pry-filter nil t)))))
(defun projectile-rails-console ()
(interactive)
(require 'inf-ruby)
(projectile-rails-with-root
(progn
(if (not (comint-check-proc inf-ruby-buffer)) (rvm-activate-corresponding-ruby))
(with-current-buffer (run-ruby
(projectile-rails-with-preloader
:spring "bundle exec spring rails console"
:zeus "zeus console"
:vanilla "bundle exec rails console") (concat "*" (projectile-project-name) "railsconsole*"))
(projectile-rails-mode +1)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment