Skip to content

Commit

Permalink
Add plugins templates for vanilla javascript and babel
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Jul 8, 2015
1 parent a0ffe64 commit 3511ef2
Show file tree
Hide file tree
Showing 19 changed files with 267 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class Main
@subscriptionsOfCommands.add atom.commands.add 'atom-workspace',
'minimap:toggle': => @toggle()
'minimap:generate-plugin-coffee': => @generatePlugin('coffee')
'minimap:generate-plugin-javascript': => @generatePlugin('javascript')
'minimap:generate-plugin-babel': => @generatePlugin('babel')

# Other Subscriptions
@subscriptions = new CompositeDisposable
Expand Down
3 changes: 3 additions & 0 deletions templates/plugin-babel/.gitignore.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
npm-debug.log
node_modules
8 changes: 8 additions & 0 deletions templates/plugin-babel/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: objective-c

notifications:
email:
on_success: never
on_failure: change

script: 'curl -s https://raw.githubusercontent.com/fundon/atom-minimap/master/ci/build-package.sh | sh'
3 changes: 3 additions & 0 deletions templates/plugin-babel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0 - First Release
* Every feature added
* Every bug fixed
20 changes: 20 additions & 0 deletions templates/plugin-babel/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2014 <Your name here>

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.
5 changes: 5 additions & 0 deletions templates/plugin-babel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# __package-name__ package

A short description of your package.

![A screenshot of your spankin' package](https://f.cloud.github.com/assets/69169/2290250/c35d867a-a017-11e3-86be-cd7c5bf3ff9b.gif)
44 changes: 44 additions & 0 deletions templates/plugin-babel/lib/__package-name__.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
'use babel';

import { CompositeDisposable } from 'event-kit';

class __PackageName__ {
constructor() {
this.active = false;
}

isActive() { return this.active; }

activate(state) {
this.subscriptions = new CompositeDisposable;
}

consumeMinimapServiceV1(minimap1) {
this.minimap = minimap1;
this.minimap.registerPlugin('__package-name__', this);
}

deactivate() {
this.minimap.unregisterPlugin('__package-name__');
this.minimap = null;
}

activatePlugin() {
if (this.active) return;

this.active = true;
this.minimapsSubscription = this.minimap.observeMinimaps((minimap) => {
let minimapElement = atom.views.getView(minimap);
});
}

deactivatePlugin() {
if (!this.active) return;

this.active = false;
this.minimapsSubscription.dispose();
this.subscriptions.dispose();
}
}

export default new __PackageName__();
21 changes: 21 additions & 0 deletions templates/plugin-babel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "__package-name__",
"main": "./lib/__package-name__",
"version": "0.0.0",
"description": "A short description of your package",
"repository": "https://github.com/__package-author__/__package-name__",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
},
"consumedServices": {
"minimap": {
"versions": {
"1.0.0": "consumeMinimapServiceV1"
}
}
},
"dependencies": {
"event-kit": ">= 0.7.2"
}
}
31 changes: 31 additions & 0 deletions templates/plugin-babel/spec/__package-name__-spec.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use babel';

import __PackageName__ from '../lib/__package-name__';

describe("__PackageName__", function() {
var editor,
ref,
workspaceElement;

beforeEach(function() {
workspaceElement = atom.views.getView(atom.workspace);
jasmine.attachToDOM(workspaceElement);
waitsForPromise(function() { return atom.workspace.open('sample.js'); });

runs(function() {
editor = atom.workspace.getActiveTextEditor();
editor.setText("This is the file content");
});
waitsForPromise(function() {
return atom.packages.activatePackage('minimap');
});
return waitsForPromise(function() {
return atom.packages.activatePackage('__package-name__');
});
});
describe("with an open editor that have a minimap", function() {
it("lives", function() {
expect('life').toBe('easy');
});
});
});
5 changes: 5 additions & 0 deletions templates/plugin-babel/styles/__package-name__.less.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// The ui-variables file is provided by base themes provided by Atom.
//
// See https://github.com/atom/atom-dark-ui/blob/master/stylesheets/ui-variables.less
// for a full listing of what's available.
@import "ui-variables";
3 changes: 3 additions & 0 deletions templates/plugin-javascript/.gitignore.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
npm-debug.log
node_modules
8 changes: 8 additions & 0 deletions templates/plugin-javascript/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: objective-c

notifications:
email:
on_success: never
on_failure: change

script: 'curl -s https://raw.githubusercontent.com/fundon/atom-minimap/master/ci/build-package.sh | sh'
3 changes: 3 additions & 0 deletions templates/plugin-javascript/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0 - First Release
* Every feature added
* Every bug fixed
20 changes: 20 additions & 0 deletions templates/plugin-javascript/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2014 <Your name here>

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.
5 changes: 5 additions & 0 deletions templates/plugin-javascript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# __package-name__ package

A short description of your package.

![A screenshot of your spankin' package](https://f.cloud.github.com/assets/69169/2290250/c35d867a-a017-11e3-86be-cd7c5bf3ff9b.gif)
31 changes: 31 additions & 0 deletions templates/plugin-javascript/lib/__package-name__.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var CompositeDisposable = require('event-kit').CompositeDisposable;

module.exports = {
active: false,
isActive: function() { return this.active; },
activate: function(state) {
this.subscriptions = new CompositeDisposable;
},
consumeMinimapServiceV1: function(minimap1) {
this.minimap = minimap1;
this.minimap.registerPlugin('__package-name__', this);
},
deactivate: function() {
this.minimap.unregisterPlugin('__package-name__');
this.minimap = null;
},
activatePlugin: function() {
if (this.active) return;

this.active = true;
this.minimapsSubscription = this.minimap.observeMinimaps(function(minimap) {
var minimapElement = atom.views.getView(minimap);
});
},
deactivatePlugin: function() {
if (!this.active) return;
this.active = false;
this.minimapsSubscription.dispose();
this.subscriptions.dispose();
}
};
21 changes: 21 additions & 0 deletions templates/plugin-javascript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "__package-name__",
"main": "./lib/__package-name__",
"version": "0.0.0",
"description": "A short description of your package",
"repository": "https://github.com/__package-author__/__package-name__",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
},
"consumedServices": {
"minimap": {
"versions": {
"1.0.0": "consumeMinimapServiceV1"
}
}
},
"dependencies": {
"event-kit": ">= 0.7.2"
}
}
29 changes: 29 additions & 0 deletions templates/plugin-javascript/spec/__package-name__-spec.js.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var __PackageName__ = require('../lib/__package-name__');

describe("__PackageName__", function() {
var editor,
ref,
workspaceElement;

beforeEach(function() {
workspaceElement = atom.views.getView(atom.workspace);
jasmine.attachToDOM(workspaceElement);
waitsForPromise(function() { return atom.workspace.open('sample.js'); });

runs(function() {
editor = atom.workspace.getActiveTextEditor();
editor.setText("This is the file content");
});
waitsForPromise(function() {
return atom.packages.activatePackage('minimap');
});
return waitsForPromise(function() {
return atom.packages.activatePackage('__package-name__');
});
});
describe("with an open editor that have a minimap", function() {
it("lives", function() {
expect('life').toBe('easy');
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// The ui-variables file is provided by base themes provided by Atom.
//
// See https://github.com/atom/atom-dark-ui/blob/master/stylesheets/ui-variables.less
// for a full listing of what's available.
@import "ui-variables";

0 comments on commit 3511ef2

Please sign in to comment.