Update readme, store data in homedir/.name_pending instead the cwd, move client build output back to client/dist
This commit is contained in:
parent
891f7b2f10
commit
65229f7a9e
37
README.md
37
README.md
|
@ -1,28 +1,41 @@
|
|||
# name_pending
|
||||
Web-based IRC client in Go.
|
||||
|
||||
## Building
|
||||
|
||||
#### Requirements
|
||||
* [Go](http://golang.org/doc/install)
|
||||
* [Node.js + npm](http://nodejs.org/download/)
|
||||
|
||||
#### Get the source
|
||||
## Installing
|
||||
```bash
|
||||
go get github.com/khlieng/name_pending
|
||||
```
|
||||
|
||||
#### Compile the server
|
||||
## Running
|
||||
```bash
|
||||
name_pending
|
||||
```
|
||||
|
||||
## Building the server
|
||||
|
||||
#### Requirements
|
||||
* [Go](http://golang.org/doc/install)
|
||||
|
||||
```bash
|
||||
cd $GOPATH/src/github.com/khlieng/name_pending
|
||||
go build -o bin/name_pending
|
||||
go install
|
||||
```
|
||||
|
||||
#### Build the client
|
||||
## Building the client
|
||||
|
||||
#### Requirements
|
||||
* [Node.js + npm](https://nodejs.org/download/)
|
||||
|
||||
```bash
|
||||
npm install -g gulp
|
||||
go get github.com/jteeuwen/go-bindata/...
|
||||
go get github.com/elazarl/go-bindata-assetfs/...
|
||||
|
||||
cd client
|
||||
cd $GOPATH/src/github.com/khlieng/name_pending/client
|
||||
npm install
|
||||
gulp -p
|
||||
```
|
||||
go-bindata-assetfs -nomemcopy dist/...
|
||||
mv bindata_assetfs.go ../bindata.go
|
||||
|
||||
# Rebuild the server :)
|
||||
```
|
290
bindata.go
290
bindata.go
File diff suppressed because one or more lines are too long
|
@ -21,16 +21,16 @@ if (argv.production) {
|
|||
}
|
||||
|
||||
gulp.task('html', function() {
|
||||
gulp.src('./src/*.html')
|
||||
gulp.src('src/*.html')
|
||||
.pipe(minifyHTML())
|
||||
.pipe(gulp.dest('../bin/assets'));
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('css', function() {
|
||||
gulp.src('./src/css/*.css')
|
||||
gulp.src('src/css/*.css')
|
||||
.pipe(autoprefixer())
|
||||
.pipe(minifyCSS())
|
||||
.pipe(gulp.dest('../bin/assets/css'));
|
||||
.pipe(gulp.dest('dist/css'));
|
||||
});
|
||||
|
||||
gulp.task('js', function() {
|
||||
|
@ -60,7 +60,7 @@ function js(watch) {
|
|||
return stream
|
||||
.pipe(source('bundle.js'))
|
||||
.pipe(gulpif(argv.production, streamify(uglify())))
|
||||
.pipe(gulp.dest('../bin/assets'));
|
||||
.pipe(gulp.dest('dist'));
|
||||
};
|
||||
|
||||
bundler.on('time', function(time) {
|
||||
|
@ -71,26 +71,26 @@ function js(watch) {
|
|||
}
|
||||
|
||||
gulp.task('fonts', function() {
|
||||
gulp.src('./src/font/*')
|
||||
.pipe(gulp.dest('../bin/assets/font'));
|
||||
gulp.src('src/font/*')
|
||||
.pipe(gulp.dest('dist/font'));
|
||||
});
|
||||
|
||||
gulp.task('gzip', ['html', 'css', 'js', 'fonts'], function() {
|
||||
gulp.src('../bin/assets/**/!(*.gz)')
|
||||
gulp.src('dist/**/!(*.gz)')
|
||||
.pipe(gzip())
|
||||
.pipe(gulp.dest('../bin/assets'));
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('gzip:watch', function() {
|
||||
gulp.src('../bin/assets/**/*.{html,css,js}')
|
||||
gulp.src('dist/**/*.{html,css,js}')
|
||||
.pipe(gzip())
|
||||
.pipe(gulp.dest('../bin/assets'));
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('watch', ['default'], function() {
|
||||
gulp.watch('../bin/assets/**/*.{html,css,js}', ['gzip:watch'])
|
||||
gulp.watch('./src/*.html', ['html']);
|
||||
gulp.watch('./src/css/*.css', ['css']);
|
||||
gulp.watch('dist/**/*.{html,css,js}', ['gzip:watch'])
|
||||
gulp.watch('src/*.html', ['html']);
|
||||
gulp.watch('src/css/*.css', ['css']);
|
||||
return js(true);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,13 +1,27 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
)
|
||||
|
||||
var db *bolt.DB
|
||||
|
||||
func init() {
|
||||
db, _ = bolt.Open("data.db", 0600, nil)
|
||||
var err error
|
||||
currentUser, _ := user.Current()
|
||||
appDir := path.Join(currentUser.HomeDir, ".name_pending")
|
||||
|
||||
os.Mkdir(appDir, 0777)
|
||||
|
||||
db, err = bolt.Open(path.Join(appDir, "data.db"), 0600, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Unable to open database file")
|
||||
}
|
||||
|
||||
db.Update(func(tx *bolt.Tx) error {
|
||||
tx.CreateBucketIfNotExists([]byte("Users"))
|
||||
|
|
Loading…
Reference in New Issue