 ;;; module-ruby.el
-
-;; Silence the byte-compiler
-(eval-when-compile (require 'defuns-quickrun))
 
 (use-package ruby-mode
   :mode ("\\.rb$" "\\.rake$" "\\.gemspec$" "\\.?pryrc$"

            (refactor-extract-to-let          "extract to let"          t)
            (refactor-convert-post-conditional "convert post conditional" t)))))

;; Rakefiles ;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-minor-mode rake-mode
  "Buffer local minor mode for rake files"
  :lighter " Rake" :keymap (make-sparse-keymap)
  (add-yas-minor-mode! 'rake-mode))
(associate! rake-mode :match "\\(/Rakefile\\|\\.rake\\)$")
(associate! rake-mode :files ("Rakefile"))

;; Vagrantfiles ;;;;;;;;;;;;;;;;;;;;;;;;
(define-minor-mode vagrant-mode
  "Buffer local minor mode for vagrant files"
  :lighter " Va" :keymap (make-sparse-keymap)
  (add-yas-minor-mode! 'vagrant-mode))
(associate! vagrant-mode :files ("Vagrantfile"))

(use-package rspec-mode
  :defer t
  :mode ("/\\.rspec$" . text-mode)
  :init
  (associate! rspec-mode :match "/\\.rspec$")
  (associate! rspec-mode :in (ruby-mode yaml-mode) :files ("spec/"))

  (defvar rspec-mode-verifiable-map (make-sparse-keymap))
  (defvar evilmi-ruby-match-tags
    '((("unless" "if") ("elsif" "else") "end")

  :commands (inf-ruby inf-ruby-console-auto)
  :init
  (define-repl! ruby-mode inf-ruby)
  (evil-set-initial-state 'inf-ruby-mode 'emacs)
  :config
  (require 'company-inf-ruby)
  (define-company-backend! inf-ruby-mode (inf-ruby)))

;;
(define-project-type! rake "rake"
  :files ("Rakefile"))

(define-project-type! vagrant "vagrant"
  :files ("Vagrantfile"))

(provide 'module-ruby)
;;; module-ruby.el ends here
