Merge remote-tracking branch 'origin/master'
This commit is contained in:
+4
-2
@@ -1,2 +1,4 @@
|
||||
.idea
|
||||
node_modules
|
||||
/.idea
|
||||
/node_modules
|
||||
/config.json
|
||||
/data
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"esversion": 6,
|
||||
"maxerr": 999,
|
||||
"indent": true,
|
||||
"camelcase": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"varstmt": true,
|
||||
"sub": true,
|
||||
"quotmark": "single",
|
||||
"node": true,
|
||||
"globals": {
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
dist: xenial
|
||||
language: node_js
|
||||
node_js:
|
||||
- "12"
|
||||
cache:
|
||||
npm: true
|
||||
directories:
|
||||
- node_modules
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- graphviz
|
||||
install:
|
||||
- npm install
|
||||
- npm install node-plantuml
|
||||
before_script:
|
||||
- npm install -g jshint
|
||||
script:
|
||||
- npm test
|
||||
- jshint ./src
|
||||
@@ -1,6 +1,8 @@
|
||||
# GitBlog.md (WIP)
|
||||
> This is a work in progress, some information written here might not be true yet.
|
||||
|
||||
[](https://travis-ci.org/Klemek/GitBlog.md)
|
||||
|
||||
A static blog using Markdown pulled from your git repository.
|
||||
|
||||
## Flow
|
||||
@@ -14,9 +16,10 @@ A static blog using Markdown pulled from your git repository.
|
||||

|
||||
|
||||
## Installation
|
||||
**1. Download the latest version from the repo**
|
||||
**1. Download and install the latest version from the repo**
|
||||
```bash
|
||||
git clone https://github.com/klemek/gitblog.md.git
|
||||
npm install
|
||||
```
|
||||
**2. Create your config file**
|
||||
```bash
|
||||
@@ -27,13 +30,13 @@ then edit the config.json file with your values :
|
||||
> default values for config.json
|
||||
````json
|
||||
{
|
||||
"node_port": 3000,
|
||||
"data_dir": "data",
|
||||
"nodePort": 3000,
|
||||
"dataDir": "data",
|
||||
"modules" : {
|
||||
"plantuml" : true,
|
||||
"rss": true,
|
||||
"webhook": true
|
||||
},
|
||||
"plantuml" : false,
|
||||
"rss": true,
|
||||
"webhook": true
|
||||
},
|
||||
"home" : {
|
||||
"index" : "index.ejs"
|
||||
},
|
||||
@@ -41,16 +44,27 @@ then edit the config.json file with your values :
|
||||
"index" : "index.md"
|
||||
},
|
||||
"rss" : {
|
||||
"endpoint" : "/rss",
|
||||
"endpoint" : "/rss",
|
||||
"length" : 10
|
||||
},
|
||||
"webhook" : {
|
||||
"endpoint": "/webhook",
|
||||
"secret_file": "git_secret"
|
||||
"secretFile": "git_secret"
|
||||
}
|
||||
}
|
||||
````
|
||||
**3. Create and init your git source**
|
||||
|
||||
**3. Start your server**
|
||||
|
||||
```bash
|
||||
npm start
|
||||
#or
|
||||
node src/server.js
|
||||
```
|
||||
|
||||
You might want to use something like screen to separate the process from your current terminal session.
|
||||
|
||||
**4. Create and init your git source**
|
||||
|
||||
You need to [create a new repository](https://github.com/new) on your favorite Git service.
|
||||
|
||||
@@ -61,7 +75,7 @@ git remote add origin <url_of_your_repo.git>
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
**4. Refresh content with a webhook (optional)**
|
||||
**5. Refresh content with a webhook (optional)**
|
||||
|
||||
At first start, a `git_secret` file will be generated, use it to create a new webhook as following :
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"nodePort": 3000,
|
||||
"dataDir": "data",
|
||||
"modules" : {
|
||||
"plantuml" : false,
|
||||
"rss": true,
|
||||
"webhook": true
|
||||
},
|
||||
"home" : {
|
||||
"index" : "index.ejs"
|
||||
},
|
||||
"article" : {
|
||||
"index" : "index.md"
|
||||
},
|
||||
"rss" : {
|
||||
"endpoint" : "/rss",
|
||||
"length" : 10
|
||||
},
|
||||
"webhook" : {
|
||||
"endpoint": "/webhook",
|
||||
"secretFile": "git_secret"
|
||||
}
|
||||
}
|
||||
Generated
+9775
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "gitblog.md",
|
||||
"version": "1.0.0",
|
||||
"description": "A static blog using Markdown pulled from your git repository.",
|
||||
"main": "src/server.js",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1",
|
||||
"ncp": "^2.0.0",
|
||||
"showdown": "^1.9.0",
|
||||
"xml": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"jest": "^24.8.0",
|
||||
"superagent": "^5.1.0",
|
||||
"supertest": "^4.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"install": "node src/postinstall.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/klemek/gitblog.md.git"
|
||||
},
|
||||
"author": "klemek",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/klemek/gitblog.md/issues"
|
||||
},
|
||||
"homepage": "https://github.com/klemek/gitblog.md#readme"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 898 KiB |
@@ -0,0 +1,6 @@
|
||||
# Welcome to your new blog
|
||||
|
||||
## If you see this page, that means it's working
|
||||
|
||||

|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
module.exports = function(/*config*/){
|
||||
app.get('/', (req,res) => {
|
||||
res.status(200).send('Hello World!');
|
||||
});
|
||||
|
||||
return app;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
const fs = require('fs');
|
||||
const ncp = require('ncp').ncp;
|
||||
|
||||
const pad0 = n => ('0'+n).substr(-2);
|
||||
|
||||
const datetime = new Date();
|
||||
const dir = `./data/${datetime.getFullYear()}/${pad0(datetime.getMonth())}/${pad0(datetime.getDay())}/`;
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, {recursive: true});
|
||||
}
|
||||
|
||||
ncp('./sample_data/',dir, function(err){
|
||||
if(err)
|
||||
console.error(err);
|
||||
else
|
||||
console.log(`sample data copied to ${dir}`);
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
const config = require('../config.json');
|
||||
const app = require('./app')(config);
|
||||
|
||||
const port = config.nodePort|3000;
|
||||
|
||||
app.listen(config.nodePort|3000, () => {
|
||||
console.log(`gitblog.md server listening on port ${port}`);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/* jshint -W117 */
|
||||
const request = require('supertest');
|
||||
const config = require('./config.test.json');
|
||||
const app = require('../src/app')(config);
|
||||
|
||||
describe('Test root path', () => {
|
||||
test('GET / 200', done => {
|
||||
request(app).get('/').then(response => {
|
||||
expect(response.statusCode).toBe(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user