×
Copy
Open
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
Play framework について ⼩野 裕作
Slide 2
Slide 2 text
No content
Slide 3
Slide 3 text
Java
Slide 4
Slide 4 text
Servelet, JSP を使わない XML を使わない コンパイル不要 設定不要 Eclipse 不要
Slide 5
Slide 5 text
Ruby on Rails Like
Slide 6
Slide 6 text
MVC フルスタック コマンドで雛形を⽣成 ディレクトリ構成 ソースコードの修正を即座に反映 テストフレームワークが付属
Slide 7
Slide 7 text
http://www.playframework.org/
Slide 8
Slide 8 text
Install
Slide 9
Slide 9 text
$ wget http://download.playframework.org/releases/play-1.2.3.zip $ unzip play-1.2.3.zip $ export PATH=$PATH:[Playのディレクトリ]
Slide 10
Slide 10 text
$ export PATH=$PATH:/var/lib/play-1.2.3
Slide 11
Slide 11 text
Start development
Slide 12
Slide 12 text
$ play new [プロジェクト名]
Slide 13
Slide 13 text
$ play new helloworld
Slide 14
Slide 14 text
$ cd helloworld
Slide 15
Slide 15 text
app - ソースコード conf - 設定ファイル public - 静的ファイル(CSS, JavaScript, Image など) test - テスト⽤コード lib - 外部ライブラリ modules - Play! ⽤モジュール logs - ログ tmp - class ファイルなど test-result - テスト結果
Slide 16
Slide 16 text
Run a app
Slide 17
Slide 17 text
$ play run
Slide 18
Slide 18 text
http://localhost:9000
Slide 19
Slide 19 text
Test
Slide 20
Slide 20 text
$ play test
Slide 21
Slide 21 text
http://localhost:9000/@tests
Slide 22
Slide 22 text
$ play auto-test
Slide 23
Slide 23 text
Coverage
Slide 24
Slide 24 text
$ play install cobertura $ vim conf/dependencies.yml # Application dependencies require: - play -> cobertura 2.4 $ play dependencies --forceCopy
Slide 25
Slide 25 text
$ play auto-test $ open test-result/code-coverage/index.html
Slide 26
Slide 26 text
Other
Slide 27
Slide 27 text
$ play help
Slide 28
Slide 28 text
http://localhost:9000/@documentation
Slide 29
Slide 29 text
Eclipse
Slide 30
Slide 30 text
$ play eclipsify $ cp $PLAY_INSTALLED_DIR/support/eclipse/org.playframework.playclipse_0.7.0.ja $ECLIPSE/dropins/
Slide 31
Slide 31 text
Scaffold
Slide 32
Slide 32 text
Rails との違い 標準機能ではない(モジュール) Model は⼿動で作成 Model を基に Controller, View を⽣成 login 処理を⽣成
Slide 33
Slide 33 text
$ play install scaffold
Slide 34
Slide 34 text
$ vim conf/dependencies.yml # Application dependencies require: - play -> scaffold 0.1 - play -> secure
Slide 35
Slide 35 text
$ play dependencies --forceCopy
Slide 36
Slide 36 text
--forceCopy の有無 有: play のインストールディレクトリ以下に配置 無: プロジェクト以下に配置
Slide 37
Slide 37 text
$ vim conf/application.conf $ db=mem
Slide 38
Slide 38 text
Model を⽤意する チュートリアルの Model User.java Post.java Comment.java Tag.java
Slide 39
Slide 39 text
No content
Slide 40
Slide 40 text
$ play scaffold:gen --with-layout --with-login --overwrite
Slide 41
Slide 41 text
$ play scaffold:gen --with-layout --with-login --overwrite
Slide 42
Slide 42 text
http://play-scaffold.herokuapp.com/
Slide 43
Slide 43 text
Deploy apps to heroku
Slide 44
Slide 44 text
$ vim Procfile web: play run --http.port=$PORT $PLAY_OPTS
Slide 45
Slide 45 text
$ vim .gitignore /lib /tmp /modules /test-result /logs /eclipse
Slide 46
Slide 46 text
$ git init $ git add . $ git commit -m 'first commit'
Slide 47
Slide 47 text
$ heroku create --stack cedar
Slide 48
Slide 48 text
$ git push heroku master
Slide 49
Slide 49 text
DB: PostgreSQL conf/application.conf を変更 User クラスはテーブル名を変えておく
Slide 50
Slide 50 text
まとめ Java らしくない Java Web Framework RoR Like で⾼速な開発 heroku 対応で簡単なデプロイ
Slide 51
Slide 51 text
No content
Slide 52
Slide 52 text
Play Scala http://playscala.appspot.com
Slide 53
Slide 53 text
$ play install scala $ play new helloscala --with scala
Slide 54
Slide 54 text
No content