Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'release/v0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhiokim committed Feb 20, 2012
2 parents 919c1a5 + 2666eda commit c953e5e
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 31 deletions.
107 changes: 86 additions & 21 deletions README.md
@@ -1,14 +1,31 @@
#intro
#Intro
locally 는 웹 개발 시 로컬 서버를 손쉽게 생성해서 테스트 개발환경을 구축하기 위한 Node.js 기반의 미들웨어이다. 이 프로젝트는 Python 의 SimpleHTTPServer 에서 아이디어를 얻었다.

언제, 어느 작업 디렉토리에 있던 내가 원하는 로컬 서버를 설정하기 위해서 사용된다.

뿐만 아니라 최근의 웹 기술중 서버측 css인 less 를 지원한다. 그리고 향후 유용한 서버측 환경설정 프리셋을 제공하여 손쉽게 마크업 개발 환경을 만들 예정이다.
>뿐만 아니라 최근의 웹 기술중 서버측 css인 less 를 지원한다. 그리고 향후 유용한 서버측 환경설정 프리셋을 제공하여 손쉽게 마크업 개발 환경을 만들 예정이다. <small>&lt;보류&gt;</small>
#locally middleware
locally 는 connect 모듈을 기반으로 동작하는데 connect 모듈은 다양한 미들웨어를 추가해서 high class 기능등을 사용할 수 있다. 뿐만 아니라 손쉽게 로컬 웹 서버를 구축해서 마크업 환경을 설정할 수 있다.

#usage
#Install
Require NPM(Node Package Manager)

```
curl http://npmjs.org/install.sh | sh
```

NPM module install to global

```
$ npm install -g locally
```


#Dependencies
locally 는 connect 모듈을 통해 웹 서버가 구동되고 cli 모듈은 commander.js 모듈을 이용하였다. 두가지 모듈 모두 visionmedia 의 TJ 가 개발한 node.js 모듈이다.

#How to use

**directory structure**

```
Expand All @@ -23,43 +40,91 @@ locally 는 connect 모듈을 기반으로 동작하는데 connect 모듈은 다
- about/index.html
```

**python**

```python
$ python -m SimpleHTTPServer -p 8080
```


**basic command**

```
```bash
//simple command
$ locally -p 8080

//full command
$ locally --static ./static --public ./public -port 8080
$ locally --public ./public -port 8080

//short cut command
$ locally -w ./public -p 8080

//debug mode
$ locally --debug

$ curl http://localhost:8080/
$ curl http://localhost:8080/about
```

**python**
**help cli**

```python
$ python -m SimpleHTTPServer -p 8080
```bash
$ locally --help

Usage: _locally [options]

Options:

-h, --help output usage information
-V, --version output the version number
-s, --static <directory> directory for serving static files
-w, --public <directory> directory for serving public files
-d, --debug debug mode
-p, --port <port> public port
-f, --file <configuration> set configuration file
-n, --vhost <virtual host> set vhost information

Examples:

$ locally -w ./public -p 8080 start basic locally server
$ locally -d debug mode, default <false>
$ locally -f ./conf/.locally force adjust locally configuration file
```

**help cli**
##options
`locally` 는 기본적으로 실행 위치를 기준으로 `.locally` 파일로 미리 정의된 환경 옵션 셋을 지원한다.

> 만약 이 파일이 없다면 `locally --help` 를 통해 cli 옵션을 활용할 수 있다.
```
$ node lib/locally.js --help
$ cd /path/to/my_web_project
$ pwd
/path/to/my_web_project
$ cat .locally
-w ./src/main
-p 8081
--debug
$ locally
document root : /path/to/my_web_project/./src/main
debug mode : true
Serving started at http://localhost:8081
```

Usage: locally.js [options] [command]
#Roadmap
* Virtual Host 환경 지원
* fs.watcher 를 이용한 on the fly 기능
* markdown preview 기능 지원

Commands:
#License

init
locally setup webserver configuration
(The MIT License)

Options:
Copyright (c) 2011 Rhio Kim <rhio.kim@gmail.com>

-h, --help output usage information
-V, --version output the version number
-s, --static <directory> directory for serving static files
-d, --public <directory> directory for serving public files
```
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 2 additions & 2 deletions bin/_locally
Expand Up @@ -32,7 +32,7 @@ program.on('--help', function() {
function loadConfiguration() {
// locally.opt support
try {
var opts = fs.readFileSync(__dirname +'/.locally' , 'utf8')
var opts = fs.readFileSync(process.cwd() +'/.locally' , 'utf8')
.trim()
.split(/\s+/);

Expand Down Expand Up @@ -79,7 +79,7 @@ program.parse(process.argv);
* connect binding
*/
function createServer() {
var _static = __dirname +'/'+ program.public;
var _static = process.cwd() +'/'+ program.public;
var app = connect(
connect.static(_static),
connect.bodyParser()
Expand Down
Empty file removed example/server.opt
Empty file.
Empty file removed example/server.sample.opt
Empty file.
6 changes: 3 additions & 3 deletions lib/locally.js
Expand Up @@ -6,7 +6,7 @@ var connect = require('connect'),
* process.argv pre process
*/
program
.version('0.1.0')
.version('0.1.2')
.usage('[options]')
.option('-s, --static <directory>', 'directory for serving static files', 'static')
.option('-w, --public <directory>', 'directory for serving public files', './')
Expand All @@ -30,7 +30,7 @@ program.on('--help', function() {
function loadConfiguration() {
// locally.opt support
try {
var opts = fs.readFileSync(__dirname +'/.locally' , 'utf8')
var opts = fs.readFileSync(process.cwd() +'/.locally' , 'utf8')
.trim()
.split(/\s+/);

Expand Down Expand Up @@ -77,7 +77,7 @@ program.parse(process.argv);
* connect binding
*/
function createServer() {
var _static = __dirname +'/'+ program.public;
var _static = process.cwd() +'/'+ program.public;
var app = connect(
connect.static(_static),
connect.bodyParser()
Expand Down
9 changes: 5 additions & 4 deletions package.json
@@ -1,13 +1,14 @@
{
"author": "Rhio Kim <rhio.kim@gmail.com> (http://about.me/rhio)",
"name": "locally",
"description": "simple, locally web server",
"version": "0.0.0",
"homepage": "http://about.me/rhio",
"description": "simple, locally web server for file serving & markup job. '$ python -m SimpleHTTPServer 8080' ",
"version": "0.1.2",
"homepage": "http://github.com/rhiokim/locally",
"repository": {
"type": "git",
"url": "git@github.com:rhiokim/locally.git"
},
"main": "index",
"main": "index.js",
"bin": { "locally": "./bin/locally", "_locally": "./bin/_locally" },
"engines": {
"node": "~0.6.9"
Expand Down
2 changes: 1 addition & 1 deletion tests/.locally
@@ -1 +1 @@
--public ../tests/public/
-w ./public
1 change: 1 addition & 0 deletions tests/locally-test.sh
@@ -0,0 +1 @@
node ../lib/locally.js -w public -p 8081 --debug

0 comments on commit c953e5e

Please sign in to comment.