Guard & UserException & Readme

This commit is contained in:
Yuan Chiu 2014-07-27 10:59:01 -07:00
parent 2dee3ff04b
commit 125dfb1c7b
4 changed files with 75 additions and 5 deletions

View File

@ -2,14 +2,18 @@
# More info at https://github.com/guard/guard#readme
group :development do
gem 'guard'
gem 'guard-livereload', require: false
gem 'guard-shell'
end
# Add files and commands to this file, like the example:
# watch(%r{file/path}) { `command(s)` }
#
guard :shell do
watch(%r{htdocs/.+\.(php)}) { 'phpdoc -d ./htdocs/lib -t ./docs/' }
watch(%r{htdocs/.+\.(php)}) do
system 'phpdoc', '-d', './htdocs/lib', '-t', './docs/'
end
end
# LiveReload

View File

@ -4,17 +4,64 @@
包含每位學生的學習資料、場地狀況、學習教材。以及處理學習路徑規劃。
## 系統需求
## 使用需求
* PHP5.3 以上需要有以下Extension:
* pdo_mysql
* zip
* MariaDB 5.5.31 (可用MySQL)
***
## 開發需求
* 支援UTF-8編碼的文字編輯器
* 開發文件產生器: phpdoc
* 自動化建置工具
* guard需有ruby環境
* guard-shell
* guard-livereload
## 建置開發環境
### 安裝php, ruby 環境
TODO: 代補,需有`gem`, `phar`
### 安裝Guard
gem install guard
gem install guard-shell
gem install guard-livereload
#### 瀏覽器plugin安裝
[LiveReload - browser extensions](http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-)
支援主流瀏覽器:
* Firefox
* Chrome
* Safari
### 安裝phpdoc
pear channel-discover pear.phpdoc.org
pear install phpdoc/phpDocumentor
## 自動化建置
很簡單,只要下以下指令即可啟動
guard
啟動後會監視專案內的`.php`檔案,一有任何變動將會
* phpdoc: 重新建立開發文件
* livereload: 呼叫瀏覽器自動重新整理
#### 相關參考
* <https://github.com/guard/guard>
* <https://github.com/guard/guard/wiki/List-of-available-Guards>
## 開發文件
已將整份專案使用[PHPDocumentor](http://www.phpdoc.org/)產生出[開發文件網站](docs/index.html)
產生指令:
產生指令若有使用Guard的話可省略會自動連同一起產生:
phpdoc -d ./htdocs/lib -t ./docs/

11
htdocs/index.php Normal file
View File

@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Creating...</title>
</head>
<body>
<h1>建置中~</h1>
<?php echo 'test' ?>
</body>
</html>

View File

@ -50,7 +50,6 @@ class UserNoFoundException extends UserException {
}
}
/**
* 使用者登入密碼錯誤
* @since 3.0.0
@ -61,6 +60,16 @@ class UserPasswordErrException extends UserException {
}
}
/**
* 此帳號未啟用
* @since 3.0.0
*/
class UserNoActivatedException extends UserException {
public function __construct($userId) {
parent::__construct($userId, 'User: "'.$this->type.'" is no activated.');
}
}
// 建立使用者 ======================================================================
/**
* 已有重複的使用者名稱
@ -71,4 +80,3 @@ class UserIdExistException extends UserException {
parent::__construct($userId, 'UserId: "'.$this->type.'" is exist.');
}
}