Skip to content

Commit

Permalink
Fixed [#16742]: pass rails environment to script/console
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/emacs-rails/trunk@221 cc5033d0-740f-0410-afc7-949910e492f2
  • Loading branch information
dimaexe committed Feb 6, 2008
1 parent d008cde commit 2f1942f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2008-02-07 Dmitry Galinsky <[email protected]>

* rails-scripts.el (rails-script:console): passed default environment to script/console

2007-12-23 Michael Klishin <[email protected]>
* rails-spec.el (rails-spec:run-this-spec): Run spec where the point is

Expand Down
3 changes: 3 additions & 0 deletions History
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
SVN
* Fixed [#16742]: pass rails environment to script/console

0.5.99.6
* Removed file 'untabify-file.el' from package emacs-rails
* Updated highlight of compilation output
Expand Down
4 changes: 2 additions & 2 deletions rails-ruby.el
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ See the variable `align-rules-list' for more details.")

(require 'inf-ruby)

(defun run-ruby-in-buffer (cmd buf)
(defun run-ruby-in-buffer (buf script &optional params)
"Run CMD as a ruby process in BUF if BUF does not exist."
(let ((abuf (concat "*" buf "*")))
(when (not (comint-check-proc abuf))
(set-buffer (make-comint buf rails-ruby-command nil cmd)))
(set-buffer (make-comint buf rails-ruby-command nil script params)))
(inferior-ruby-mode)
(make-local-variable 'inferior-ruby-first-prompt-pattern)
(make-local-variable 'inferior-ruby-prompt-pattern)
Expand Down
16 changes: 10 additions & 6 deletions rails-scripts.el
Original file line number Diff line number Diff line change
Expand Up @@ -300,25 +300,29 @@ BUFFER-MAJOR-MODE and process-sentinel SENTINEL."

;;;;;;;;;; Shells ;;;;;;;;;;

(defun rails-script:run-interactive (name script)
(defun rails-script:run-interactive (name script &optional params)
"Run an interactive shell with SCRIPT in a buffer named
*rails-<project-name>-<name>*."
(rails-project:with-root
(root)
(let ((buffer-name (format "rails-%s-%s" (rails-project:name) name)))
(run-ruby-in-buffer (rails-core:file script)
buffer-name)
(let ((buffer-name (format "rails-%s-%s" (rails-project:name) name))
(script (rails-core:file script)))
(run-ruby-in-buffer buffer-name
script
params)
(setq ruby-buffer buffer-name))
(rails-minor-mode t)))

(defun rails-script:console ()
"Run script/console."
(interactive)
(rails-script:run-interactive "console" "script/console"))
(rails-script:run-interactive (format "console at (%s)" rails-default-environment)
"script/console"
rails-default-environment))

(defun rails-script:breakpointer ()
"Run script/breakpointer."
(interactive)
(rails-script:run-interactive "breakpointer" "script/breakpointer"))

(provide 'rails-scripts)
(provide 'rails-scripts)
20 changes: 10 additions & 10 deletions rails.el
Original file line number Diff line number Diff line change
Expand Up @@ -292,25 +292,25 @@ it in case it's still empty for the project."
(rails-project:with-root
(root)
(unless (or (file-exists-p (rails-core:file "doc/api/index.html"))
(not (yes-or-no-p (concat "This project has no API documentation. "
"Would you like to configure it now? "))))
(not (yes-or-no-p (concat "This project has no API documentation. "
"Would you like to configure it now? "))))
(let (clobber-gems)
(message "This may take a while. Please wait...")
(unless (file-exists-p (rails-core:file "vendor/rails"))
(setq clobber-gems t)
(message "Freezing gems...")
(shell-command-to-string "rake rails:freeze:gems"))
(setq clobber-gems t)
(message "Freezing gems...")
(shell-command-to-string "rake rails:freeze:gems"))
;; Hack to allow generation of the documentation for Rails 1.0 and 1.1
;; See http://dev.rubyonrails.org/ticket/4459
(unless (file-exists-p (rails-core:file "vendor/rails/activesupport/README"))
(write-string-to-file (rails-core:file "vendor/rails/activesupport/README")
"Placeholder"))
(write-string-to-file (rails-core:file "vendor/rails/activesupport/README")
"Placeholder"))
(message "Generating documentation...")
(shell-command-to-string "rake doc:rails")
(if clobber-gems
(progn
(message "Unfreezing gems...")
(shell-command-to-string "rake rails:unfreeze")))
(progn
(message "Unfreezing gems...")
(shell-command-to-string "rake rails:unfreeze")))
(message "Done...")))
(if (file-exists-p (rails-core:file "doc/api/index.html"))
(setq rails-api-root (rails-core:file "doc/api")))))
Expand Down

0 comments on commit 2f1942f

Please sign in to comment.