null+****@clear*****
null+****@clear*****
Mon Feb 13 14:30:53 JST 2012
yuta yamada 2012-02-13 14:30:53 +0900 (Mon, 13 Feb 2012) New Revision: e8a7675d00b003175526621e55bae4fa4ff44479 Log: fix loga-check-state Modified files: logalimacs.el Modified: logalimacs.el (+22 -4) =================================================================== --- logalimacs.el 2012-02-13 13:30:53 +0900 (6b67986) +++ logalimacs.el 2012-02-13 14:30:53 +0900 (e411df6) @@ -400,10 +400,28 @@ (defun loga-check-state () (interactive) - (let* ((logaling-version (loga-return-version-num (loga-to-shell "\\loga version")))) - (if (version< "0.1.2" logaling-version) - ;; @todo sets true when resolved problem - (setq loga-possible-json-p nil)))) + (let* ((ruby '(lambda (arg) + (shell-command-to-string (concat "ruby -e " arg)))) + (version (funcall ruby "'print RUBY_VERSION'")) + (installed-p (not (string-match "no such file to load" + (funcall ruby "'require \"logaling\"'")))) + (rvm-p (eq 0 (shell-command "which rvm"))) + logaling-version) + (cond + ((and installed-p version) + (message "Check OK: logaling-command already installed") + (setq logaling-version + (loga-return-version-num (loga-to-shell "\\loga version"))) + (if (version< "0.1.2" logaling-version) + ;; @todo sets true when resolved problem + (setq loga-possible-json-p nil)) t) + ((not (string-match "1.9.[0-9]\\|[2-9].[0-9].[0-9]" version)) + (message "Note: Ruby version errer, require Ruby 1.9.x")) + (rvm-p + (if (require 'rvm nil t) + (message "Note: require 'gem install logaling-command'") + (message "Note: if use rvm, require rvm.el and sets the config to your dot emacs."))) + (t message "Note: require 'sudo gem install logaling-command'")))) (defun loga-return-version-num (version-string) (string-match "[0-9].[0-9].[0-9]" version-string)