Guard & UserException & Readme
This commit is contained in:
parent
2dee3ff04b
commit
125dfb1c7b
@ -2,14 +2,18 @@
|
|||||||
# More info at https://github.com/guard/guard#readme
|
# More info at https://github.com/guard/guard#readme
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
|
gem 'guard'
|
||||||
gem 'guard-livereload', require: false
|
gem 'guard-livereload', require: false
|
||||||
|
gem 'guard-shell'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add files and commands to this file, like the example:
|
# Add files and commands to this file, like the example:
|
||||||
# watch(%r{file/path}) { `command(s)` }
|
# watch(%r{file/path}) { `command(s)` }
|
||||||
#
|
#
|
||||||
guard :shell do
|
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
|
end
|
||||||
|
|
||||||
# LiveReload
|
# LiveReload
|
||||||
|
51
README.md
51
README.md
@ -4,17 +4,64 @@
|
|||||||
|
|
||||||
包含每位學生的學習資料、場地狀況、學習教材。以及處理學習路徑規劃。
|
包含每位學生的學習資料、場地狀況、學習教材。以及處理學習路徑規劃。
|
||||||
|
|
||||||
## 系統需求
|
## 使用需求
|
||||||
|
|
||||||
* PHP5.3 以上,需要有以下Extension:
|
* PHP5.3 以上,需要有以下Extension:
|
||||||
* pdo_mysql
|
* pdo_mysql
|
||||||
* zip
|
* zip
|
||||||
* MariaDB 5.5.31 (可用MySQL)
|
* 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)
|
已將整份專案使用[PHPDocumentor](http://www.phpdoc.org/)產生出[開發文件網站](docs/index.html)
|
||||||
|
|
||||||
產生指令:
|
產生指令(若有使用Guard的話可省略,會自動連同一起產生):
|
||||||
|
|
||||||
phpdoc -d ./htdocs/lib -t ./docs/
|
phpdoc -d ./htdocs/lib -t ./docs/
|
||||||
|
11
htdocs/index.php
Normal file
11
htdocs/index.php
Normal 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>
|
@ -50,7 +50,6 @@ class UserNoFoundException extends UserException {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用者登入密碼錯誤
|
* 使用者登入密碼錯誤
|
||||||
* @since 3.0.0
|
* @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.');
|
parent::__construct($userId, 'UserId: "'.$this->type.'" is exist.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user