Skip to content

Commit

Permalink
Redid how plugins work. It will not be built alongside ribbon core now.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpox committed Mar 27, 2019
1 parent b6bb45a commit 70e4b73
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ themes/flac/scss/
themes/
admin/
dist/
app/plugin/
combined.log
package-lock.json
.env
7 changes: 3 additions & 4 deletions app/ribbon.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,21 @@ class Ribbon {
async loadPlugins() {
const plugins = this.getPluginDirectories();
const enabled = process.env.PLUGINS.split(',');

plugins.forEach((file) => {
// Retrieve package.json.
/* eslint-disable */
const plugin_info = require(`./plugin/${file}/package.json`);
const plugin_info = require(`${process.cwd()}/plugins/${file}/package.json`);
if (enabled.indexOf(plugin_info.name) !== -1) {
this.log.plugin(`${plugin_info.name} (${plugin_info.version})`);

require(`./plugin/${file}/${plugin_info.main}`)(this.app, this.log); // eslint-disable-line global-require
require(`${process.cwd()}/plugins/${file}/${plugin_info.main}`)(this.app, this.log); // eslint-disable-line global-require
}
/* eslint-enable */
});
}

getPluginDirectories() {
return Fs.readdirSync('./app/plugin').filter(file => Fs.statSync(`./app/plugin/${file}`).isDirectory());
return Fs.readdirSync(`${process.cwd()}/plugins`).filter(file => Fs.statSync(`${process.cwd()}/plugins/${file}`).isDirectory());
}

async loadRoutes() {
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ribbon",
"version": "2018.11.24",
"version": "2019.3.27",
"description": "A platform to share your stories.",
"main": "dist/ribbon.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"eslint": "./node_modules/.bin/eslint app/*",
"eslint_fix": "./node_modules/.bin/eslint app/* --fix",
"build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./npm-debug.log,./config,./public,./themes,./admin,./combined.log --copy-files",
"build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./npm-debug.log,./config,./public,./themes,./admin,./plugins,./combined.log --copy-files",
"dev": "nodemon ribbon.js --exec babel-node",
"setup": "npm install && npm run build && node dist/install.js",
"upgrade": "npm install && npm run build && node dist/update.js"
Expand Down Expand Up @@ -54,7 +54,8 @@
"themes/*",
"admin/*",
"public/*",
"dist/*"
"dist/*",
"plugins/*"
]
}
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion themes/july/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

.row
each box in boxes
div(class="col-md-"+box.content_column class=(box.content_offset === 0)? "" : "offset-md-" + box.content_offset)
div(class="col-md-"+box.content_column+" offset-md-"+box.content_offset)
.card
.card-body
h5.card-title=box.title
Expand Down

0 comments on commit 70e4b73

Please sign in to comment.