参考図書は『Java言語で学ぶデザインパターン入門』(結城浩著)です。
ソースコードは本家サイトのこちらからもダウンロード出来ます。
今回はまるまるコピーではなく、HerokuにデプロイしてWebに結果が出るようにしているので、ソースコードはGitHubに公開しています。
GitHubはこちら
git@github.com:yukiko-kato-bass/desgin-pattern-java.git
それでは順次公開していきます!!
$ git remote -vこれのherokuのURLを変更します。
$ git remote set-url heroku git@heroku.com:play-study.gitちなみに、originの接続先を変更する時は、『heroku』の部分をoriginに変更すればOK
$ ssh-keygen -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xxxx/.ssh/id_rsa): ←Enter押す
Created directory '/Users/xxxx/.ssh'.
Enter passphrase (empty for no passphrase): ←入力せずにEnter押す
Enter same passphrase again: ←入力せずEnter押す
Your identification has been saved in /Users/xxxx/.ssh/id_rsa.
Your public key has been saved in /Users/xxxx/.ssh/id_rsa.pub.
heroku keys:add
rvm --create 1.9.3-p194@heroku-samplegemでherokuをインストールもしちゃいます。
$ gem install heroku --no-ri --no-rdoc
Fetching: excon-0.16.2.gem (100%)
Fetching: heroku-api-0.3.5.gem (100%)
Fetching: netrc-0.7.7.gem (100%)
Fetching: mime-types-1.19.gem (100%)
Fetching: rest-client-1.6.7.gem (100%)
Fetching: addressable-2.3.2.gem (100%)
Fetching: launchy-2.1.2.gem (100%)
Fetching: rubyzip-0.9.9.gem (100%)
Fetching: heroku-2.31.2.gem (100%)
! Heroku recommends using the Heroku Toolbelt to install the CLI.
! Download it from: https://toolbelt.heroku.com
Successfully installed excon-0.16.2
Successfully installed heroku-api-0.3.5
Successfully installed netrc-0.7.7
Successfully installed mime-types-1.19
Successfully installed rest-client-1.6.7
Successfully installed addressable-2.3.2
Successfully installed launchy-2.1.2
Successfully installed rubyzip-0.9.9
Successfully installed heroku-2.31.2
9 gems installed
heroku login
gem install rails --version 3.2.8 --no-ri --no-rdocこんなかんじでインストールされて完了。
rails new heroku-samplemysqlとか使いたかったら、-d mysqlオプションとか入れるといいらしいです。
cd heroku-samplegitを初期化します。
vi Gemfile開発では、sqlite3で、本番だとpostgreSQLだったりするんですな。ふむふむ。
heroku openようやく完了!
heroku maintenance:onherokuにdeployします。
git push heroku masterheroku側もmigrateします。
heroku run rake db:migrateメンテナンスモードを解除します。
heroku maintenance:offherokuを開いて確認
heroku openこんな画面が開いたらOK