ユーザ用ツール

サイト用ツール


java:playframework

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
java:playframework [2018/07/20 11:24] – [テーブル] takajava:playframework [2018/09/05 09:52] (現在) taka
行 1: 行 1:
-====== Java - Pray Framework ======+====== Java - Play Framework ======
  
 ここでの解説は以下環境を前提にしています。 ここでの解説は以下環境を前提にしています。
行 9: 行 9:
   * IntelliJ IDEA Community 2018.1   * IntelliJ IDEA Community 2018.1
  
-===== インストール =====+  - [[java:playframework:environment|環境構築]] 
 +  - [[java:playframework:createmodel|モデの作成]]
  
-まずビルドツールであるsbtをインストールする。\\  
-Play Frameworkの作成、起動にはこのsbtを使用する。 
- 
-[[https://www.scala-sbt.org/|sbt]] 
- 
-MacにHomebrewがあればそちらを使うと便利。 
- 
-<sxh bash> 
-$ brew install sbt@1 
-</sxh> 
- 
-sbtの主なオプション 
- 
-^ オプション  ^ 内容           ^ 
-| about  | sbtのバージョン確認  | 
-| new    | 作成           | 
-| run    | 実行           | 
- 
-===== インストール(Mac OS X 10.5, 10.6) ===== 
- 
-  $ ./configure --prefix=/usr/local --enable-shared --enable-pthread 
-  $ make 
-  $ sudo make install 
- 
-gem実行時に以下のエラーが出た場合は、LibYAMLをインストールして環境変数を設定した後、Rubyを再度インストールすることで解決する。 
- 
-  It seems your ruby installation is missing psych (for YAML output). 
-  To eliminate this warning, please install libyaml and reinstall your ruby. 
- 
-  * **[[http://pyyaml.org/wiki/LibYAML|LibYAML]]** 
- 
-  $ ./configure 
-  $ make 
-  $ sudo make install 
- 
-環境変数に以下を加える。 
- 
-  export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH 
-   
-===== インストール(Windows 7 64bit) ===== 
- 
-以下よりRuby 2.0.0-p0 (x64)とDevKit-mingw64-64-4.7.2-20130224-1432-sfx.exeをダウンロード。 
- 
-  * **[[http://rubyinstaller.org/downloads/|RubyInstaller]]** 
- 
-それぞれRubyはC:/usr、DevKitはC:/DevKitにインストール。 
- 
-Windowsの環境変数「PATH」に以下を追加。 
- 
-<sxh plain; gutter: false;> 
-C:\usr\bin;C:\usr\lib;C:\usr\include;C:\DevKit\bin;C:\DevKit\lib;C:\DevKit\include;C:\DevKit\mingw\bin;C:\DevKit\mingw\lib;C:\DevKit\mingw\include 
-</sxh> 
- 
-DevKitの設定 
- 
-  $ cd C:/DevKit 
-  $ ruby dk.rb init 
- 
-C:/DevKit/config.ymlができるので以下のように編集。 
- 
-<sxh plain; gutter: false;> 
-# This configuration file contains the absolute path locations of all 
-# installed Rubies to be enhanced to work with the DevKit. This config 
-# file is generated by the 'ruby dk.rb init' step and may be modified 
-# before running the 'ruby dk.rb install' step. To include any installed 
-# Rubies that were not automagically discovered, simply add a line below 
-# the triple hyphens with the absolute path to the Ruby root directory. 
-# 
-# Example: 
-# 
-# --- 
-# - C:/ruby19trunk 
-# - C:/ruby192dev 
-# 
---- 
-- C:/usr 
-</sxh> 
- 
-以下コマンドを実行して反映。 
- 
-  $ ruby dk.rb install 
- 
-Gemでriとrdocをインストールしないように設定。\\  
-C:/Users/<username>/.gemrc を作成して以下を追加。 
- 
-<sxh plain; gutter: false;> 
-gem: --no-ri --no-rdoc 
-</sxh> 
- 
-  gem update --system 
- 
-===== ソースファイルの文字コードを指定する ===== 
- 
-<sxh ruby; gutter: false;> 
-#!/usr/bin/ruby 
-# coding: utf-8 
-</sxh> 
- 
-===== ファイル/ディレクトリ操作 ===== 
- 
-==== ファイル入出力時の文字コードを指定する ==== 
- 
-<sxh ruby; gutter: false;> 
-#!/usr/bin/ruby 
-# coding: utf-8 
- 
-# 入力 
-file = File.open("Shift_JIS.txt","r:sjis") 
-# 処理 
-file.close 
- 
-# 出力 
-file = File.open("Shift_JIS.txt","w:sjis") 
-# 処理 
-file.close 
-</sxh> 
- 
-==== 多階層ディレクトリの作成方法 ==== 
- 
-<sxh ruby; gutter: false;> 
-#!/usr/bin/ruby 
-# coding: utf-8 
- 
-path = "/AAA/BBB/CCC/DDD/EEE" 
- 
-FileUtils.mkpath(path) 
-</sxh> 
- 
-=== オプション一覧 === 
- 
-^オプション^効果^ 
-|:mode   |パーミッションを8進数で指定(Example: 0777)| 
-|:noop   |trueを指定すると実際の処理は行わない| 
-|:verbose|trueを指定すると標準出力に詳細を出力| 
- 
-=== オプション使用例 === 
- 
-<sxh ruby; gutter: false;> 
-# ディレクトリ作成時のパーミッションを指定通りにするため予めumaskに0を設定 
-File.umask(0) 
-FileUtils.mkpath(path,{:mode => 0777, :noop => true, :verbose => true}) 
-</sxh> 
- 
-===== トランスコーディング ===== 
- 
-<sxh ruby; gutter: false;> 
-#!/usr/bin/ruby 
-# coding: utf-8 
- 
-# UTF-8文字列 
-strings_utf8 = "あいうえお" 
-puts strings_utf8.encoding # => #<Encoding:UTF-8> 
- 
-# SJIS変換 
-strings_sjis = strings_utf8.encode("sjis") 
-puts strings_sjis.encoding # => #<Encoding:Windows-31J> 
-</sxh> 
- 
-<color red> 
-但し、変換後の文字コードでは使用できない文字が含まれていると、エラーになる。\\  
-__以下のように不正文字を置換文字列で置換えることで対処できる。__ 
-</color> 
- 
-<sxh ruby; gutter: false;> 
-#!/usr/bin/ruby 
-# coding: utf-8 
-  
-# UTF-8文字列 
-strings_utf8 = "SJISでは使用できない文字 => ©" 
-puts strings_utf8.encoding # => #<Encoding:UTF-8> 
- 
-# SJIS変換 
-strings_sjis = strings_utf8.encode("sjis", undef: :replace, replace: "<??>") 
-puts strings_sjis.encoding # => #<Encoding:Windows-31J> 
-</sxh> 
- 
-===== オブジェクト指向 ===== 
- 
-==== アクセサメソッド ==== 
- 
-<sxh ruby; gutter: false;> 
-# ゲッターメソッドを生成 
-attr_reader   :name 
-# セッターメソッドを生成 
-attr_writer   :name 
-# ゲッターメソッド/セッターメソッドを生成 
-attr_accessor :name 
-</sxh> 
- 
-<sxh ruby; gutter: false;> 
-# ------------------------------------------------------ 
-class Test 
-# ------------------------------------------------------ 
-  
- attr_reader   :name1 
- attr_writer   :name2 
- attr_accessor :name3 
-  
- # -------------------------------------------------- 
- def initialize(name1,name2,name3) 
- # -------------------------------------------------- 
- @name1 = name1 
- @name2 = name2 
- @name3 = name3 
- end 
-end 
- 
-test = Test.new("MyName1","MyName2","MyName3") 
- 
-test.name1 = "NewName1" # ERROR: Read Only 
-puts test.name1         # -> MyName1 
- 
-test.name2 = "NewName2" # OK 
-puts test.name2         # ERROR: Write Only 
- 
-test.name3 = "NewName3" # OK 
-puts test.name3         # -> NewName3 
- 
-</sxh> 
  
  
java/playframework.1532053488.txt.gz · 最終更新: 2018/07/20 11:24 by taka