• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

瀧内さんの記事を参考にgit-svn使い始めましたが便利です。svnだと1コミットに複数の修正(バグ修正、機能追加、type修正など)をつい入れてしまうのですが、gitだとそういうこともなくなります。なのでcommitメッセージが書きやすい。

Rails向けgit環境設定

   1  $git svn clone svn-repo-URL
   2  $git add log
   3  $git add tmp
   4  $touch tmp/.gitignore log/.gitignore .gitignore

Rails_ROOT直下の.gitignore:最後の2行はemacs用
(tmpやlogの下の.gitignoreは空ファイルでOKです)

   1  # .gitignore
   2  log/*.log
   3  tmp/**/*
   4  *~
   5  #*#

git stash:へそくり

何かの修正をすでに加えている最中に、typoや緊急の修正分だけをコミットしたくなったとき。 (修正として新たに追加したファイルはstashしてもgit-status中に出てきますが、dcommitは可能です)

   1  $git stash save
   2  edit edit
   3  $git commit -a -m "fixed typo"
   4  $git svn dcommit
   5  $git stash apply

svn revert:ファイル一個だけ編集前のものに戻す

   1  $git checkout -- filename

その外よく使うコマンド

   1  $git diff
   2  $git diff filename
   3  $git add filename
   4  $git add .
   5  $git status
   6  $git rm -f filename

Refs

http://blog.s21g.com/articles/583
http://coderepos.org/share/wiki/FAQ/Git
http://railscasts.com/episodes/96:railscasts Git on Rails

posted by Png satoko on Wed 28 May 2008 at 06:37 with 1 comment

http://blog.dreamhost.com/2008/05/13/passenger-for-ruby-on-rails/

話題になっていたPassengerですが、Dreamhostで採用されました。masuidriveさんもオススメのようなので、ぜひ使ったみたいです。

http://rails20.jp/2008/04/passenger/
http://www.moongift.jp/2008/04/passenger/
http://blog.masuidrive.jp/index.php/2008/04/12/deploy_rb_and_apache_conf_generator_for_mod_rail/

posted by Png satoko on Thu 15 May 2008 at 05:24

複数アプリを動かしている場合、アプリ毎にメールアドレスが欲しくなることがあります。
今回はpostfixのvirtual domain、virtual aliasを使って実現しました。1つのサーバ(host名:x.s21g.com)で、a.s21g.com, b.s21g.comのメール受信ができるようになります。流れとしては、

  1. satoko@b.s21g.comで受信したメールを
  2. satoko_at_b@a.s21g.comに転送
  3. それをscript/runncerで処理ということになります。

mailnameの用意

myoriginパラメータで使う名前を設定します。

   1  # cat /etc/mailname
   2  a.s21g.com

virtual aliasesの用意

メール受信時どういう処理をするかです: railsの場合script/runnerに食わせます。
PATHはそれぞれ書き換えてください。

   1  # cat /etc/aliases
   2  postmaster:    root
   3  
   4  #post_at_b: "| cat $1 > /tmp/mail_test.txt" #test用コード
   5  post_at_b: "| /PATH_TO_RUBY/ruby /PATH_TO_RAILS_ROOT/script/runner -e production 'TestMailer.receive(STDIN.read)'"

virtual domainの用意

virtual domainに来た場合どうするかを個別を書きます。

   1  # cat /etc/postfix/virtual
   2  b.s21g.com         anything
   3  post@b.s21g.com post_at_b

postfixの設定を変更

mydestinationにb.s21g.comを設定、myorigin, virtual alias、virtual domainも指定します。

   1  #/etc/postfix/main.cf
   2  mydestination = localhost, localhost.localdomain, localhost, b.s21g.com
   3  myorigin = /etc/mailname
   4  alias_maps = hash:/etc/aliases
   5  alias_database = hash:/etc/aliases
   6  virtual_alias_maps = hash:/etc/postfix/virtual 

各設定を反映

   1  # postalias /etc/aliases
   2  # postmap /etc/postfix/virtual
   3  # /etc/rc.d/init.d/postfix restart

(注意) a.s21g.comはDNSに登録してください。メール送信時、インターネット上でDNSが牽ける名前か相手サーバからチェックされており、その時点で蹴られてしまうからです。
(注意) スパムに使われないようにリレーを設定します:main.cf
relayhost =
mynetworks = 127.0.0.0/8

Refs

http://blog.s21g.com/articles/569
http://www.tmtm.org/postfix/tutorial/index.html
http://furukawa.blogdns.com/furukawa/2006/04/postfix.html
http://www.jitaku-server.net/postfix_virtual_domain.html

posted by Png satoko on Tue 13 May 2008 at 16:50

以前試しに作ったTinyURL_helperですが、gitを勉強するにあたってgithubに移行してみました。
http://github.com/satoko/tinyurl_helper/tree/master

その手順を書いてみます。

公開リポジトリを作る

  1. githubにログイン
  2. ダッシュボードで"Create a Repository"リンクをクリック
  3. Project Name, Descriptioin, Homepage URLを入力し、レポジトリの公開範囲(Anyone)を選択
  4. Submitボタンをクリック

Next steps:git pushまで

現状svnで管理しているpluginをチェックアウトします

   1  svn co http://svn.s21g.com/public/rails/plugins/tinyurl_helper/ tinyurl_helper
   2  cd tinyurl_helper

Submit後下記のような指示が画面に表示されますが、今回は移行作業なのでtouch READMEなどを飛ばします。

   1    mkdir tinyurl_helper
   2    cd tinyurl_helper
   3    git init
   4    touch README
   5    git add README
   6    git commit -m 'first commit'
   7    git remote add origin git@github.com:satoko/tinyurl_helper.git
   8    git push origin master

実際にやった作業

   1  $ git-init  
   2  $ git-add .
   3  $ git status
   4  $ git commit -m "first commit"
   5  $git remote add origin git@github.com:satoko/tinyurl_helper.git
   6  $git push origin master

(注)public_keyをgithubに設定しておき、pagentにprivate_keyを読み込ませてsshでagent-forward設定をしておきます。でpush!

posted by Png satoko on Mon 12 May 2008 at 01:08

あすなろブログとのダブルポストです。
―――

http://googlecustomsearch.blogspot.com/2008/04/searching-for-creative-commons-licensed.html

先日、FlickrのCCライセンスが付与されている写真の使い方を書きましたが、今度は自分のコンテンンツにCCライセンスを付与する方法をご紹介します。

どのライセンスで公開するかを決める

CCにはいくつかのライセンスラベルがあります。
http://creativecommons.org/licenses/
http://www.hyuki.com/trans/cc-licenses.html

HTML内にCCライセンスを表記する

HTMLdoc内にCCライセンスを表記する方法はいくつかある:

  1. <rdf:RDF>タグをHEADまたはBODY内に記述する
  2. <meta name="DC.rights" content=uri of cc license>タグを記述
  3. <a rel="license" href=uri of cc license>タグを記述
    4.<rdf:RDF>タグをコメント内に記述する

上記のどれかを満たしていれば付与したとみなされるようです。
ページでは実際にCCライセンスを付与しているサイト:http://joshua.smcvt.edu/linearalgebra/をサンプルとして紹介しています。上記の3と4の方法両方を実践。

3の方法(サイトの該当部を抜粋):

   1  <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>

4の方法(サイトの該当部を抜粋):

   1  <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
   2  	<Work rdf:about="">
   3  		<license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" />
   4  	<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
   5  	</Work>
   6  	<License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> -->

posted by Png satoko on Sun 11 May 2008 at 08:12

現状etchのgit-coreバイナリーpackageの最新は1.4.4系です。ただ1.5系ではコマンド体系が変わっているのでソースから入れることにしました。
→DebianでGitバイナリーpackageインストールについてはここ

git-coreパッケージを探す

http://packages.debian.org/search?searchon=names&keywords=git-core
http://packages.debian.org/lenny/git-core
現状ではlenny(testing:次期stable)のgit-coreが一番良さそうですね:1.5系。

/usr/local/srcにパッケージをダウンロード、解凍、インストール

   1  # wget http://ftp.de.debian.org/debian/pool/main/g/git-core/git-core_1.5.5.1.orig.tar.gz
   2  # tar -xvf git-core_1.5.5.1.orig.tar.gz
   3  # cd git-1.5.5.1
   4  # ./configure
   5  # make
   6  # make install
   7  # git --version
   8  git version 1.5.5.1

おまけ

gitの最新バージョンを入手してみます
via http://git.or.cz/#download

   1  $ git clone git://git.kernel.org/pub/scm/git/git.git
   2  Initialized empty Git repository in /home/hibi/git/.git/
   3  remote: Counting objects: 71595, done.
   4  remote: Compressing objects: 100% (21567/21567), done.
   5  remote: Total 71595 (delta 51380), reused 68247 (delta 48660)
   6  Receiving objects: 100% (71595/71595), 15.33 MiB | 1428 KiB/s, done.
   7  Resolving deltas: 100% (51380/51380), done.
ちゃんとclone出来ました。

posted by Png satoko on Thu 8 May 2008 at 05:36

ここここで書いたSchwartzさんですが、Git@goole techtalkの資料公開をリクエストしてみました。
次の日の朝には返信が帰ってきて、「1年ほど前のやつだしちょっと話している内容とはちょっと違うけど大体同じだと思う。」ということで教えていただきました!yay!

CCで公開されています(商用はNG)。すばらしい。

SchwartzさんのGit資料

http://www.ourmedia.org/node/276036
http://www.archive.org/download/Introduction_to_git/Git.pdf 資料直リン

Schwartzさんの他の資料へのリンク

http://ourmedia.org/node/225170 Perl Best Practices
http://ourmedia.org/node/372391 Perl Web Testing
http://ourmedia.org/node/373784 Podcasting Primer

資料で気に入ったところ

18ページくらいまでしか見れてないです。後半mergeとかbranchとか出てきてさらに面白さがupしています。

  • working treeのtopには".git"ファイルがある(サブディレクトリにはない!)
  • コピペ編集でも同じ内容なら同じものと検出(fileのSHA1が同じならということだと思います)
  • git coreはimport/export with CVS, import/export with SVNもOK
  • git coreはCVSサーバーも同梱
  • "git-MUMBLE-FOO bar"は"git MUMBLE-FOO bar"と書ける
posted by Png satoko on Sun 4 May 2008 at 07:28

http://chalain.livejournal.com/71260.html

なんだそうです。へーー。
以前のエントリgems.github.comを上げたのですが、インストールする前に1.1.1にあげとかないとgemがおかしくなるということです((引数が足りないために)gemがインストールできないなるみたい)。とりあえずgemのバージョンupしとこ。

   1  $sudo gem sources -r http://gems.github.com/ #remove if it already installed 
   2  $sudo gem update --system
   3  $sudo gem sources -a http://gems.github.com/ #install gems.github
   4  
   5  $sudo gem install mojombo-grit #install gem

posted by Png satoko on Thu 1 May 2008 at 22:53

先日書いた記事のGitについてのビデオがとてもためになったので、資料が公開されていないか探してみたのだけど、どうやらなさそうだった。

ふと思いついて発表者のSchwartzさんに資料を公開してくれないかメールしてみた。はてさてうまくいきますかどうか!楽しみ楽しみ♪

英語のブログも書かなきゃなー。

posted by Png satoko on Thu 1 May 2008 at 19:15
Contents
git-svn+Railsで使うgitコマンド
ホスティングサービスDreamhostがPassenger(mod_rails)を採用
postfixでrailsアプリごとにメールアドレスを持つ:virtual domain, virtual alias
プラグイン:TinyURL_helperの管理をgithubに移行する
CCライセンスのコンテンツを作成する方法 via google custom search blog
DebianでGit1.5.5をソースから入れる
Randal L SchwartzさんのGit@google techtalk資料
gems.github.comを試す前にgemを1.1.1にしておくこと
Git@Google TechTalkのSchwartzさんメールを書いてみた
Comments
KingofSmack: Here also good reads for this mobile applicatio... '14-5
satoko: stackoverflowでも同じエラーを挙げている人がいたので、1.3でアップロードしたよっ... '10-12
ujihisa: :%s/blog/glob/g '10-7
satoko: しゅが〜様 返事が遅くなって申し訳ありません。また、投稿百景ご購入ありがとうございます。 ... '09-10
しゅが~: こんにちは。投稿百景を発売日翌日から利用しています。本当にいいAppを作っていただきました。罫... '09-10
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ