Skip to content
Browse files

minor

  • Loading branch information...
1 parent 771c70e commit db079a849ccdb4d3ee401166ff1572bfe55692c9 @alexcepoi committed Jun 27, 2011
Showing with 20 additions and 13,939 deletions.
  1. +3 −0 .gitmodules
  2. +16 −6 init.el
  3. +1 −0 ruby/rinari
  4. +0 −3 ruby/rinari/.gitignore
  5. +0 −6 ruby/rinari/.gitmodules
  6. +0 −17 ruby/rinari/README
  7. +0 −187 ruby/rinari/Rakefile
  8. +0 −538 ruby/rinari/TODO
  9. +0 −2 ruby/rinari/doc/.gitignore
  10. +0 −512 ruby/rinari/doc/rinari.texi
  11. +0 −554 ruby/rinari/rinari-merb.el
  12. +0 −738 ruby/rinari/rinari.el
  13. +0 −1 ruby/rinari/test/.gitignore
  14. +0 −338 ruby/rinari/test/elunit.el
  15. +0 −100 ruby/rinari/test/init.el
  16. +0 −256 ruby/rinari/test/rails-app/README
  17. +0 −10 ruby/rinari/test/rails-app/Rakefile
  18. +0 −10 ruby/rinari/test/rails-app/app/controllers/application.rb
  19. +0 −10 ruby/rinari/test/rails-app/app/controllers/example_controller.rb
  20. +0 −2 ruby/rinari/test/rails-app/app/controllers/newone_controller.rb
  21. +0 −7 ruby/rinari/test/rails-app/app/controllers/units_controller.rb
  22. +0 −3 ruby/rinari/test/rails-app/app/helpers/application_helper.rb
  23. +0 −2 ruby/rinari/test/rails-app/app/helpers/example_helper.rb
  24. +0 −2 ruby/rinari/test/rails-app/app/helpers/newone_helper.rb
  25. +0 −2 ruby/rinari/test/rails-app/app/helpers/units_helper.rb
  26. +0 −7 ruby/rinari/test/rails-app/app/models/example.rb
  27. +0 −1 ruby/rinari/test/rails-app/app/views/example/show.rhtml
  28. +0 −1 ruby/rinari/test/rails-app/app/views/example/write.rhtml
  29. +0 −1 ruby/rinari/test/rails-app/app/views/units/fall.html.erb
  30. +0 −109 ruby/rinari/test/rails-app/config/boot.rb
  31. +0 −19 ruby/rinari/test/rails-app/config/database.yml
  32. +0 −67 ruby/rinari/test/rails-app/config/environment.rb
  33. +0 −17 ruby/rinari/test/rails-app/config/environments/development.rb
  34. +0 −22 ruby/rinari/test/rails-app/config/environments/production.rb
  35. +0 −22 ruby/rinari/test/rails-app/config/environments/test.rb
  36. +0 −10 ruby/rinari/test/rails-app/config/initializers/inflections.rb
  37. +0 −5 ruby/rinari/test/rails-app/config/initializers/mime_types.rb
  38. +0 −15 ruby/rinari/test/rails-app/config/initializers/new_rails_defaults.rb
  39. +0 −41 ruby/rinari/test/rails-app/config/routes.rb
  40. 0 ruby/rinari/test/rails-app/db/test.sqlite3
  41. +0 −2 ruby/rinari/test/rails-app/doc/README_FOR_APP
  42. 0 ruby/rinari/test/rails-app/log/development.log
  43. 0 ruby/rinari/test/rails-app/log/production.log
  44. 0 ruby/rinari/test/rails-app/log/server.log
  45. 0 ruby/rinari/test/rails-app/log/test.log
  46. +0 −30 ruby/rinari/test/rails-app/public/404.html
  47. +0 −30 ruby/rinari/test/rails-app/public/422.html
  48. +0 −30 ruby/rinari/test/rails-app/public/500.html
  49. +0 −10 ruby/rinari/test/rails-app/public/dispatch.cgi
  50. +0 −24 ruby/rinari/test/rails-app/public/dispatch.fcgi
  51. +0 −10 ruby/rinari/test/rails-app/public/dispatch.rb
  52. 0 ruby/rinari/test/rails-app/public/favicon.ico
  53. BIN ruby/rinari/test/rails-app/public/images/rails.png
  54. +0 −274 ruby/rinari/test/rails-app/public/index.html
  55. +0 −2 ruby/rinari/test/rails-app/public/javascripts/application.js
  56. +0 −963 ruby/rinari/test/rails-app/public/javascripts/controls.js
  57. +0 −972 ruby/rinari/test/rails-app/public/javascripts/dragdrop.js
  58. +0 −1,120 ruby/rinari/test/rails-app/public/javascripts/effects.js
  59. +0 −4,225 ruby/rinari/test/rails-app/public/javascripts/prototype.js
  60. +0 −5 ruby/rinari/test/rails-app/public/robots.txt
  61. +0 −3 ruby/rinari/test/rails-app/script/about
  62. +0 −3 ruby/rinari/test/rails-app/script/console
  63. +0 −3 ruby/rinari/test/rails-app/script/dbconsole
  64. +0 −3 ruby/rinari/test/rails-app/script/destroy
  65. +0 −3 ruby/rinari/test/rails-app/script/generate
  66. +0 −3 ruby/rinari/test/rails-app/script/performance/benchmarker
  67. +0 −3 ruby/rinari/test/rails-app/script/performance/profiler
  68. +0 −3 ruby/rinari/test/rails-app/script/performance/request
  69. +0 −3 ruby/rinari/test/rails-app/script/plugin
  70. +0 −3 ruby/rinari/test/rails-app/script/process/inspector
  71. +0 −3 ruby/rinari/test/rails-app/script/process/reaper
  72. +0 −3 ruby/rinari/test/rails-app/script/process/spawner
  73. +0 −3 ruby/rinari/test/rails-app/script/runner
  74. +0 −3 ruby/rinari/test/rails-app/script/server
  75. +0 −7 ruby/rinari/test/rails-app/test/fixtures/examples.yml
  76. +0 −7 ruby/rinari/test/rails-app/test/fixtures/newones.yml
  77. +0 −8 ruby/rinari/test/rails-app/test/functional/example_controller_test.rb
  78. +0 −8 ruby/rinari/test/rails-app/test/functional/newone_controller_test.rb
  79. +0 −10 ruby/rinari/test/rails-app/test/functional/units_controller_test.rb
  80. +0 −38 ruby/rinari/test/rails-app/test/test_helper.rb
  81. +0 −10 ruby/rinari/test/rails-app/test/unit/example_test.rb
  82. +0 −8 ruby/rinari/test/rails-app/test/unit/newone_test.rb
  83. +0 −213 ruby/rinari/util/cucumber-mode-compilation.el
  84. +0 −350 ruby/rinari/util/inf-ruby.el
  85. +0 −1 ruby/rinari/util/jump/.gitignore
  86. +0 −12 ruby/rinari/util/jump/README
  87. +0 −24 ruby/rinari/util/jump/Rakefile
  88. +0 −258 ruby/rinari/util/jump/findr.el
  89. +0 −151 ruby/rinari/util/jump/inflections.el
  90. +0 −312 ruby/rinari/util/jump/jump.el
  91. +0 −338 ruby/rinari/util/jump/test/elunit.el
  92. +0 −107 ruby/rinari/util/jump/test/init.el
  93. +0 −7 ruby/rinari/util/jump/test/jump-fake-app/animals/chicken.rb
  94. +0 −19 ruby/rinari/util/jump/test/jump-fake-app/animals/pig.rb
  95. +0 −19 ruby/rinari/util/jump/test/jump-fake-app/foods/pork.rb
  96. +0 −317 ruby/rinari/util/jump/which-func.el
  97. +0 −30 ruby/rinari/util/ruby-compilation-rspec.el
  98. +0 −303 ruby/rinari/util/ruby-compilation.el
Sorry, we could not display the entire diff because it was too big.
View
3 .gitmodules
@@ -0,0 +1,3 @@
+[submodule "ruby/rinari"]
+ path = ruby/rinari
+ url = git://github.com/eschulte/rinari.git
View
22 init.el
@@ -13,10 +13,10 @@
;; LOOK and FEEL
(add-to-list 'default-frame-alist '(font . "Monospace-10"))
-(add-to-list 'default-frame-alist '(top . 70))
-(add-to-list 'default-frame-alist '(left . 30))
+;;(add-to-list 'default-frame-alist '(top . 70))
+;;(add-to-list 'default-frame-alist '(left . 30))
(add-to-list 'default-frame-alist '(height . 50))
-(add-to-list 'default-frame-alist '(width . 150))
+(add-to-list 'default-frame-alist '(width . 140))
(tool-bar-mode -1)
(set-scroll-bar-mode 'right)
@@ -36,8 +36,8 @@
(color-theme-initialize)
(add-to-list 'load-path "~/.emacs.d/themes")
-(require 'railscasts)
-(color-theme-railscasts)
+;;(require 'railscasts)
+;;(color-theme-railscasts)
(set-cursor-color "gray30")
(set-face-attribute 'mode-line nil
@@ -85,6 +85,7 @@
;; LINE NUMBERS
(setq linum-format "%4d")
(setq column-number-mode t)
+(setq fill-column 100)
;; IDO MODE
(require 'ido)
@@ -136,12 +137,20 @@ global-semantic-stickyfunc-mode))
(setq-default c-default-style "bsd")
;;(add-hook 'c-mode-common-hook '(lambda() (setq tab-width 4)))
+;; SHEBANG
+(add-to-list 'interpreter-mode-alist '("ruby1.9" . ruby-mode))
+(add-to-list 'interpreter-mode-alist '("python2.6" . python-mode))
+
;; LATEX
(add-hook 'LaTeX-mode-hook (lambda()
(add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex%(mode)%' %t" TeX-run-TeX nil t))
(setq TeX-command-default "XeLaTeX")
(setq TeX-save-query nil)
(setq TeX-show-compilation t)))
+(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
+(add-hook 'LaTeX-mode-hook 'company-mode)
+(add-hook 'LaTeX-mode-hook 'flyspell-mode)
+(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(setq TeX-PDF-mode t)
(defun pdfevince ()
@@ -191,7 +200,8 @@ global-semantic-stickyfunc-mode))
(setq ecb-tip-of-the-day nil)
(setq ecb-create-layout-file "~/.emacs.d/ecb-user-layouts.el")
-(setq ecb-layout-name "leftright-custom")
+;;(setq ecb-layout-name "leftright-custom")
+(setq ecb-layout-name "left13")
(setq ecb-fix-window-size (quote width))
(setq ecb-windows-width 30)
(setq ecb-show-sources-in-directories-buffer (quote ("left7" "left13" "left14" "left15" "leftright-custom")))
1 ruby/rinari
@@ -0,0 +1 @@
+Subproject commit f6f36a86fe2639b438488477437a921dc26c89ea
View
3 ruby/rinari/.gitignore
@@ -1,3 +0,0 @@
-*~
-*.elc
-ELPA
View
6 ruby/rinari/.gitmodules
@@ -1,6 +0,0 @@
-[submodule "util/jump"]
- path = util/jump
- url = git://github.com/eschulte/jump.el.git
-[submodule "util/test/ert"]
- path = util/test/ert
- url = git://github.com/nex3/ert.git
View
17 ruby/rinari/README
@@ -1,17 +0,0 @@
-Rinari Is Not A Ruby IDE.
-
-Well, ok it kind of is. Rinari is an Emacs minor mode that is aimed
-towards making Emacs into a top-notch Ruby and Rails development
-environment.
-
-For a screencast of Rinari see
-http://vimeo.com/2854412
-
-For the latest version see
-http://github.com/eschulte/rinari/tree/master
-
-For instillation instruction and documentation see
-http://rinari.rubyforge.org
-
-For discussion of Ruby on Rails related Emacs development see
-http://groups.google.com/group/emacs-on-rails
View
187 ruby/rinari/Rakefile
@@ -1,187 +0,0 @@
-require 'readline'
-require 'find'
-
-MYDIR = File.dirname(__FILE__)
-DOCDIR = "#{MYDIR}/doc"
-TESTDIR = "#{MYDIR}/test"
-
-desc "extract and clean files for submission to ELPA"
-task :elpa do
- elpa_dir = File.join(MYDIR, "ELPA")
- FileUtils.rm_rf(elpa_dir) if File.exists?(elpa_dir)
- FileUtils.mkdir(elpa_dir)
- ["rinari.el",
- File.join("util", "ruby-mode.el"),
- File.join("util", "inf-ruby.el"),
- File.join("util", "ruby-compilation.el")].each do |file|
- FileUtils.cp(file, elpa_dir)
- file = File.join(elpa_dir, File.basename(file))
- contents = File.read(file)
- File.open(file, 'w') do |f|
- f.write(contents.gsub(/;;;\#\#\#begin-elpa-ignore[\s\S]+;;;\#\#\#end-elpa-ignore[\r\n]/m, ''))
- end
- end
-end
-
-namespace "test" do
-
- desc "Run tests using `emacs-snapshot'"
- task :snapshot do
- system "emacs-snapshot -Q -l #{TESTDIR}/init.el"
- end
-
- desc "Run tests using `emacs-22'"
- task :twenty_two do
- system "emacs22 -Q -l #{TESTDIR}/init.el"
- end
-
- desc "Run tests using `emacs'"
- task :emacs do
- system "emacs -Q -l #{TESTDIR}/init.el"
- end
-
-end
-
-namespace "doc" do
-
- desc "Compile the html documentation"
- task :make_html do
- system "makeinfo --html #{DOCDIR}/rinari.texi"
- end
-
- desc "Compile info documentation"
- task :make_info do
- system "makeinfo #{DOCDIR}/rinari.texi"
- end
-
- desc "Install info documentation"
- task :install_info => :make_info do
- system "sudo install-info #{DOCDIR}/rinari.info"
- end
-
- desc "Remove compiled documentation"
- task :clean do
- system "rm -rf #{DOCDIR}/rinari" if FileTest.exists? "#{DOCDIR}/rinari"
- system "rm #{DOCDIR}/rinari.info" if FileTest.exists? "#{DOCDIR}/rinari.info"
- end
-
-end
-
-task :default => :'test:emacs'
-
-# some git tasks taken from the rubinius
-def git_branch
- `git branch | grep "*"`.strip[2..-1]
-end
-
-def compare_git_ver
- m = /git version (\d+).(\d+).(\d+)/.match(`git version`.strip)
- return true if m[1].to_i > 1
- return false if m[1].to_i < 1
- return true if m[2].to_i > 5
- return false if m[2].to_i < 5
- return true if m[3].to_i >= 3
- return false
-end
-
-def check_git_ver
- raise "Invalid git version, use at least 1.5.3" unless compare_git_ver
-end
-
-namespace :git do
-
- desc "Show the current status of the checkout"
- task :status do
- system "git status"
- end
-
- desc "Create a new topic branch"
- task :topic do
- total = `git branch`.scan("quick").size
- if total == 0
- default = "quick"
- else
- default = "quick#{total + 1}"
- end
- name = Readline.readline "Topic name (default #{default}): "
- if name.strip.empty?
- name = default
- end
- sh "git checkout -b #{name}"
- end
-
- desc "Push all changes to the repository"
- task :push => :update do
- branch = git_branch()
- if branch != "master"
- `git diff-files --quiet`
- if $?.exitstatus == 1
- puts "You have outstanding changes. Please commit them first."
- exit 1
- end
-
- puts "* Merging topic '#{branch}' back into master..."
- `git checkout master`
- sh "git merge #{branch}"
- switch = true
- else
- switch = false
- end
-
- puts "* Pushing changes..."
- sh "git push"
-
- if switch
- puts "* Switching back to #{branch}..."
- `git checkout #{branch}`
- end
- end
-
- desc "Pull new commits from the repository"
- task :update do
- check_git_ver
- `git diff-files --quiet`
- if $?.exitstatus == 1
- stash = true
- clear = `git stash list`.scan("\n").size == 0
- puts "* Saving changes..."
- `git stash save`
- else
- stash = false
- end
-
- branch = git_branch()
- if branch != "master"
- switch = true
- `git checkout master`
- puts "* Switching back to master..."
- else
- switch = false
- end
-
- puts "* Pulling in new commits..."
- sh "git fetch"
- sh "git rebase origin"
-
- if switch
- puts "* Porting changes into #{branch}..."
- `git checkout #{branch}`
- sh "git rebase master"
- end
-
- if stash
- puts "* Applying changes..."
- sh "git stash apply"
- `git stash clear` if clear
- end
- end
-
- task :pull => :update
-
- desc "remove all .git folders from the directory"
- task :clean do
- Find.find("./"){|f| FileUtils.rm_rf(f) if f =~ /\.git.*/}
- end
-
-end
-# end some git tasks taken from the rubinius
View
538 ruby/rinari/TODO
@@ -1,538 +0,0 @@
-# -*- mode: org -*-
-#+TITLE: TODO
-#+SEQ_TODO: TODO WAITING | DONE CANCELLED MAYBE PARTIAL
-#+DRAWERS: SNIP
-#+CATEGORY: rinari
-
-List of tasks for rinari
-
-for documentation see [[http://rinari.rubyforge.org/]]
-for background see http://groups.google.com/group/emacs-on-rails
-
-* TODO Document changing jump keybindings
-* TODO Document Xemacs support
-* TODO full test coverage (ERT) [0/2]
-- [ ] movement tests
- - [ ] controller
- - [ ] view
- - [ ] model
- - [ ] test
- - [ ] rspec
-- [ ] compilation tests
- - [ ] console
- - [ ] web-server
- - [ ] test
- - [ ] sql
- - [ ] script
-
-switch from using elunit.el to ert.el for testing
-
-* TODO Merb support [2/4]
- :PROPERTIES:
- :suggested-by: Jorge Calás Lozano
- :END:
-
-** DONE new Merb Root
-
-I think it's better to rely on config/init.rb that file should be on
-every merb project, merb.thor doesn't, in fact my "library" project
-doesn't have it.
-
-** DONE pull into rinari-merb
-rinari-merb (minami? why not just rinari-merb? what if someone create a
-rinari version for sinatra? sinasi?)
-
-** TODO load automatically
-it doesn't load automatically when you visit a project file or the
-project directory (with dired). So I should call minami-minor-mode
-
-** TODO jump support
-jump: it doesn't really jump, but seems to look for the correct paths,
-at least that is what *Messages* buffer says:
-
-("app/controllers/\\1.rb" "asset")
-Searching /home/jorge/dev/jorgecalas/library/app/models/app/controllers/ ...
-("app/controllers/\\1.rb" "assets")
-("app/controllers/\\1.rb" "asset")
-Searching /home/jorge/dev/jorgecalas/library/app/models/app/controllers/
-... [2 times]
-
-When I'm on the project directory (dired) it finds files correctly,
-right now I tried minami-find-model, minami-find-controller.
-
-minami-find-rspec:
-
-In the current merb you don't don't have spec/controllers or spec/views
-(although you can, of course) but spec/requests is encourage. So
-app/controllers/assets.rb should map spec/requests/assets_spec.rb
-
-* DONE submit to ELPA
-get rinari (and all of it's dependencies) into [[http://tromey.com/elpa/][ELPA]] the Emacs Lisp
-Package Archive
-
-* DONE create a screencast
-promotion!!
-
-now up with the online documentation [[http://rinari.rubyforge.org/]]
-
-* DONE add find-by context
- :PROPERTIES:
- :suggested-by: vylu
- :END:
-
-Hi Eric,
-As I understand, we are talking here about rinari-find-by-context
-function, which is used to open file by current context. For example
-if I am in <%= render :partial => "something_anything" %>, it should
-open _something_anything.html.erb partial. This functionality is still
-left in rhtml mode (although it is broken there), but I think it
-should be moved to rinari again.
-
-Follow any of the following within two lines (up or down)
-- stylesheet
-- javascript
-- link_to
-- link_to_remote
-- submit_tag
-- render
-
-* DONE improvements to finders
- :PROPERTIES:
- :suggested-by: vylu
- :END:
-
-** DONE Stop suggesting files upon first found
-
-#+begin_comment vylu
-
-I see one problem probably related to latest rinari-find changes... If
-specific version of a find DO NOT fail (for example, I try to open
-controller from model and controller is found), requested file is
-opened, but find-file promt is still left -- I have to press C-g to
-close file-find or choose another file. I think, find-file promt
-should be shown only if requested file is not found.
-
-#+end_comment
-
-** default to a more general find upon failure
-When finding a view from a controller if there is no method name, then
-select from the related directory.
-
-more generally...
-
-if rinari-find-* is called with a prefix argument then just run the
-default find at the end
-
-or even better...
-
-*implemented* if no file is found with a find pair, then keep moving.
-
-** TODO complex controllers
- :PROPERTIES:
- :suggested-by: rejeep
- :END:
-
-> But say I have this controller and action:
-> class Reports::Nix::UsersController < ReportsController
-> def index
-> # I am here
-> end
-> end
->
-> And now I do the same thing, trying to find the view:
-> M-x rinari-find-view
->
-> But no view is found in this case. The corresponding view in this case
-> should have been app/views/reports/nix/users/index.html.erb.
->
-
-Hi,
-
-I've never encountered that situation before. It sounds like when going
-from a controller to a view splitting the controller name on :: and then
-joining the parts as directories would handle this situation. And then
-vise-versa going from a view to a controller. I'll try to implement
-this and let you know when it's working.
-
-Thanks for the suggestion -- Eric
-
-* DONE upodate documentation for instillation
- :PROPERTIES:
- :suggested-by: Antti
- :END:
-need to add =git submodule init; git submodule update= to clone the
-submodules as well
-
-* MAYBE windows support
- :PROPERTIES:
- :tested-by: Darren Syzling
- :END:
-jumping between views, and launching servers and consoles etc... all
-seem to work, the only hurdle now is a rinari-rake issue
-
- rinari-rake however fails with: apply: Spawning child process:
- invalid argument. Haven't had the chance to look into and debug this
- further. I'm currently using cygwin as my shell within emacs so not
- sure if this causing some issues.
-
-#+BEGIN_EXAMPLE
-Backtrace for rinari-rake error (Spawning child process:exec format error) is:
-
- start-process("rake" #<buffer *rake*> "rake" "package")
- apply(start-process "rake" #<buffer *rake*> "rake" "package")
- comint-exec-1("rake" #<buffer *rake*> "rake" ("package"))
- comint-exec(#<buffer *rake*> "rake" "rake" nil ("package"))
- make-comint-in-buffer("rake" nil "rake" nil "package")
- apply(make-comint-in-buffer "rake" nil "rake" nil "package")
- make-comint("rake" "rake" nil "package")
- apply(make-comint "rake" "rake" nil "package")
- (let* ((buffer ...) (proc ...)) (save-excursion (set-buffer buffer)
-(set-process-sentinel proc ...) (set-process-filter proc ...) (set ...
-ruby-compilation-error-regexp-alist) (set ... ...)
-(compilation-minor-mode t) (ruby-compilation-minor-mode t)))
- (if (comint-check-proc comp-buffer-name) nil (let* (... ...)
-(save-excursion ... ... ... ... ... ... ...)))
- (unless (comint-check-proc comp-buffer-name) (let* (... ...)
-(save-excursion ... ... ... ... ... ... ...)))
- (let ((comp-buffer-name ...)) (unless (comint-check-proc
-comp-buffer-name) (let* ... ...)) comp-buffer-name)
- ruby-do-run-w/compilation("rake" ("rake" "package"))
- (pop-to-buffer (ruby-do-run-w/compilation "rake" (cons "rake" ...)))
- (let* ((task ...) (rake-args ...)) (pop-to-buffer
-(ruby-do-run-w/compilation "rake" ...)))
- ad-Orig-ruby-rake-w/compilation(nil nil)
- (setq ad-return-value (ad-Orig-ruby-rake-w/compilation edit task))
- (let ((default-directory ...)) (setq ad-return-value
-(ad-Orig-ruby-rake-w/compilation edit task)) (rinari-launch))
- (let (ad-return-value) (let (...) (setq ad-return-value ...)
-(rinari-launch)) ad-return-value)
- ruby-rake-w/compilation(nil nil)
- rinari-rake(nil)
- call-interactively(rinari-rake)
-#+END_EXAMPLE
-
-* MAYBE inf-ruby missing errors
-
-found an example of an error that the
-`inferior-ruby-error-regexp-alist' in inf-ruby.el doesn't match
-
-this was the error line
-
-:SNIP:
-SyntaxError: /home/eschulte/united/org/work/arf/arf/lib/cluster.rb:35: syntax error, unexpec
-:END:
-
-* MAYBE ruby-compilation missing errors
-
-found a line which didn't match the error-regexp-alist
-
-:SNIP:
-test_create(QueriesControllerTest) [/home/eschulte/work/arf/arf/test/functional/queries_controller_test.rb:60]:
-:END:
-
-and another
-
-:SNIP:
- /var/lib/gems/1.8/gems/mongrel-1.1.3/bin/mongrel_rails:281
-:END:
-
-* DONE rinari movement [5/5]
-
-From anywhere, get to the related model/controller/test/view
-
-where can you be?
-- view
-- controller
-- model
-- unit-test
-- functional-test
-- other
-
-pending...
-- [X] still need to work on movement from OTHER places
-- [X] look at a better keybinding setup
-- [X] rails2 style view names
-- [X] code refactor:
-- [X] regexps in method names
-
-** code refactor
-
-actually I'm thinking that when I have time it would be worthwhile to
-remove toggle, and handle all of the movement through a new
-independent toggle-like tool say "toggle-hassle" which uses an alist
-like toggle, but instead of elements like
-
-Done see http://github.com/eschulte/jump.el/tree/master
-
-* DONE add yaml,css,javascript,ruby pointers to the documentation
-
-* DONE write up some info documentation for Rinari
-
-- [X] making progress in [[file:doc/rinari.texi]]
-
-- [X] might want to add information for installing the documentation
-
-- [X] also post it up to rinari.ruby-forge.org
-
-* DONE define macro for ido completion
-since we often want to check the availability of ido for completing
-reads it would probably be worth writing a macro to do this.
-
-also, it may be worthwhile breaking utility functions out into a
-separate file...
-
-* DONE Make rinari a minor mode that doesn't activate for regular ruby-mode.
- :PROPERTIES:
- :assignee: eschulte
- :END:
-
-look at [[info:elisp:Minor%20Mode%20Conventions][info:elisp:Minor Mode Conventions]]
-
-** DONE define as a minor mode
-** DONE when to enter rinari-minor-mode
-this could be done through a hook that runs every time a .rb or .rhtml
-file is loaded to check if it is inside of a rails project (using the
-`rails-root' function or a .emacs-project file) and then to load
-rinari-minor-mode appropriately
-
-done with hooks on find-file and dired-mode
-
-** DONE add key-bindings for rinari minor mode
-should follow emacs key bindings
-
-see [[info:elisp:Key%20Binding%20Conventions][info:elisp:Key Binding Conventions]]
-
-:SNIP:
- * Sequences consisting of `C-c' followed by a control character or a
- digit are reserved for major modes.
-
- * Sequences consisting of `C-c' followed by `{', `}', `<', `>', `:'
- or `;' are also reserved for major modes.
-
- * Sequences consisting of `C-c' followed by any other punctuation
- character are allocated for minor modes. Using them in a major
- mode is not absolutely prohibited, but if you do that, the major
- mode binding may be shadowed from time to time by minor modes.
-:END:
-
-given the above, it seems like an ergonomic option would be to start
-all our rinari key-bindings with \C-c-' with \C-c-'-' running
-something similar to \C-c\C-c in org-mode
-
-* DONE change toggle for incremental search
-
-so something like search_incrementally will match search if
-incrementally isn't available
-
-also, push the "def "s into the variable in toggle.el to try to keep
-it language-agnostic
-* DONE project-wide search and search/replace
-
-I know you can do this with rgrep, but It would be nice to easily call
-it on the whole project (yml/rhtml/rb files), and it would help guide
-emacs noobs to the powers of rgrep
-
-Danger here is cluttering up Rinari with thin wrappers around existing
-emacs tools...
-
-rinari-rgrep
-
-* DONE errors / tests
-something to speed up the cycle of
-
-- code
-- test
-- review errors
-
-this should probably cash out into two different functions...
-
-** DONE rails-test-method
-
-*** DONE enhance toggle so that it can match up function names as well
-see [[file:toggle.el::if%20string%20match%20new%20name][methods in toggle-buffer]]
-
-*** DONE rinari-test-function will now try to toggle if needed
-
-see [[file:rinari.el::defun%20rinari%20test%20function][rinari-test-function]]
-
-*** CANCELLED use the same mechanism as find view
-maybe instead of using the current buffer-file change
-[[file:rinari.el::defun%20rails%20name%20components%20name][rails-name-components-name]] so it returns the last component as well,
-then change the controller usage of this function to drop the last
-list element. That way this can be used to get model names when
-calling which-function from models/model.rb files.
-
-Also, if you don't have a test written for this particular method this
-could insert the def...end for the test into the appropriate file, and
-drop the point there. Nothing wrong with a little bit of soft
-paternalism.
-* DONE add a function for running mysql
-this would use the information in /conf/databases.yaml to log into the
-application's database using sql-* functions from sql.el as
-appropriate
-
-* DONE make rails-find-action follow forms and link_to[_remote]
-
-see [[file:rinari.el::defun%20rinari%20alist%20from%20view][rinari-alist-from-view]]
-
-* DONE rinari-rake uses ruby-compilation
-* DONE remove rails-script add ruby-compilation
-
-it turns out most of the bulk of rails-script.el was supporting
-running ruby processes with output going to compilation buffers. So
-rails-script.el is now removed (with two short functions in rinari.el
-[[file:rinari.el::defun%20rinari%20console%20optional%20arg][rinari-console]] and [[file:rinari.el::defun%20rinari%20server][rinari-server]]), also ruby-compilation has been
-added.
-
-** DONE move through compilation buffers
-
-redefine some keys buffers to make it easier to navigate.
-
-n will go to the next line
-p will go to the previous line
-
-C-n next error line
-C-p previous error line
-
-M-n top of the next group of errors
-M-p top of the previous group of errors [[file:rails-script.el::defun%20rails%20compilation%20previous%20error%20group][previous-group]]
-
-so if you just saw an error on a web page, you can see that error in
-three key commands
-
-1) X-b *server*
-p2) M-p
-3) enter
-
-*** old
-a function which either...
-1) goes to the error closest to point in the current compilation mode
- buffer
-2) goes to the most recent error in the *server*, *console*, or *test*
- buffer
-
-See this discussion below from the emacs-on-rails list...
-
-email discussion:
-:SNIP:
-> - maybe add a command which can jump to the most recent error (either
-> in the server logs, or in the console)
-
-> > That's a great idea. find-file-at-point is pretty good at doing this
-> > from test failures in eshell, but you have to move your point up to the
-> > line containing the error message. Leveraging logs and console output
-> > would be a great addition as would looking for lines somewhere other
-> > than just under the point.
->
-> So there are two different possible ways to approach this...
->
-> 1) through a function which searches in known places (eshell, logs,
-> consoles, server buffers, in current buffer) and makes an educated
-> guess about what to present to the user, possibly allowing quick
-> switching to the other errors.
-
-Hmm... now that I think about it more, I'm not sure it's a good idea to
-make it really convenient to go around digging through server logs to
-find errors. The right way to go about solving that kind of problem is
-to write a test for it. If you make it easier to fix the problem without
-writing a test, really what that amounts to is short-term benefit but
-long-term problems since your fix isn't guaranteed to be caught by the
-test suite.
-
-So I would discourage integration with the dev mongrel logs. The bonus
-side of that is if we only have to help jump to errors/failures in test
-output it becomes a lot easier. There are in my mind three common ways
-of running tests:
-
-- In an emacs shell, whether that's eshell, M-x shell, or ansi-term
-- With compile-mode, as per the ruby-test-file function in rinari
-- In a shell outside Emacs
-
-So if we check console output it will work in the first two cases but
-not in the last. I think it's best to always check the test logs, since
-problems are pretty much guaranteed to be found in there. This also
-solves the integration test problem; when you're running those and you
-get an exception, the only console output you see is that you expected a
-200 response but you got a 500, which is totally useless. In those cases
-you have to check the logs anyway.
-
-We could probably base this functionality on compilation mode. It's
-already built to go over output looking for something that looks like a
-stack trace and provide jumping to the source of the error:
-
-http://www.emacswiki.org/cgi-bin/wiki/CompilationMode
-
-> 2) wrap console, and server processes in insertion-filters which could
-> notice whenever an error passes through them, and save a pointer to
-> the error in some global rails-errors variable which could be
-> queried by jump-to-my-last-error type function
->
-> I was originally leaning towards the latter, but now that you mention
-> it the former might be easier... not sure
-
-Yeah, the second one sounds a lot harder.
-:END:
-
-* DONE launch web-browser to current view
- add a quick command to view the current page in a web-browser
-
-* DONE unified runner for rails scripts
-
-This is less a single runner, and more a single function from which
-any rails/script can be executed associating the scripts with
-appropriate buffers and modes.
-
-Currently this
-- runs console from a buffer in comint-mode
-- runs server dumping output to a compilation-minor-mode buffer
-- provides completion for generate/destroy
-- runs all other scripts using shell-command-to-string dumping the
- output to a message
-
-** DONE if web-server doesn't start change status message
-currently there is no indication that the attempt to start the server
-has failed
-
-now has a sentinel, see [[elisp:(describe-function 'set-process-sentinel)]]
-* DONE revert and wrap find-file-in-project
- :PROPERTIES:
- :assignee: eschulte
- :END:
-
-revert to the .emacs-project version of find-file-in-project so that
-the actual find-file-in-project.el file remains unchanged. Then using
-defadvice wrap the ffip function to find the project base using
-(rails-root) as well as the .emacs-project file.
-
-* DONE Name functions consistently
-some global prefix for all of the function names, probably either
-"rails" or "rinari"
-
-going for rails for now
-- easier to remember
-- easy enough to change later
-
-switching to rinari
-
-while I'm doing this I'm going to rename rails-scripts.rl to
-rails-script.el (minor)
-
-easy enough
-
-
- LocalWords: elsif elseif keybinding
-
-* CANCELLED bundles
-** DONE rhtml (from original rinari)
-see
-- [[http://rinari.rubyforge.org/rhtml_002dMode.html#rhtml_002dMode]]
-- [[http://github.com/eschulte/rhtml/tree/master]]
-
-** rdebug
-- [[http://bashdb.sourceforge.net/ruby-debug.html#SEC_Top]]
-** DONE snippets
-see http://github.com/eschulte/yasnippets-rails/tree/master
-* CANCELLED adjust eshell/shell environment to highlight ruby errors
-not sure this is possible, at least not easily
-
-
View
2 ruby/rinari/doc/.gitignore
@@ -1,2 +0,0 @@
-rinari
-rinari.info
View
512 ruby/rinari/doc/rinari.texi
@@ -1,512 +0,0 @@
-\input texinfo
-@c %**start of header
-@setfilename doc/rinari.info
-@settitle Rinari: Ruby on Rails Minor Mode for Emacs
-
-@set DATE July 2008
-
-@dircategory Emacs
-@direntry
-* Rinari Minor Mode: (Rinari). Ruby on Rails Framework Support
-@end direntry
-
-@c Version and Contact Info
-@c @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
-@set AUTHOR Eric Schulte
-@set MAINTAINER Eric Schulte
-@set MAINTAINEREMAIL @email{schulte dot eric at gmail dot com}
-@set MAINTAINERCONTACT @uref{mailto:schulte dot eric at gmail dot com,contact the maintainer}
-@c %**end of header
-@finalout
-
-@copying
-This manual is for Rinari. A Ruby on Rails Minor Mode for Emacs.
-
-Copyright @copyright{} 2008 Eric Schulte, 2006 - 2007 Phil Hagelberg,
-Forrest Chang, Ryan Davis, Paul Stickne, and others
-
-(This manual is modeled off of the very fine org-mode info documentation.)
-
-@end copying
-
-@titlepage
-@title Using Rinari
-
-@subtitle Ruby on Rails Minor Mode
-@author by Eric Schulte
-
-@c The following two commands start the copyright page.
-@page
-@vskip 0pt plus 1fill
-@insertcopying
-@end titlepage
-
-@c Output the table of contents at the beginning.
-@contents
-
-@ifnottex
-@node Top, Introduction, (dir), (dir)
-@top Rinari
-
-@insertcopying
-@end ifnottex
-
-@b{Contents}
-
-@menu
-* Introduction:: Brief summary of what Rinari is (and isn't)
-* Install:: Installing Rinari in your Emacs
-* Navigation:: Jumping between files in your Rails project
-* Test/Behavior Driven Development:: Support for Test Driven Development
-* Execution:: Running tests, consoles, and web-servers
-* Miscellaneous:: Leftover functions
-* Add Ons:: Additional Emacs tools that work well with Rinari and Rails
-@end menu
-
-@b{Links}
-
-@itemize
-@item Project page on rubyforge @uref{http://rubyforge.org/projects/rinari/}
-@item Latest versions available at
- @uref{http://github.com/eschulte/rinari/tree/master}
-@item Post Questions/Comments to
-@uref{http://groups.google.com/group/emacs-on-rails}
-@item For an html version of this documentation see
- @uref{http://rinari.rubyforge.org/}
-@item For information on the previous version of Rinari see
- @uref{http://rinari.rubyforge.org/old.html}
-@end itemize
-
-@node Introduction, Install, Top, Top
-@chapter Introduction
-@cindex introduction
-
-@b{R}inari @b{I}s @b{N}ot @b{A} @b{R}uby @b{I}DE.
-
-Well, OK it kind of is. Rinari is a set of Emacs Lisp functions aimed
-towards making Emacs (or XEmacs) into a top-notch Ruby on Rails
-development environment.
-
-Currently Rinari focuses on the core functionality most everyone would
-use when working on a Rails applications including...
-
-@itemize
-@item @emph{Navigation} between files in your Rails project (@pxref{Navigation})
-@item Facilitation of @emph{Test/Behavior Driven Development} (@pxref{Test/Behavior Driven Development})
-@item @emph{Execution} of tests, consoles, and web-servers (@pxref{Execution})
-@end itemize
-
-Rinari does not deal with syntax highlighting for rhtml files (or
-.html.erb from here on out all erb templated html files will be referred
-to as ``rhtml'' files), while all of the Rinari functions will be
-available from within your rhtml files you are free to chose from the
-many stand-alone options for editing rhtml files (@pxref{Rhtml Setup}).
-
-Rinari development is fueled largely by the discussion on the mailing
-list at @uref{http://groups.google.com/group/emacs-on-rails}. If you
-have any questions, comments, or suggestions for improving Rinari please
-take them to the list. The latest version of Rinari will always be
-available at @uref{http://github.com/eschulte/rinari/tree/master}.
-
-@node Install, Basic Setup, Introduction, Top
-@chapter Install
-@cindex install
-
-@b{Emacs}
-
-Having a working copy and working knowledge of Emacs are definite
-prerequisites for using Rinari.
-
-@itemize
-@item For information on obtaining and installing emacs see
-@uref{www.gnu.org/software/emacs/} or
-@uref{http://en.wikipedia.org/wiki/Emacs}.
-@item If you are new to Emacs or any of the following doesn't make sense
-to you, read through the Emacs tutorial. To do so open Emacs and press
-@code{C-ht} (meaning press the ``h'' key while holding down the ``Ctrl''
-key and then press the ``t'' key).
-@end itemize
-
-@b{ELPA}
-
-Rinari and the Major Modes mentioned below are now available through
-ELPA (the ``Emacs List Package Archive'') see
-@uref{http://tromey.com/elpa/} for more information on using ELPA to
-install Rinari.
-
-@b{Emacs Starter Kit}
-
-Available at
-@uref{http://github.com/technomancy/emacs-starter-kit/tree/master}, the
-Emacs Starter Kit contains a good default Emacs setup and comes
-pre-bundled with many useful packages including Rinari and relevant Ruby
-and web development Major Modes. This can be a good way for beginners
-to get a jump start on their Emacs setup and for experienced Emacs users
-to organize their setup and see many new tools they may have missed.
-
-@b{Major Modes}
-
-There are a collection of Major Modes which are useful when working on a
-Rails project (not the least of which is Ruby-Mode!). You might want to
-check this Major Mode List (@pxref{Add Ons}) to ensure that you aren't
-missing anything vital.
-
-@b{Manual Rinari Setup}
-
-@menu
-* Basic Setup:: The minimum required to get going with Rinari
-* Rhtml Setup:: Select and setup a Major mode for rhtml files
-* Optional Setup:: Some additional setup options
-@end menu
-
-@b{From here on out}
-
-The remainder of this document describes the functions and usage of
-Rinari in detail. To see all of the functions provided by rinari try
-@code{C-hb} then search for rinari, or @code{M-x rinari-<tab>}.
-
-@node Basic Setup, Rhtml Setup, Install, Install
-@section Basic Setup
-@cindex Basic Setup
-
-The latest Rinari can be obtained from
-@uref{http://github.com/eschulte/rinari/tree/master}. Select the
-``download'' button to grab an archive of the source code, or checkout a
-copy using git (@b{Note}: when cloning Rinari using git it is necessary
-to explicitly update the submodules included with Rinari) by executing
-the following.
-
-@example
-git clone git://github.com/eschulte/rinari.git
-cd rinari
-git submodule init
-git submodule update
-@end example
-
-Place the base rinari directory into your Emacs lisp directory. To
-automatically load Rinari every time you open Emacs add these lines of
-code to your .emacs file:
-
-@lisp
- ;; Interactively Do Things (highly recommended, but not strictly required)
- (require 'ido)
- (ido-mode t)
-
- ;; Rinari
- (add-to-list 'load-path "~/path/to/your/elisp/rinari")
- (require 'rinari)
-@end lisp
-
-@node Rhtml Setup, Optional Setup, Basic Setup, Install
-@section Rhtml Setup
-@cindex Rhtml Setup
-
-There are three options for editing .rhtml files in Emacs. They are
-presented here in order of decreasing functionality.
-
-@menu
-* nXhtml-Mode:: a package for web development
-* MuMaMo-Mode:: allows multiple major modes in a single buffer
-* rhtml-Mode:: edit rhtml files without using multiple major modes
-@end menu
-
-@node nXhtml-Mode, MuMaMo-Mode, Rhtml Setup, Rhtml Setup
-@subsection nXhtml-Mode
-@cindex nXhtml-Mode
-
-nXhtml-Mode is a package for web development with Emacs. For more
-information see
-@uref{http://www.emacswiki.org/cgi-bin/wiki/NxhtmlMode#toc1}.
-
-To use nXhtml-Mode mode download it from
-@uref{http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html}. Then save
-the resulting directory into your elisp directory and add the following
-to your Emacs init file (replacing ``nxml-directory'' with the name of
-your downloaded nxml directory).
-
-@lisp
-;;; nxml (HTML ERB template support)
-(load "~/path/to/your/elisp/nxml-directory/autostart.el")
-
-(setq
- nxhtml-global-minor-mode t
- mumamo-chunk-coloring 'submode-colored
- nxhtml-skip-welcome t
- indent-region-mode t
- rng-nxml-auto-validate-flag nil
- nxml-degraded t)
-(add-to-list 'auto-mode-alist '("\\.html\\.erb$" . eruby-nxhtml-mumamo-mode))
-@end lisp
-
-@node MuMaMo-Mode, rhtml-Mode, nXhtml-Mode, Rhtml Setup
-@subsection MuMaMo-Mode
-@cindex MuMaMo-Mode
-
-MuMaMo-Mode allow @b{Mu}ltiple @b{Ma}jor @b{Mo}des in a single Emacs
-buffer. For more information see
-@uref{http://www.emacswiki.org/cgi-bin/wiki/MuMaMo}.
-
-MuMaMo-Mode comes bundled with nXhtml-Mode, so to install it download
-nXhtml-Mode from
-@uref{http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html}. To use
-MuMaMo-Mode when editing rhtml files, save the resulting directory into
-your elisp directory, then add the following to your Emacs init file
-(replacing ``nxml-directory'' with the name of your downloaded nxml
-directory).
-
-@lisp
-;; MuMaMo-Mode for rhtml files
-(add-to-list 'load-path "~/path/to/your/elisp/nxml-directory/util")
-(require 'mumamo-fun)
-(setq mumamo-chunk-coloring 'submode-colored)
-(add-to-list 'auto-mode-alist '("\\.rhtml$" . eruby-html-mumamo-mode))
-(add-to-list 'auto-mode-alist '("\\.html\\.erb$" . eruby-html-mumamo-mode))
-@end lisp
-
-@node rhtml-Mode, , MuMaMo-Mode, Rhtml Setup
-@subsection rhtml-Mode
-@cindex rhtml-Mode
-
-@emph{rhtml-mode} is part of the original Rinari project. It allows
-editing of rhtml projects without having to use the often flaky MMM-Mode
-@uref{http://www.emacswiki.org/cgi-bin/wiki/MultipleModes}.
-@emph{rhtml-mode} is presented here as an alternate option to
-nxhtml-mode which doesn't work for many people.
-
-To use @emph{rhtml-mode} for editing rhtml files, download the rhtml
-directory from @uref{http://github.com/eschulte/rhtml/tree/master} and
-place it in your elisp directory, then include the following in you
-emacs .init file
-
-@lisp
-;;; rhtml-mode
-(add-to-list 'load-path "~/path/to/your/elisp/rhtml")
-(require 'rhtml-mode)
-(add-hook 'rhtml-mode-hook
- (lambda () (rinari-launch)))
-@end lisp
-
-
-@node Optional Setup, Navigation, Rhtml Setup, Install
-@section Optional Setup
-@cindex Optional Setup
-
-@b{documentation}
-
-To make and install the info documentation cd into @code{rinari}
-directory and run the following rake command (you must have super user
-privileges to install the info documentation).
-
-@example
-rake doc:install_info
-@end example
-
-To make an html version of the documentation cd into the @code{rinari}
-directory and run the following rake command.
-
-@example
-rake doc:make_html
-@end example
-
-@b{ido-mode}
-
-While ido-mode
-@uref{http://www.emacswiki.org/cgi-bin/wiki/InteractivelyDoThings} is
-not strictly required it is very helpful in combination with many of
-Rinari functions. Also, the Rinari functions were developed using
-ido-mode and may not work well in it's absence. For more information
-about enabling ido-mode see the link below, or to just go ahead and try
-it out add the following to your emacs init file.
-
-@lisp
-;; Interactively Do Things
-(require 'ido)
-(ido-mode t)
-@end lisp
-
-@b{TAGS}
-
-To have Rinari automatically update your @code{tags-file-name} variable
-to point to the tags of your current rails project, set
-@code{rinari-tags-file-name} (@pxref{Navigation}) to the path to your
-tags file relative to the root of your rails applications.
-
-@lisp
-(setq rinari-tags-file-name "TAGS")
-@end lisp
-
-@node Navigation, Test/Behavior Driven Development, Optional Setup, Top
-@chapter Navigation
-@cindex navigation
-
-Rinari leverages the structure of Rails projects to allow immediate
-navigation between source files.
-
-So for example if you are in a buffer open to @emph{foo_controller.rb},
-a call to @code{rinari-find-model} will open the @emph{foo.rb} model
-file. Say you are currently inside the @emph{bar} method in a buffer
-visiting @emph{foo_controller.rb}, then calling @code{rinari-find-test}
-will take you to the @emph{test_bar} method in
-@emph{test/functional/foo_controller_test.rb}, or calling
-@code{rinari-find-view} will open @emph{app/views/foos/bar.rhtml}.
-
-All told there are currently 17 different rinari-find-* functions, which
-are all bound to similar hopefully intuitive keybindings allowing you to
-go anywhere from anywhere. To see the full range of rinari-find
-functions along with their bindings enter a rails project, activate
-rinari and call describe-bindings @code{\H-b}. The current list is also
-shown below.
-
-@example
-C-c ; f c rinari-find-controller
-C-c ; f e rinari-find-environment
-C-c ; f f rinari-find-file-in-project
-C-c ; f h rinari-find-helper
-C-c ; f i rinari-find-migration
-C-c ; f j rinari-find-javascript
-C-c ; f l rinari-find-plugin
-C-c ; f m rinari-find-model
-C-c ; f n rinari-find-configuration
-C-c ; f o rinari-find-log
-C-c ; f p rinari-find-public
-C-c ; f s rinari-find-script
-C-c ; f t rinari-find-test
-C-c ; f v rinari-find-view
-C-c ; f w rinari-find-worker
-C-c ; f x rinari-find-fixture
-C-c ; f y rinari-find-stylesheet
-@end example
-
-@b{TAGS (jumping to method definitions)}
-
-Emacs (as all grownup text editors should) makes use of tags (for a
-description of tags and their use see
-@uref{http://ctags.sourceforge.net/whatis.html}). In Emacs the
-@code{find-tag} command is bound by default to @code{M-.}. It is often
-convenient to use a different set of TAGS for every rails project.
-Rinari facilitates this by automatically updating your
-@code{tags-file-name} variable whenever you enter a rails project,
-through the use of the @code{rinari-tags-file-name} variable. Just set
-@code{rianri-tags-file} to the path to your tags files relative to the
-root of the rails project. For example...
-
-@lisp
-(setq rinari-tags-file-name "TAGS")
-@end lisp
-
-to create such a tags file using exuberant ctags
-(@uref{http://ctags.sourceforge.net/}) try executing something like the
-following from the root of your rails project.
-
-@example
-ctags-exuberant -a -e -f TAGS --tag-relative -R app lib vendor
-@end example
-
-@node Test/Behavior Driven Development, Execution, Navigation, Top
-@chapter Test/Behavior Driven Development
-@cindex test/behavior driven development
-
-Rinari facilitates a development style reliant upon unit and functional
-tests by providing a single command @code{rinari-test} which executes
-the unit or functional test related to the current buffer and method.
-The results of the test are dumped into an emacs Compilation buffer
-which allows jumping between error messages and the related source code.
-
-@defun rinari-test
-Test the current ruby function. If current function is not a
-test, then try to jump to the related test and run it. Dump
-output to a compilation buffer allowing jumping between errors
-and source code.
-@end defun
-
-@node Execution, Miscellaneous, Test/Behavior Driven Development, Top
-@chapter Execution
-@cindex execution
-
-Some Rails tools work better inside of emacs. Specifically running rake
-tasks, tests, console, the web-server, and browsing your SQL database.
-Rinari provides functions for running all of these tools inside
-specialized emacs buffers.
-
-@defun rinari-rake
-Tab completion selection of a rake task to execute with the output
-dumped to a compilation buffer allowing jumping between errors and
-source code. With optional prefix argument allows editing of the rake
-command.
-@end defun
-
-@defun rinari-console
-"Run script/console in a compilation buffer, with command
-history and links between errors and source code. Use a prefix
-argument to edit command line options."
-@end defun
-
-@defun rinari-sql
-Browse the application's database. Looks up login information from your
-conf/database.sql file.
-@end defun
-
-@defun rinari-web-server
-Run script/server. Dump output to a compilation buffer allowing jumping
-between errors and source code.
-@end defun
-
-@defun rinari-test
-Test the current ruby function. If current function is not a test, then
-try to jump to the related test using `rinari-find-test'. Dump output
-to a compilation buffer allowing jumping between errors and source code.
-@end defun
-
-@node Miscellaneous, Add Ons, Execution, Top
-@chapter Miscellaneous
-@cindex Miscellaneous
-
-Miscellaneous functions...
-
-@defun rinari-rgrep
-Search through the rails project using `rgrep' for a string or `regexp'.
-With optional prefix argument just run `rgrep'.
-@end defun
-
-@defun rinari-insert-erb-skeleton
-Insert an erb skeleton at point, with optional prefix argument don't
-include an '='.
-@end defun
-
-@node Add Ons, , Miscellaneous, Top
-@chapter Add Ons
-@cindex Add Ons
-
-Previous versions of both emacs-rails mode, and Rinari were very feature
-rich, but bloated and cumbersome. To maintain a small, clean, reliable,
-functional, and hackable core Rinari will shun much of the ``bells and
-whistles'' type functionality. However that is not to say that these
-extra goodies might not be useful.
-
-This page should serve as marshaling point for links to some other
-tools/packages that work well with Rinari and Rails in general. If you
-have any ideas for additions to this list, or for new Rinari features
-please let us know at
-@uref{http://groups.google.com/group/emacs-on-rails}.
-
-@b{Essential Major Modes for working with Rails}
-@itemize
-@item @b{Ruby Mode}, and some other general Ruby-Emacs goodies can be found in the @code{/misc} directory
-of your ruby distribution and at
-@uref{http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/}
-@item @b{YAML Mode} @uref{http://www.emacswiki.org/cgi-bin/wiki/YamlMode}
-@item @b{CSS Mode} @uref{http://www.emacswiki.org/cgi-bin/emacs/css-mode-simple.el}
-@item @b{JavaScript Mode} @uref{http://www.emacswiki.org/cgi-bin/wiki/JavaScriptMode#toc1}
-@end itemize
-
-@b{Other Tools}
-@itemize
-@item @b{Rhtml Mode} Minor Mode for editing rhtml files (without MMM-Mode) @pxref{rhtml-Mode}
-@item @b{Snippets} @uref{http://code.google.com/p/yasnippet/} and
-@b{Rails snippets} @uref{http://github.com/eschulte/yasnippets-rails/tree/master}
-@item @b{ruby-debug} support
-@uref{http://groups.google.com/group/emacs-on-rails/browse_thread/thread/dfaa224905b51487}
-@item @b{ido Mode} @uref{http://www.emacswiki.org/cgi-bin/wiki/InteractivelyDoThings}
-@end itemize
-
-@bye
View
554 ruby/rinari/rinari-merb.el
@@ -1,554 +0,0 @@
-;;; rinari-merb.el --- Rinari-Merb Is Not A Merb IDE
-
-;; Copyright (C) 2008 Phil Hagelberg, Eric Schulte
-
-;; Authors: Phil Hagelberg, Eric Schulte
-;; Keywords: ruby, rails, project, convenience, web, merb
-
-;; This file is NOT part of GNU Emacs.
-
-;;; License:
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Commentary:
-
-;; Rinari-Merb Is Not A Merb IDE.
-
-;; Well, ok it kind of is. Rinari-Merb is a set of Emacs Lisp modes
-;; that is aimed towards making Emacs into a top-notch Ruby and Rails
-;; development environment.
-
-;; Copy the directory containing this file into your Emacs lisp
-;; directory, assumed here to be ~/.emacs.d. Add these lines of code
-;; to your .emacs file:
-
-;; ;; ido
-;; (require 'ido)
-;; (ido-mode t)
-;; ;; rinari-merb
-;; (add-to-list 'load-path "~/.emacs.d/rinari-merb")
-;; (require 'rinari-merb)
-
-;; Note: if you cloned this from a git repo, you probably have to grab
-;; the submodules which can be done simply with the following commands
-;; from the root of the rinari-merb directory
-
-;; git submodule init
-;; git submodule update
-
-;; See TODO file in this directory.
-
-;;; Code:
-(let* ((this-dir (file-name-directory (or load-file-name buffer-file-name)))
- (util-dir (file-name-as-directory
- (expand-file-name "util" this-dir)))
- (jump-dir (file-name-as-directory
- (expand-file-name "jump" util-dir))))
- (add-to-list 'load-path this-dir)
- (add-to-list 'load-path util-dir)
- (add-to-list 'load-path jump-dir))
-(require 'ruby-mode)
-(require 'inf-ruby)
-(require 'ruby-compilation)
-(require 'jump)
-(require 'cl)
-
-(defcustom rinari-merb-tags-file-name
- "TAGS"
- "Path to your TAGS file inside of your rails project. See `tags-file-name'."
- :group 'rinari-merb)
-
-(defvar rinari-merb-minor-mode-hook nil
- "*Hook for customising Rinari-Merb.")
-
-(defadvice ruby-compilation-run (around rinari-merb-compilation-run activate)
- "Set default directory to the root of the rails application
- before running ruby processes."
- (let ((default-directory (or (rinari-merb-root) default-directory)))
- ad-do-it
- (rinari-merb-launch)))
-
-(defadvice ruby-compilation-rake (around rinari-merb-compilation-rake activate)
- "Set default directory to the root of the rails application
- before running rake processes."
- (let ((default-directory (or (rinari-merb-root) default-directory)))
- ad-do-it
- (rinari-merb-launch)))
-
-(defun rinari-merb-parse-yaml ()
- (let ((start (point))
- (end (save-excursion (re-search-forward "^$" nil t) (point)))
- alist)
- (while (and (< (point) end)
- (re-search-forward "^ *:?\\(.*\\): \\(.*\\)$" nil t))
- (setf alist (cons (cons (match-string 1) (match-string 2)) alist)))
- alist))
-
-(defun rinari-merb-root (&optional dir home)
- (or dir (setq dir default-directory))
- (if (file-exists-p (expand-file-name
- "init.rb"
- (file-name-as-directory (expand-file-name "config" dir))))
- dir
- (let ((new-dir (expand-file-name (file-name-as-directory "..") dir)))
- (unless (string-match "\\(^[[:alpha:]]:/$\\|^/$\\)" dir)
- (rinari-merb-root new-dir)))))
-
-;;--------------------------------------------------------------------------------
-;; user functions
-
-(defun rinari-merb-rake (&optional task edit-cmd-args)
- "Tab completion selection of a rake task to execute with the
-output dumped to a compilation buffer allowing jumping between
-errors and source code. With optional prefix argument allows
-editing of the rake command arguments."
- (interactive "P")
- (ruby-compilation-rake task edit-cmd-args))
-
-(defun rinari-merb-script (&optional script)
- "Tab completing selection of a script from the script/
-directory of the rails application."
- (interactive)
- (let* ((root (rinari-merb-root))
- (script (or script
- (completing-read "Script: " (directory-files (concat root "script") nil "^[^.]"))))
- (ruby-compilation-error-regexp-alist ;; for jumping to newly created files
- (if (equal script "generate")
- '(("^ +\\(exists\\|create\\) +\\([^[:space:]]+\\.rb\\)" 2 3))
- ruby-compilation-error-regexp-alist))
- (script (concat "script/" script " ")))
- (ruby-compilation-run (concat root script (read-from-minibuffer script)))))
-
-(defun rinari-merb-test (&optional edit-cmd-args)
- "Test the current ruby function. If current function is not a
-test, then try to jump to the related test using
-`rinari-merb-find-test'. Dump output to a compilation buffer allowing
-jumping between errors and source code. With optional prefix
-argument allows editing of the test command arguments."
- (interactive "P")
- (or (string-match "spec" (or (ruby-add-log-current-method)
- (file-name-nondirectory (buffer-file-name))))
- (rinari-merb-find-rspec))
- (let* ((funname (ruby-add-log-current-method))
- (fn (and funname
- (string-match "#\\(.*\\)" funname)
- (match-string 1 funname)))
- (path (buffer-file-name))
- (default-command (if fn
- (concat path " --name /" fn "/")
- path))
- (command (if edit-cmd-args
- (read-string "Run w/Compilation: " default-command)
- default-command)))
- (if path (ruby-compilation-run command)
- (message "no test available"))))
-
-(defun rinari-merb-console (&optional edit-cmd-args)
- "Run script/console in a compilation buffer, with command
-history and links between errors and source code. With optional
-prefix argument allows editing of the console command arguments."
- (interactive "P")
- (rinari-merb-merb "console" "-i" edit-cmd-args))
-
-(defun rinari-merb-sql ()
- "Browse the application's database. Looks up login information
-from your conf/database.sql file."
- (interactive)
- (flet ((sql-name (env) (format "*%s-sql*" env)))
- (let* ((environment (or (getenv "RAILS_ENV") "development"))
- (sql-buffer (get-buffer (sql-name environment))))
- (if sql-buffer
- (pop-to-buffer sql-buffer)
- (let* ((database-alist (save-excursion
- (with-temp-buffer
- (insert-file-contents
- (expand-file-name
- "database.yml"
- (file-name-as-directory
- (expand-file-name "config" (rinari-merb-root)))))
- (goto-char (point-min))
- (re-search-forward (concat "^:?" environment ":"))
- (rinari-merb-parse-yaml))))
- (adapter (or (cdr (assoc "adapter" database-alist)) "sqlite"))
- (sql-user (or (cdr (assoc "username" database-alist)) "root"))
- (sql-password (or (cdr (assoc "password" database-alist)) ""))
- (sql-database (or (cdr (assoc "database" database-alist))
- (concat (file-name-nondirectory (rinari-merb-root))
- "_" environment)))
- (server (or (cdr (assoc "host" database-alist)) "localhost"))
- (port (cdr (assoc "port" database-alist)))
- (sql-server (if port (concat server ":" port) server)))
- (if (string-match "sqlite" adapter) (setf adapter "sqlite"))
- (eval (list (intern (concat "sql-" adapter))))
- (rename-buffer (sql-name environment)) (rinari-merb-launch))))))
-
-(defun rinari-merb-merb (&optional name args edit-cmd-args)
- "Run merb. Dump output to a compilation buffer
-allowing jumping between errors and source code. With optional
-prefix argument allows editing of the server command arguments."
- (interactive "P")
- (let* ((default-directory (rinari-merb-root))
- (name (if name name "server"))
- (args (if args args ""))
- (args (if edit-cmd-args
- (read-from-minibuffer "Edit Merb Command: " args)
- args)))
- (pop-to-buffer (ruby-compilation-do
- name (cons "merb"
- (ruby-args-to-list args))))
- (rinari-merb-launch)))
-
-(defun rinari-merb-insert-erb-skeleton (no-equals)
- "Insert an erb skeleton at point, with optional prefix argument
-don't include an '='."
- (interactive "P")
- (insert "<%") (unless no-equals (insert "=")) (insert " %>")
- (backward-char 3))
-
-(defun rinari-merb-extract-partial (begin end partial-name)
- (interactive "r\nsName your partial: ")
- (let* ((path (buffer-file-name)) ending)
- (if (string-match "view" path)
- (let ((ending (and (string-match ".+?\\(\\..*\\)" path)
- (match-string 1 path)))
- (partial-name
- (replace-regexp-in-string "[[:space:]]+" "_" partial-name)))
- (kill-region begin end)
- (if (string-match "\\(.+\\)/\\(.+\\)" partial-name)
- (let ((default-directory (expand-file-name (match-string 1 partial-name)
- (expand-file-name ".."))))
- (find-file (concat "_" (match-string 2 partial-name) ending)))
- (find-file (concat "_" partial-name ending)))
- (yank) (pop-to-buffer nil)
- (insert (concat "<%= render :partial => '" partial-name "' %>\n")))
- (message "not in a view"))))
-
-(defvar rinari-merb-rgrep-file-endings
- "*.[^l]*"
- "Ending of files to search for matches using `rinari-merb-rgrep'")
-
-(defun rinari-merb-rgrep (&optional arg)
- "Search through the rails project for a string or `regexp'.
-With optional prefix argument just run `rgrep'."
- (interactive "P")
- (grep-compute-defaults)
- (if arg (call-interactively 'rgrep)
- (let ((word (thing-at-point 'word)))
- (funcall 'rgrep (read-from-minibuffer "search for: " word)
- rinari-merb-rgrep-file-endings (rinari-merb-root)))))
-
-;;--------------------------------------------------------------------
-;; rinari-merb movement using jump.el
-
-(defun rinari-merb-generate (type name)
- (message (shell-command-to-string
- (format "ruby %sscript/generate %s %s" (rinari-merb-root) type
- (read-from-minibuffer (format "create %s: " type) name)))))
-
-(defvar rinari-merb-ruby-hash-regexp
- "\\(:[^[:space:]]*?\\)[[:space:]]*\\(=>[[:space:]]*[\"\':]?\\([^[:space:]]*?\\)[\"\']?[[:space:]]*\\)?[,){}\n]"
- "Regexp to match subsequent key => value pairs of a ruby hash.")
-
-(defun rinari-merb-ruby-values-from-render (controller action)
- "Adjusts CONTROLLER and ACTION acording to keyword arguments in
-the hash at `point', then return (CONTROLLER . ACTION)"
- (let ((end (save-excursion
- (re-search-forward "[^,{(]$" nil t)
- (+ 1 (point)))))
- (save-excursion
- (while (and (< (point) end)
- (re-search-forward rinari-merb-ruby-hash-regexp end t))
- (if (> (length (match-string 3)) 1)
- (case (intern (match-string 1))
- (:partial (setf action (concat "_" (match-string 3))))
- (:action (setf action (match-string 3)))
- (:controller (setf controller (match-string 3)))))))
- (cons controller action)))
-
-(defun rinari-merb-which-render (renders)
- (let ((path (jump-completing-read
- "Follow: "
- (mapcar (lambda (lis)
- (concat (car lis) "/" (cdr lis)))
- renders))))
- (string-match "\\(.*\\)/\\(.*\\)" path)
- (cons (match-string 1 path) (match-string 2 path))))
-
-(defun rinari-merb-follow-controller-and-action (controller action)
- "Follow the current controller-and-action through all of the
-renders and redirects to find the final controller or view."
- (save-excursion ;; if we can find the controller#action pair
- (if (and (jump-to-path (format "app/controllers/%s_controller.rb#%s" controller action))
- (equalp (jump-method) action))
- (let ((start (point)) ;; demarcate the borders
- (renders (list (cons controller action))) render view)
- (ruby-forward-sexp)
- ;; collect redirection options and pursue
- (while (re-search-backward "re\\(?:direct_to\\|nder\\)" start t)
- (add-to-list 'renders (rinari-merb-ruby-values-from-render controller action)))
- (let ((render (if (equalp 1 (length renders))
- (car renders)
- (rinari-merb-which-render renders))))
- (if (and (equalp (cdr render) action)
- (equalp (car render) controller))
- (list controller action) ;; directed to here so return
- (rinari-merb-follow-controller-and-action (or (car render)
- controller)
- (or (cdr render)
- action)))))
- ;; no controller entry so return
- (list controller action))))
-
-(setf
- rinari-merb-jump-schema
- '((model
- "m"
- (("app/controllers/\\1.rb#\\2" . "app/models/\\1.rb#\\2")
- ("app/views/\\1/.*" . "app/models/\\1.rb")
- ("app/helpers/\\1_helper.rb" . "app/models/\\1.rb")
- ("schema/migrations/.*_\\1_migration.rb" . "app/models/\\1.rb")
- ("spec/models/\\1_spec.rb" . "app/models/\\1.rb")
- ("spec/controllers/\\1_spec.rb". "app/models/\\1.rb")
- ("spec/views/\\1/.*" . "app/models/\\1.rb")
- ("spec/fixtures/\\1.yml" . "app/models/\\1.rb")
- ("test/functional/\\1_controller_test.rb" . "app/models/\\1.rb")
- ("test/unit/\\1_test.rb#test_\\2" . "app/models/\\1.rb#\\2")
- ("test/unit/\\1_test.rb" . "app/models/\\1.rb")
- ("test/fixtures/\\1.yml" . "app/models/\\1.rb")
- (t . "app/models/"))
- (lambda (path)
- (rinari-merb-generate "model"
- (and (string-match ".*/\\(.+?\\)\.rb" path)
- (match-string 1 path)))))
- (controller
- "c"
- (("app/models/\\1.rb" . "app/controllers/\\1.rb")
- ("app/views/\\1/\\2\\..*" . "app/controllers/\\1.rb#\\2")
- ("app/helpers/\\1_helper.rb" . "app/controllers/\\1.rb")
- ("schema/migrations/.*_\\1_migration.rb" . "app/controllers/\\1.rb")
- ("spec/models/\\1_spec.rb" . "app/controllers/\\1.rb")
- ("spec/controllers/\\1_spec.rb" . "app/controllers/\\1.rb")
- ("spec/views/\\1/\\2\\.*_spec.rb" . "app/controllers/\\1.rb#\\2")
- ("spec/fixtures/\\1.yml" . "app/controllers/\\1.rb")
- ("test/functional/\\1_test.rb#test_\\2" . "app/controllers/\\1.rb#\\2")
- ("test/functional/\\1_test.rb" . "app/controllers/\\1.rb")
- ("test/unit/\\1_test.rb#test_\\2" . "app/controllers/\\1.rb#\\2")
- ("test/unit/\\1_test.rb" . "app/controllers/\\1.rb")
- ("test/fixtures/\\1.yml" . "app/controllers/\\1.rb")
- (t . "app/controllers/"))
- (lambda (path)
- (rinari-merb-generate "controller"
- (and (string-match ".*/\\(.+?\\)_controller\.rb" path)
- (match-string 1 path)))))
- (view
- "v"
- (("app/models/\\1.rb" . "app/views/\\1/.*")
- ((lambda () ;; find the controller/view
- (let* ((raw-file (and (buffer-file-name)
- (file-name-nondirectory (buffer-file-name))))
- (file (and raw-file
- (string-match "^\\(.*\\)_controller.rb" raw-file)
- (match-string 1 raw-file))) ;; controller
- (raw-method (ruby-add-log-current-method))
- (method (and file raw-method ;; action
- (string-match "#\\(.*\\)" raw-method)
- (match-string 1 raw-method))))
- (if (and file method) (rinari-merb-follow-controller-and-action file method))))
- . "app/views/\\1/\\2.*")
- ("app/helpers/\\1_helper.rb" . "app/views/\\1/.*")
- ("schema/migrations/.*_\\1_migration.rb" . "app/views/\\1/.*")
- ("spec/models/\\1_spec.rb" . "app/views/\\1/.*")
- ("spec/controllers/\\1_spec.rb" . "app/views/\\1/.*")
- ("spec/views/\\1/\\2_spec.rb" . "app/views/\\1/\\2.*")
- ("spec/fixtures/\\1.yml" . "app/views/\\1/.*")
- ("test/functional/\\1_controller_test.rb" . "app/views/\\1/.*")
- ("test/unit/\\1_test.rb#test_\\2" . "app/views/\\1/_?\\2.*")
- ("test/fixtures/\\1.yml" . "app/views/\\1/.*")
- (t . "app/views/.*"))
- t)
- (test
- "t"
- (("app/models/\\1.rb#\\2" . "test/unit/\\1_test.rb#test_\\2")
- ("app/controllers/\\1.rb#\\2" . "test/functional/\\1_test.rb#test_\\2")
- ("app/views/\\1/_?\\2\\..*" . "test/functional/\\1_controller_test.rb#test_\\2")
- ("app/helpers/\\1_helper.rb" . "test/functional/\\1_controller_test.rb")
- ("schema/migrations/.*_\\1_migration.rb" . "test/unit/\\1_test.rb")
- ("test/functional/\\1_controller_test.rb" . "test/unit/\\1_test.rb")
- ("test/unit/\\1_test.rb" . "test/functional/\\1_controller_test.rb")
- (t . "test/.*"))
- t)
- (rspec
- "r"
- (("app/models/\\1.rb" . "spec/models/\\1_spec.rb")
- ("app/controllers/\\1.rb" . "spec/controllers/\\1_spec.rb")
- ("app/views/\\1\\..*" . "spec/views/\\1_spec.rb")
- ("schema/migrations/.*_\\1_migration.rb" . "spec/models/\\1_spec.rb")
- ("spec/views/\\1_spec.rb" . "app/views/\\1")
- ("spec/\\1_spec.rb" . "app/\\1.rb")
- (t . "spec/.*"))
- t)
- (fixture
- "x"
- (("app/models/\\1.rb" . "test/fixtures/\\1.yml")
- ("app/controllers/\\1.rb" . "test/fixtures/\\1.yml")
- ("app/views/\\1/.*" . "test/fixtures/\\1.yml")
- ("app/helpers/\\1_helper.rb" . "test/fixtures/\\1.yml")
- ("schema/migrations/.*_\\1_migration.rb" . "test/fixtures/\\1.yml")
- ("spec/models/\\1_spec.rb" . "test/fixtures/\\1.yml")
- ("spec/controllers/\\1_spec.rb". "test/fixtures/\\1.yml")
- ("spec/views/\\1/.*" . "test/fixtures/\\1.yml")
- ("test/functional/\\1_controller_test.rb" . "test/fixtures/\\1.yml")
- ("test/unit/\\1_test.rb" . "test/fixtures/\\1.yml")
- (t . "test/fixtures/"))
- t)
- (rspec-fixture
- "z"
- (("app/models/\\1.rb" . "spec/fixtures/\\1.yml")
- ("app/controllers/\\1.rb" . "spec/fixtures/\\1.yml")
- ("app/views/\\1/.*" . "spec/fixtures/\\1.yml")
- ("app/helpers/\\1_helper.rb" . "spec/fixtures/\\1.yml")
- ("schema/migrations/.*_\\1_migration.rb" . "spec/fixtures/\\1.yml")
- ("spec/models/\\1_spec.rb" . "spec/fixtures/\\1.yml")
- ("spec/controllers/\\1_spec.rb". "spec/fixtures/\\1.yml")
- ("spec/views/\\1/.*" . "spec/fixtures/\\1.yml")
- ("test/functional/\\1_controller_test.rb" . "spec/fixtures/\\1.yml")
- ("test/unit/\\1_test.rb" . "spec/fixtures/\\1.yml")
- (t . "spec/fixtures/"))
- t)
- (helper
- "h"
- (("app/models/\\1.rb" . "app/helpers/\\1_helper.rb")
- ("app/controllers/\\1.rb" . "app/helpers/\\1_helper.rb")
- ("app/views/\\1/.*" . "app/helpers/\\1_helper.rb")
- ("app/helpers/\\1_helper.rb" . "app/helpers/\\1_helper.rb")
- ("schema/migrations/.*_\\1_migration.rb" . "app/helpers/\\1_helper.rb")
- ("spec/models/\\1_spec.rb" . "app/helpers/\\1_helper.rb")
- ("spec/controllers/\\1_spec.rb" . "app/helpers/\\1_helper.rb")
- ("spec/views/\\1/.*" . "app/helpers/\\1_helper.rb")
- ("test/functional/\\1_controller_test.rb" . "app/helpers/\\1_helper.rb")
- ("test/unit/\\1_test.rb#test_\\2" . "app/helpers/\\1_helper.rb#\\2")
- ("test/unit/\\1_test.rb" . "app/helpers/\\1_helper.rb")
- (t . "app/helpers/"))
- t)
- (migration
- "i"
- (("app/controllers/\\1.rb" . "schema/migrations/.*_\\1_migration.rb")
- ("app/views/\\1/.*" . "schema/migrations/.*_\\1_migration.rb")
- ("app/helpers/\\1_helper.rb" . "schema/migrations/.*_\\1_migration.rb")
- ("app/models/\\1.rb" . "schema/migrations/.*_\\1_migration.rb")
- ("spec/models/\\1_spec.rb" . "schema/migrations/.*_\\1_migration.rb")
- ("spec/controllers/\\1_spec.rb" . "schema/migrations/.*_\\1_migration.rb")
- ("spec/views/\\1/.*" . "schema/migrations/.*_\\1_migration.rb")
- ("test/functional/\\1_controller_test.rb" . "schema/migrations/.*_\\1_migration.rb")
- ("test/unit/\\1_test.rb#test_\\2" . "schema/migrations/.*_\\1_migration.rb#\\2")
- ("test/unit/\\1_test.rb" . "schema/migrations/.*_\\1_migration.rb")
- (t . "schema/migrations/"))
- (lambda (path)
- (rinari-merb-generate "migration"
- (and (string-match ".*create_\\(.+?\\)\.rb" path)
- (match-string 1 path)))))
- (environment "e" ((t . "config/environments/")) nil)
- (configuration "n" ((t . "config/")) nil)
- (script "s" ((t . "script/")) nil)
- (lib "l" ((t . "lib/")) nil)
- (log "o" ((t . "log/")) nil)
- (worker "w" ((t . "lib/workers/")) nil)
- (public "p" ((t . "public/")) nil)
- (stylesheet "y" ((t . "public/stylesheets/.*")) nil)
- (javascript "j" ((t . "public/javascripts/.*")) nil)
- (plugin "l" ((t . "vendor/plugins/")) nil)
- (file-in-project "f" ((t . ".*")) nil)))
-
-(mapcar
- (lambda (type)
- (let ((name (first type))
- (specs (third type))
- (make (fourth type)))
- (eval `(defjump
- (quote ,(read (format "rinari-merb-find-%S" name)))
- (quote ,specs)
- 'rinari-merb-root
- ,(format "Go to the most logical %S given the current location" name)
- ,(if make `(quote ,make))
- 'ruby-add-log-current-method))))
- rinari-merb-jump-schema)
-
-;;--------------------------------------------------------------------
-;; minor mode and keymaps
-
-(defvar rinari-merb-minor-mode-map
- (let ((map (make-sparse-keymap)))
- map)
- "Key map for Rinari-Merb minor mode.")
-
-(defun rinari-merb-bind-key-to-func (key func)
- (eval `(define-key rinari-merb-minor-mode-map
- ,(format "\C-c;%s" key) ,func))
- (eval `(define-key rinari-merb-minor-mode-map
- ,(format "\C-c'%s" key) ,func)))
-
-(defvar rinari-merb-minor-mode-keybindings
- '(("s" . 'rinari-merb-script) ("q" . 'rinari-merb-sql)
- ("e" . 'rinari-merb-insert-erb-skeleton) ("t" . 'rinari-merb-test)
- ("r" . 'rinari-merb-rake) ("c" . 'rinari-merb-console)
- ("m" . 'rinari-merb-merb) ("g" . 'rinari-merb-rgrep)
- ("w" . 'rinari-merb-merb) ("x" . 'rinari-merb-extract-partial))
- "alist mapping of keys to functions in `rinari-merb-minor-mode'")
-
-(mapcar (lambda (el) (rinari-merb-bind-key-to-func (car el) (cdr el)))
- (append (mapcar (lambda (el)
- (cons (concat "f" (second el))
- (read (format "'rinari-merb-find-%S" (first el)))))
- rinari-merb-jump-schema)
- rinari-merb-minor-mode-keybindings))
-
-(defun rinari-merb-launch ()
- "Run `rinari-merb-minor-mode' if inside of a rails projecct,
-otherwise turn `rinari-merb-minor-mode' off if it is on."
- (interactive)
- (let* ((root (rinari-merb-root)) (r-tags-path (concat root rinari-merb-tags-file-name)))
- (if root (progn
- (set (make-local-variable 'tags-file-name)
- (and (file-exists-p r-tags-path) r-tags-path))
- (run-hooks 'rinari-merb-minor-mode-hook)
- (rinari-merb-minor-mode t))
- (if rinari-merb-minor-mode (rinari-merb-minor-mode)))))
-
-(defvar rinari-merb-major-modes
- '('find-file-hook 'mumamo-after-change-major-mode-hook 'dired-mode-hook)
- "Major Modes from which to launch Rinari-Merb.")
-
-(mapcar (lambda (hook)
- (eval `(add-hook ,hook
- (lambda () (rinari-merb-launch)))))
- rinari-merb-major-modes)
-
-(defadvice cd (after rinari-merb-on-cd activate)
- "Active/Deactive rinari-merb-minor-node when changing into and out
- of raills project directories."
- (rinari-merb-launch))
-
-;;;###autoload
-(define-minor-mode rinari-merb-minor-mode
- "Enable Rinari-Merb minor mode providing Emacs support for working
-with the Ruby on Rails framework."
- nil
- " Rinari-Merb"
- rinari-merb-minor-mode-map)
-
-(provide 'rinari-merb)
-;;; rinari-merb.el ends here
View
738 ruby/rinari/rinari.el
@@ -1,738 +0,0 @@
-;;; rinari.el --- Rinari Is Not A Rails IDE
-
-;; Copyright (C) 2008 Phil Hagelberg, Eric Schulte
-
-;; Authors: Phil Hagelberg, Eric Schulte
-;; URL: http://rinari.rubyforge.org
-;; Version: 2.1
-;; Created: 2006-11-10
-;; Keywords: ruby, rails, project, convenience, web
-;; EmacsWiki: Rinari
-;; Package-Requires: ((ruby-mode "1.1") (inf-ruby "2.1") (ruby-compilation "0.7") (jump "2.0"))
-
-;; This file is NOT part of GNU Emacs.
-
-;;; License:
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Commentary:
-
-;; Rinari Is Not A Ruby IDE.
-
-;; Well, ok it kind of is. Rinari is a set of Emacs Lisp modes that is
-;; aimed towards making Emacs into a top-notch Ruby and Rails
-;; development environment.
-
-;; Rinari can be installed through ELPA (see http://tromey.com/elpa/)
-
-;; To install from source, copy the directory containing this file
-;; into your Emacs lisp directory, assumed here to be ~/.emacs.d. Add
-;; these lines of code to your .emacs file:
-
-;; ;; rinari
-;; (add-to-list 'load-path "~/.emacs.d/rinari")
-;; (require 'rinari)
-
-;; Whether installed through ELPA or from source you probably want to
-;; add the following lines to your .emacs file:
-
-;; ;; ido
-;; (require 'ido)
-;; (ido-mode t)
-
-;; Note: if you cloned this from a git repo, you will have to grab the
-;; submodules which can be done by running the following commands from
-;; the root of the rinari directory
-
-;; git submodule init
-;; git submodule update
-
-;;; Code:
-;;;###begin-elpa-ignore
-(let* ((this-dir (file-name-directory (or load-file-name buffer-file-name)))
- (util-dir (file-name-as-directory
- (expand-file-name "util" this-dir)))
- (jump-dir (file-name-as-directory
- (expand-file-name "jump" util-dir))))
- (add-to-list 'load-path this-dir)
- (add-to-list 'load-path util-dir)
- (add-to-list 'load-path jump-dir))
-;;;###end-elpa-ignore
-(require 'ruby-mode)
-(require 'inf-ruby)
-(require 'ruby-compilation)
-(require 'jump)
-(require 'cl)
-
-;; fill in some missing variables for XEmacs
-(when (featurep 'xemacs)
- ;;this variable does not exist in XEmacs
- (defvar safe-local-variable-values ())
- ;;find-file-hook is not defined and will otherwise not be called by XEmacs
- (define-compatible-variable-alias 'find-file-hook 'find-file-hooks))
-
-(defgroup rinari nil
- "Rinari customizations."
- :prefix "rinari-"
- :group 'rinari)
-
-(defcustom rinari-tags-file-name
- "TAGS"
- "Path to your TAGS file inside of your rails project. See `tags-file-name'."
- :group 'rinari)
-
-(defvar rinari-minor-mode-hook nil
- "*Hook for customising Rinari.")
-
-(defcustom rinari-rails-env nil
- "Use this to force a value for RAILS_ENV when running rinari.
-Leave this set to nil to not force any value for RAILS_ENV, and
-leave this to the environment variables outside of Emacs.")
-
-(defvar rinari-minor-mode-prefixes
- (list ";" "'")
- "List of characters, each of which will be bound (with C-c) as a rinari-minor-mode keymap prefix.")
-
-(defvar rinari-partial-regex "render :partial *=> *[@'\"]?\\([A-Za-z/_]+\\)['\"]?"
- "Regex that matches a partial rendering call.")
-
-(defadvice ruby-compilation-do (around rinari-compilation-do activate)
- "Set default directory to the root of the rails application
- before running ruby processes."
- (let ((default-directory (or (rinari-root) default-directory)))
- ad-do-it
- (rinari-launch)))
-
-(defadvice ruby-compilation-rake (around rinari-compilation-rake activate)
- "Set default directory to the root of the rails application
- before running rake processes."
- (let ((default-directory (or (rinari-root) default-directory)))
- ad-do-it
- (rinari-launch)))
-
-(defadvice ruby-compilation-cap (around rinari-compilation-cap activate)
- "Set default directory to the root of the rails application
- before running cap processes."
- (let ((default-directory (or (rinari-root) default-directory)))
- ad-do-it
- (rinari-launch)))
-
-(defun rinari-parse-yaml ()
- (let ((start (point))
- (end (save-excursion (re-search-forward "^[^:]*$" nil t) (point)))
- alist)
- (while (and (< (point) end)
- (re-search-forward "^ *\\(.*\\): \\(.*\\)$" nil t))
- (setf alist (cons (cons (match-string 1) (match-string 2)) alist)))
- alist))
-
-(defun rinari-root (&optional dir home)
- (or dir (setq dir default-directory))
- (if (file-exists-p (expand-file-name
- "environment.rb" (expand-file-name "config" dir)))
- dir
- (let ((new-dir (expand-file-name (file-name-as-directory "..") dir)))
- ;; regexp to match windows roots, tramp roots, or regular posix roots
- (unless (string-match "\\(^[[:alpha:]]:/$\\|^/[^\/]+:\\|^/$\\)" dir)
- (rinari-root new-dir)))))
-
-;;--------------------------------------------------------------------------------
-;; user functions
-
-(defun rinari-rake (&optional task edit-cmd-args)
- "Tab completion selection of a rake task to execute with the
-output dumped to a compilation buffer allowing jumping between
-errors and source code. With optional prefix argument allows
-editing of the rake command arguments."
- (interactive "P")
- (ruby-compilation-rake task edit-cmd-args
- (if rinari-rails-env (list (cons "RAILS_ENV" rinari-rails-env)))))
-
-(defun rinari-cap (&optional task edit-cmd-args)
- "Tab completion selection of a capistrano task to execute with
-the output dumped to a compilation buffer allowing jumping
-between errors and source code. With optional prefix argument
-allows editing of the cap command arguments."
- (interactive "P")
- (ruby-compilation-cap task edit-cmd-args
- (if rinari-rails-env (list (cons "RAILS_ENV" rinari-rails-env)))))
-
-(defun rinari-script (&optional script)
- "Tab completing selection of a script from the script/
-directory of the rails application."
- (interactive)
- (let* ((root (rinari-root))
- (script (or script
- (completing-read "Script: " (directory-files (concat root "script") nil "^[^.]"))))
- (ruby-compilation-error-regexp-alist ;; for jumping to newly created files
- (if (equal script "generate")
- '(("^ +\\(exists\\|create\\) +\\([^[:space:]]+\\.rb\\)" 2 3))
- ruby-compilation-error-regexp-alist))
- (script (concat "script/" script " ")))
- (ruby-compilation-run (concat root script (read-from-minibuffer script)))))
-
-(defun rinari-test (&optional edit-cmd-args)
- "Test the current ruby function. If current function is not a
-test, then try to jump to the related test using
-`rinari-find-test'. Dump output to a compilation buffer allowing
-jumping between errors and source code. With optional prefix
-argument allows editing of the test command arguments."
- (interactive "P")
- (or (string-match "test" (or (ruby-add-log-current-method)
- (file-name-nondirectory (buffer-file-name))))
- (rinari-find-test))
- (let* ((funname (ruby-add-log-current-method))
- (fn (and funname
- (string-match "#\\(.*\\)" funname)
- (match-string 1 funname)))
- (path (buffer-file-name))
- (ruby-options (list "-I" (expand-file-name "test" (rinari-root)) path))
- (default-command (mapconcat
- 'identity
- (append (list path) (if fn (list "--name" (concat "/" fn "/"))))
- " "))
- (command (if edit-cmd-args
- (read-string "Run w/Compilation: " default-command)
- default-command)))
- (if path (ruby-compilation-run command ruby-options)
- (message "no test available"))))
-
-(defun rinari-console (&optional edit-cmd-args)
- "Runs a Rails console in a compilation buffer, with command history
-and links between errors and source code. With optional prefix
-argument allows editing of the console command arguments."
- (interactive "P")
- (let* ((default-directory (rinari-root))
- (script (rinari-script-path))
- (command
- (expand-file-name
- (if (file-exists-p (expand-file-name "console" script))
- "console"
- "rails console")
- script)))
-
- ;; Start console in correct environment.
- (if rinari-rails-env
- (setq command (concat command " " rinari-rails-env)))
-
- ;; For customization of the console command with prefix arg.
- (setq command (if edit-cmd-args
- (read-string "Run Ruby: " (concat command " "))
- command))
-
- (run-ruby command)
- (save-excursion
- (set-buffer "*ruby*")
- (set (make-local-variable 'inf-ruby-first-prompt-pattern) "^>> ")
- (set (make-local-variable 'inf-ruby-prompt-pattern) "^>> ")
- (rinari-launch))))
-
-(defun rinari-sql ()
- "Browse the application's database. Looks up login information
-from your conf/database.sql file."
- (interactive)
- (flet ((sql-name (env) (format "*%s-sql*" env)))
- (let* ((environment (or rinari-rails-env (getenv "RAILS_ENV") "development"))
- (sql-buffer (get-buffer (sql-name environment))))
- (if sql-buffer
- (pop-to-buffer sql-buffer)
- (let* ((database-alist (save-excursion
- (with-temp-buffer
- (insert-file-contents
- (expand-file-name
- "database.yml"
- (file-name-as-directory
- (expand-file-name "config" (rinari-root)))))
- (goto-char (point-min))
- (re-search-forward (concat "^" environment ":"))
- (rinari-parse-yaml))))
- (adapter (or (cdr (assoc "adapter" database-alist)) "sqlite"))
- (sql-user (or (cdr (assoc "username" database-alist)) "root"))
- (sql-password (or (cdr (assoc "password" database-alist)) ""))
- (sql-password (if (> (length sql-password) 0) sql-password nil))
- (sql-database (or (cdr (assoc "database" database-alist))
- (concat (file-name-nondirectory (rinari-root))
- "_" environment)))
- (server (or (cdr (assoc "host" database-alist)) "localhost"))
- (port (cdr (assoc "port" database-alist)))
- (sql-server (if port (concat server ":" port) server)))
- (if (string-match "sqlite" adapter) (setf adapter "sqlite"))
- (eval (list (intern (concat "sql-" adapter))))
- (rename-buffer (sql-name environment)) (rinari-launch))))))
-
-(defun rinari-web-server (&optional edit-cmd-args)
- "Starts a Rails webserver. Dumps output to a compilation buffer
-allowing jumping between errors and source code. With optional prefix
-argument allows editing of the server command arguments."
- (interactive "P")
- (let* ((default-directory (rinari-root))
- (script (rinari-script-path))
- (command
- (expand-file-name
- (if (file-exists-p (expand-file-name "server" script))
- "server"
- "rails server")
- script)))
-
- ;; Start web server in correct environment.
- ;; NOTE: Rails 3 has a bug and does not start in any environment but development for now.
- (if rinari-rails-env
- (setq command (concat command " -e " rinari-rails-env)))
-
- ;; For customization of the web server command with prefix arg.
- (setq command (if edit-cmd-args
- (read-string "Run Ruby: " (concat command " "))
- command))
-
- (ruby-compilation-run command))
- (rinari-launch))
-
-(defun rinari-web-server-restart (&optional edit-cmd-args)
- "If rinari-web-server is running, kill it and start a new server, otherwise just launch the server"
- (interactive "P")
- (let ((rinari-web-server-buffer "*server*"))
- (when (get-buffer rinari-web-server-buffer)
- (set-process-query-on-exit-flag (get-buffer-process rinari-web-server-buffer) nil)
- (kill-buffer rinari-web-server-buffer))
- (rinari-web-server edit-cmd-args)))
-
-(defun rinari-insert-erb-skeleton (no-equals)
- "Insert an erb skeleton at point, with optional prefix argument
-don't include an '='."
- (interactive "P")
- (insert "<%") (if no-equals (insert " -") (insert "= ")) (insert "%>")
- (if no-equals (backward-char 4) (backward-char 3)))
-
-(defun rinari-extract-partial (begin end partial-name)
- "Extracts the selected region into a partial."
- (interactive "r\nsName your partial: ")
- (let ((path (buffer-file-name))
- (ending (rinari-ending)))
- (if (string-match "view" path)
- (let ((partial-name
- (replace-regexp-in-string "[[:space:]]+" "_" partial-name)))
- (kill-region begin end)
- (if (string-match "\\(.+\\)/\\(.+\\)" partial-name)
- (let ((default-directory (expand-file-name (match-string 1 partial-name)
- (expand-file-name ".."))))
- (find-file (concat "_" (match-string 2 partial-name) ending)))
- (find-file (concat "_" partial-name ending)))
- (yank) (pop-to-buffer nil)
- (rinari-insert-partial partial-name ending))
- (message "not in a view"))))
-
-(defun rinari-insert-partial (partial-name ending)
- "Inserts the partial call in to the buffer. The snippet depends on
-the current file ending.
-
-Supported markup languages are: Erb, Haml"
- (let ((prefix) (suffix))
- (cond
- ((string-match "\\(html\\)?\\.erb" ending)
- (setq prefix "<%= ")
- (setq suffix " %>"))
- ((string-match "\\(html\\)?\\.haml" ending)
- (setq prefix "= ")
- (setq suffix " ")))
- (insert (concat prefix "render :partial => \"" partial-name "\"" suffix "\n"))))
-
-(defun rinari-goto-partial ()
- "Visits the partial that is called on the current line."
- (interactive)
- (let ((line (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
- (when (string-match rinari-partial-regex line)
- (setq line (match-string 1 line))
- (let ((file))
- (if (string-match "/" line)
- (setq file (concat (rinari-root) "app/views/" (replace-regexp-in-string "\\([^/]+\\)/\\([^/]+\\)$" "\\1/_\\2" line)))
- (setq file (concat default-directory "_" line)))