s21gブログを動かしているEC2インスタンスのRailsを
2.1.1にバージョンアップしました。
Rails 2.1.1: Lots of bug fixes
Rails 2.1.1 is another maintenance release that includes a bunch of bug fixes and a fix for the REXML vulnerability. I’ve extracted all the changes from the CHANGELOGs into a single Gist. Enjoy!
以下、バージョンアップに関する作業ログです。
まずは
trident
を立ち上げると以下のようなWARNINGが。
DEPRECATION WARNING: Dependencies is deprecated! Use ActiveSupport::Dependencies instead. See http://www.rubyonrails.org/deprecation for details. (called from evaluate_init_rb at blog/vendor/plugins/background_fu/init.rb:1)
とりあえず最新版のBackgroundFu
をあたってみます。
いつの間にかGemPluginになってる。よしよし。
config/environment.rbに以下を追記。
1 config.gem 'ncr-background_fu',
2 :lib => 'background_fu',
3 :source => 'http://gems.github.com'
そして
1 % sudo rake gems:install
そして不要になったプラグインを削除。
1 % ./script/plugin remove background_fu
2 svn: '/home/takiuchi/blog/vendor/plugins' is not a working copy
おっと。script/plugin removeはまだGitには対応してないのかな?
しかし警告メッセージは出ましたが、当該ディレクトリはきちんと削除されていた模様。
もう一度tridentを立ち上げるが、また同様の警告が出た。
ということで、background_fuを
forkすることにした。
config/environment.rbを書き直す。
1 config.gem 'genki-background_fu',
2 :lib => 'background_fu',
3 :source => 'http://gems.github.com'
これで警告は出なくなった。
rake -Tは特に問題なく実行できる。
rake testを実行。
DEPRECATION WARNING: follow_redirect is deprecated and will be removed from Rails 2.2 (If you wish to follow redirects, you should use integration tests) See http://www.rubyonrails.org/deprecation for details. (called from test_cleaning_up_blank_page at ./test/functional/articles_controller_test.rb:305)
とのこと。follow_redirectを使いたい場合は
インテグレーションテストを使ってね、ということらしい。
いわれてみればその通りですね。
これを機にIntegrationTest周りのサポートが充実すると嬉しい。
とりあえず、該当箇所をIntegrationTestに切り出すことに。
その前にscript/generateコマンドがUpdateされてる可能性があったので、
rake rails:updateを実行してみたが、config/boot.rbが数行変わっただけであった。どうやらRubyGemsの最低要求バージョンが1.1.1以降となった模様。
IntegrationTestでは、follow_redirectではなく、follow_redirect!
を使う必要があった。
と、ここまででテストでのWARNINGもすべて解消。
あとはローカル環境で動作テストをした後に、
cap shellで必要なGemをインストールしてcap deploy
WARNINGを消すためにひと手間かかりましたが、
基本的には特に大きな修正も必要なくアップグレードできました。