Rails作業記録その4

subversionリポジトリ管理の続きです。

rails-commitコマンド

こちら(→http://wwwaku.com/blog_part2/2008/02/14/rails%e3%81%a8subversion%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9/)のrailscommitコマンドも導入します。変更点を全自動でコミットしてくれる優れものです。

#!/bin/bash
echo ""
echo "Here's what we're going to do:"
echo " "
echo "Add the following files"
echo "-----------------------"
svn status | awk '/^?/ {print $2}'
echo " "
echo "Remove the following files"
echo "--------------------------"
svn status | awk '/^!/ {print $2}'
echo " "
echo "Check in the following modified files"
echo "-------------------------------------"
svn status | awk '/^M/ {print $2}'
echo " "
echo "Proceed with commit? [yn]"
read answer
if [ "$answer" = "y" ]
then
    echo " "
    echo "Adding the following files"
    svn status | awk '/^?/ {print $2}' | xargs svn add
    echo " "
    echo "Removing the following files"
    svn status | awk '/^!/ {print $2}' | xargs svn remove
    echo " "
    echo "Committing changes to repository"
    svn commit
else
    echo " "
    echo "Commit cancelled"
fi

echo " "
echo "Want to check for updates? [yn]"
read answer
if [ "$answer" = "y" ]
then
    svn update
else
    echo " "
    echo "Update cancelled"
fi
http://wwwaku.com/blog_part2/2008/02/14/rails%e3%81%a8subversion%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9/

rails-commitの使い方

xxx:~$ sudo mv rails-commit /usr/bin/
xxx:~$ s chmod 755 /usr/bin/rails-commit

Railsアプリケーションのディレクトリ(ここでは「/home/www/2.5-55.jp」)に移動してから使います。

xxx:~$ cd /home/www/2.5-55.jp
xxx:/home/www/2.5-55.jp$ rails-commit
Here's what we're going to do:

Add the following files
                                            • -
Remove the following files
                                                  • -
Check in the following modified files
                                                                        • -
Proceed with commit? [yn] n Commit cancelled Want to check for updates? [yn] n Update cancelled

なにもやってないのでなにもありません。active_scaffoldやらなにやらいろいろとやってみます。

xxx:~$ cd /home/www/2.5-55.jp
xxx:/home/www/2.5-55.jp$ rails-commit
Here's what we're going to do:

Add the following files
                                            • -
test/unit/item_test.rb test/functional/item_controller_test.rb test/fixtures/items.yml app/helpers/item_helper.rb app/models/item.rb app/controllers/item_controller.rb app/views/item app/views/layouts/item.html.erb db/schema.rb db/migrate vendor/plugins/active_scaffold public/blank.html public/images/active_scaffold public/javascripts/active_scaffold public/stylesheets/active_scaffold Remove the following files
                                                  • -
Check in the following modified files
                                                                        • -
Proceed with commit? [yn] y Adding the following files A test/unit/item_test.rb A test/functional/item_controller_test.rb A test/fixtures/items.yml A app/helpers/item_helper.rb A app/models/item.rb
A public/stylesheets/active_scaffold/default/stylesheet-ie.css A public/stylesheets/active_scaffold/DO_NOT_EDIT Removing the following files svn: Not enough arguments provided; try 'svn help' for more info Committing changes to repository *** ここでコミット時のコメントを入力する ***
Adding vendor/plugins/active_scaffold/test/test_helper.rb Adding vendor/plugins/active_scaffold/uninstall.rb Transmitting file data .......................................... Committed revision 11. Want to check for updates? [yn] y At revision 11.

参考

  1. こちら(→http://wwwaku.com/blog_part2/2008/02/14/rails%e3%81%a8subversion%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9/)の通りに進めていきました。大感謝です。