RailsTidy
XHTMLの構造をチェックしてくれるというRailsのプラグイン「RailsTidy」を入れてみました。
http://blog.cosinux.org/pages/rails-tidy
プラグインがおいてあるところをsourceで加える
# script/plugin source http://www.cosinux.org/~dam/projects/rails-tidy/rails_tidy/
プラグインをインストール
# script/plugin install rails-tidy --force sh: svn: command not found /usr/lib/ruby/1.8/open-uri.rb:290:in `open_http': 404 Not Found (OpenURI::HTTPError) from /usr/lib/ruby/1.8/open-uri.rb:629:in `buffer_open' from /usr/lib/ruby/1.8/open-uri.rb:167:in `open_loop' from /usr/lib/ruby/1.8/open-uri.rb:165:in `open_loop' from /usr/lib/ruby/1.8/open-uri.rb:135:in `open_uri' from /usr/lib/ruby/1.8/open-uri.rb:531:in `open' from /usr/lib/ruby/1.8/open-uri.rb:86:in `open' from /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/plugin.rb:863:in `fetch_dir' from /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/plugin.rb:857:in `fetch' ... 7 levels... from /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/plugin.rb:871 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require' from script/plugin:3
あら!エラーになりました。
vender/plugins/rails-tidy の下にもなんもファイルがない。
Subversionじゃないやつは直接コピーしなきゃいけなかった。
RailsTidyを入れると、rakeタスクにtest:templatesが追加されます。
init.rbとかlibディレクトリとかコピーして
environment.rbに
RailsTidy.tidy_path = "/path/to/your/libtidy.so"
して、
# rake test:templates
すると、エラーが出ました。
/usr/lib/libtidy.so がない!というのでシンボリックリンクを作成。
environment.rbの設定が効くと思ってたんだけど・・
その後、
# rake test:templates (in /home/bird/src/rails/maiha) /home/bird/src/rails/maiha/config/../app/views/error/index.rhtml ERRORS /home/bird/src/rails/maiha/config/../app/views/news/show.rhtml OK /home/bird/src/rails/maiha/config/../app/views/news/_form.rhtml OK /home/bird/src/rails/maiha/config/../app/views/news/edit.rhtml OK /home/bird/src/rails/maiha/config/../app/views/news/list.rhtml ERRORS /home/bird/src/rails/maiha/config/../app/views/news/new.rhtml OK /home/bird/src/rails/maiha/config/../app/views/ranking/index.rhtml ERRORS /home/bird/src/rails/maiha/config/../app/views/ranking/_item.rhtml ERRORS
こんな感じで出ました。
こんなんしたりすると、
# rake test:templates FILE="app/views/member/list.rhtml" (in /home/bird/src/rails/maiha) app/views/member/list.rhtml ERRORS line 3 column 1 - Warning: <table> lacks "summary" attribute Info: Doctype given is "-//W3C//DTD XHTML 1.0 Transitional//EN" Info: Document content looks like XHTML 1.0 Transitional 1 warning, 0 errors were found!
tableってsummary属性書くものなのか・・