Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #10 from allejo/feature/show-min-bzfs
Browse files Browse the repository at this point in the history
Display minimum BZFS version needed for plug-in
  • Loading branch information
allejo committed Apr 8, 2018
2 parents 9e41241 + 9626fda commit f22787f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"font-awesome": "^4.7.0",
"google-fonts-webpack-plugin": "^0.4.4",
"lodash": "^4.17.5",
"semver": "^5.5.0",
"vue": "^2.5.15",
"vue-class-component": "^6.2.0",
"vue-clipboard2": "0.0.9",
Expand Down
25 changes: 23 additions & 2 deletions src/components/PluginGenerator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@

<div class="plugin-container">
<div class="c-toolbar">
<button class="btn btn-secondary"
data-balloon-pos="down"
data-balloon="Minimum BZFS requirement"
>
{{ minimumBZFS }}
</button>
<button class="btn btn-primary"
data-balloon-pos="up"
data-balloon-pos="down"
data-balloon="Download the plug-in file"
@click="downloadPlugin"
>
Expand All @@ -14,7 +20,7 @@
</button>

<button class="btn btn-primary"
data-balloon-pos="up"
data-balloon-pos="down"
data-balloon="Copy the plug-in code to your clipboard"
v-clipboard:copy="pluginOutput"
>
Expand Down Expand Up @@ -76,6 +82,7 @@ import {
import { IPluginEvent } from '../lib/IPluginEvent';
import CPPSwitchBlock from 'aclovis/dist/cpp/CPPSwitchBlock';
import { saveAs } from 'file-saver';
import semver from 'semver';
@Component({
name: 'plugin-generator'
Expand Down Expand Up @@ -171,6 +178,20 @@ export default class PluginGenerator extends Vue {
return pluginChunks.join('');
}
get minimumBZFS() {
const versions = this.pluginDefinition.events.sort(function(a, b) {
return semver.gt(b.since, a.since);
});
const highestEvent = _.first(versions);
if (highestEvent) {
return highestEvent.since;
}
return '2.4.0';
}
downloadPlugin() {
let blob = new Blob([this.pluginOutput], { type: 'text/plain;charset=utf-8' });
saveAs(blob, `${this.className}.cpp`);
Expand Down

0 comments on commit f22787f

Please sign in to comment.