diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..4518eca --- /dev/null +++ b/.babelrc @@ -0,0 +1,19 @@ +{ + "comments": false, + "compact": true, + "plugins": [ + "transform-class-properties", + "transform-runtime" + ], + "presets": [ + "flow", + [ + "env", + { + "targets": { + "node": 4 + } + } + ] + ] +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..896aeec --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{json,yml}] +indent_style = space +indent_size = 2 + +[.*rc] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..5adefe8 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,21 @@ +{ + "parser": "babel-eslint", + "extends": "xo", + "env": { + "node": true + }, + "rules": { + "indent": [ + "error", + 4, + { + "SwitchCase": 1 + } + ], + "flowtype-errors/show-errors": 2, + "no-prototype-builtins": "off" + }, + "plugins": [ + "flowtype-errors" + ] +} diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000..4a58bdc --- /dev/null +++ b/.flowconfig @@ -0,0 +1,7 @@ +[ignore] + +[include] + +[libs] + +[options] diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2ebfc83 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/*.js -diff +*.js.map -diff diff --git a/.gitignore b/.gitignore index 4b173c6..bed8a25 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules/ -coverage/ +icons/ npm-debug.log diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..015ec70 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,75 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at [info@cloudstek.nl][abusemail]. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ +[abusemail]: mailto:info@cloudstek.nl diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a4a052f --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,18 @@ +Copyright (c) 2017, Cloudstek All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index ed7257b..a263779 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,32 @@ Simple workflow that allows you to browse and open [Atom](https://atom.io/) projects. +* [Requirements](#requirements) +* [Installation](#installation) +* [Usage](#usage) + ## Requirements -* [NodeJS](https://nodejs.org/) +* [NodeJS](https://nodejs.org) * [Atom Project Manager package](https://atom.io/packages/project-manager) +* [Alfred Powerpack](https://www.alfredapp.com/powerpack) + +## Installation + +### NPM + +This workflow can be installed with NPM, as an added bonus you'll get a notification when an update is available! + +```shell +npm install -g alfred-atom +``` + +### Packal / GitHub + +Download the latest `Atom.alfredworkflow` from [Packal](http://www.packal.org/workflow/atom) or [GitHub](https://github.com/Cloudstek/alfred-atom/releases) and import it in Alfred. ## Usage -Simply type atom followed by space to list all projects. Optionally type a search string to filter results. +Simply type `atom` followed by space to list all projects. Optionally type a search string to filter results. -![alfred-atom](doc/screenshot.png) +![alfred-atom](screenshot.png) diff --git a/doc/screenshot.png b/doc/screenshot.png deleted file mode 100644 index d6503e1..0000000 Binary files a/doc/screenshot.png and /dev/null differ diff --git a/gulp/index.js b/gulp/index.js new file mode 100644 index 0000000..28d4898 --- /dev/null +++ b/gulp/index.js @@ -0,0 +1,32 @@ +'use strict'; +const gulp = require('gulp'); +const util = require('gulp-util'); + +module.exports = tasks => { + tasks.forEach(name => { + const task = require('./tasks/' + name); + + // Task function only + if (typeof task === 'function') { + gulp.task(name, task); + return; + } + + // Task dependencies or task function and dependencies + if (task instanceof Array && task.length > 0) { + // Task function with dependencies + if (task.length >= 2 && task[0] instanceof Array && typeof task[task.length - 1] === 'function') { + gulp.task(name, task[0], task[task.length - 1]); + return; + } + + // Task dependencies only + gulp.task(name, task); + return; + } + + util.log(util.colors.cyan('Task ' + name + ' is not a valid task, please fix!')); + }); + + return gulp; +}; diff --git a/gulp/tasks/babel.js b/gulp/tasks/babel.js new file mode 100644 index 0000000..d3e3f5c --- /dev/null +++ b/gulp/tasks/babel.js @@ -0,0 +1,22 @@ +'use strict'; +const fs = require('fs'); +const gulp = require('gulp'); +const babel = require('gulp-babel'); +const rename = require('gulp-rename'); +const sourcemaps = require('gulp-sourcemaps'); + +let task = () => { + let babelrc = JSON.parse(fs.readFileSync('.babelrc', 'utf8') || '{}'); + + return gulp.src(['./**/*.js.flow', '!node_modules', '!node_modules/**']) + .pipe(sourcemaps.init()) + .pipe(babel(babelrc)) + .pipe(rename(path => { + // Fix file extension for double ext files (.js.flow) + path.extname = path.basename.endsWith('.js') ? '' : '.js'; + })) + .pipe(sourcemaps.write('.')) + .pipe(gulp.dest('.')); +}; + +module.exports = [['eslint'], task]; diff --git a/gulp/tasks/eslint.js b/gulp/tasks/eslint.js new file mode 100644 index 0000000..7b14dae --- /dev/null +++ b/gulp/tasks/eslint.js @@ -0,0 +1,12 @@ +'use strict'; +const gulp = require('gulp'); +const eslint = require('gulp-eslint'); + +let task = () => { + return gulp.src(['./**/*.js.flow', './tests/*.js', '!node_modules', '!node_modules/**']) + .pipe(eslint()) + .pipe(eslint.format('node_modules/eslint-formatter-pretty')) + .pipe(eslint.failAfterError()); +}; + +module.exports = task; diff --git a/gulp/tasks/watch.js b/gulp/tasks/watch.js new file mode 100644 index 0000000..373d34f --- /dev/null +++ b/gulp/tasks/watch.js @@ -0,0 +1,8 @@ +'use strict'; +const gulp = require('gulp'); + +let task = done => { + gulp.watch(['./**/*.js.flow', '!node_modules', '!node_modules/**'], ['babel']); +}; + +module.exports = [['default'], task]; diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..83795c7 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,9 @@ +const gulp = require('./gulp')([ + 'babel', + 'eslint', + 'watch' +]); + +gulp.task('default', [ + 'babel' +]); diff --git a/icons.js b/icons.js new file mode 100644 index 0000000..e26f65b --- /dev/null +++ b/icons.js @@ -0,0 +1,2 @@ +'use strict';var _regenerator=require('babel-runtime/regenerator');var _regenerator2=_interopRequireDefault(_regenerator);var _keys=require('babel-runtime/core-js/object/keys');var _keys2=_interopRequireDefault(_keys);var _asyncToGenerator2=require('babel-runtime/helpers/asyncToGenerator');var _asyncToGenerator3=_interopRequireDefault(_asyncToGenerator2);var _classCallCheck2=require('babel-runtime/helpers/classCallCheck');var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _createClass2=require('babel-runtime/helpers/createClass');var _createClass3=_interopRequireDefault(_createClass2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var color=require('color');var fs=require('fs');var Hugo=require('alfred-hugo');var path=require('path');var svgexport=require('svgexport');var octicons=require('octicons');var octiconsPath=path.join(path.dirname(require.resolve('octicons')),'build','svg');var Icons=function(){function Icons(){(0,_classCallCheck3.default)(this,Icons);}(0,_createClass3.default)(Icons,[{key:'_pathColor',value:function _pathColor(){var iconColor=color('#FFFFFF');if(Hugo.alfredThemeFile){try{iconColor=color(Hugo.alfredTheme.result.text.color);}catch(e){}}else if(process.env.alfred_theme_background){var bgColor=color(process.env.alfred_theme_background);iconColor=bgColor.grayscale().negate();}return iconColor.rgb().string();}},{key:'rebuild',value:function(){var _ref=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(projects){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var iconPath,octiconNames,icons,iconSize,renderQueue,i,icon,renderOptions,_i,_icon;return _regenerator2.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:iconPath=path.join(__dirname,'icons');octiconNames=(0,_keys2.default)(octicons);icons=[];iconSize=64;renderQueue=[];i=0;case 6:if(!(i=0){if(icons.indexOf(icon.name)===-1){icons.push(icon.name);}}case 11:i++;_context.next=6;break;case 14:if(options&&options.onlyMissing===true){icons=icons.filter(function(icon){try{fs.statSync(path.join(iconPath,icon+'.png'));return false;}catch(e){return true;}});}if(!(icons.length===0)){_context.next=17;break;}return _context.abrupt('return');case 17:if(Hugo.alfredThemeFile){try{iconSize=Hugo.alfredTheme.result.iconSize;}catch(e){}}renderOptions=[iconSize+':'+iconSize,'pad','path{fill:'+this._pathColor()+'}'];for(_i=0;_i0){renderQueue.push({input:path.join(octiconsPath,_icon+'.svg'),output:[[path.join(iconPath,_icon+'.png')].concat(renderOptions)]});}}svgexport.render(renderQueue,function(err){if(err){throw err;}});case 21:case'end':return _context.stop();}}},_callee,this);}));function rebuild(_x2){return _ref.apply(this,arguments);}return rebuild;}()}]);return Icons;}();module.exports=new Icons(); +//# sourceMappingURL=icons.js.map diff --git a/icons.js.flow b/icons.js.flow new file mode 100644 index 0000000..ff894ca --- /dev/null +++ b/icons.js.flow @@ -0,0 +1,119 @@ +// @flow + +const color = require('color'); +const fs = require('fs'); +const Hugo = require('alfred-hugo'); +const path = require('path'); +const svgexport = require('svgexport'); + +const octicons = require('octicons'); +const octiconsPath = path.join(path.dirname(require.resolve('octicons')), 'build', 'svg'); + +class Icons { + /** + * SVG icon path color + * @return {string} + */ + _pathColor(): string { + let iconColor = color('#FFFFFF'); + + // Decide color based on text or background color + if (Hugo.alfredThemeFile) { + try { + iconColor = color(Hugo.alfredTheme.result.text.color); + } catch (e) {} + } else if (process.env.alfred_theme_background) { + let bgColor = color(process.env.alfred_theme_background); + iconColor = bgColor.grayscale().negate(); + } + + return iconColor.rgb().string(); + } + + /** + * Rebuild icon(s) + * @param {Array.Object} projects + * @param {Object} options + * @return {Promise} + * @async + */ + async rebuild(projects: Array, options: Object = {}) { + // Output path + const iconPath = path.join(__dirname, 'icons'); + + // Octicon names + const octiconNames = Object.keys(octicons); + + // Icons to render + let icons = []; + + // Icon size + let iconSize = 64; + + // Render queue + let renderQueue = []; + + // Get used icons from projects list + for (let i = 0; i < projects.length; i++) { + if (!projects[i].hasOwnProperty('icon')) { + continue; + } + + let icon = path.parse(projects[i].icon.path); + + if (icon.dir === iconPath && octiconNames.indexOf(icon.name) >= 0) { + if (icons.indexOf(icon.name) === -1) { + icons.push(icon.name); + } + } + } + + // Filter icons + if (options && options.onlyMissing === true) { + icons = icons.filter(icon => { + try { + fs.statSync(path.join(iconPath, icon + '.png')); + return false; + } catch (e) { + return true; + } + }); + } + + if (icons.length === 0) { + return; + } + + if (Hugo.alfredThemeFile) { + try { + iconSize = Hugo.alfredTheme.result.iconSize; + } catch (e) {} + } + + // Render options + let renderOptions = [iconSize + ':' + iconSize, 'pad', 'path{fill:' + this._pathColor() + '}']; + + // Build render queue + for (let i = 0; i < icons.length; i++) { + let icon = icons[i]; + + if (icon && icon.length > 0) { + renderQueue.push({ + input: path.join(octiconsPath, icon + '.svg'), + output: [ + [path.join(iconPath, icon + '.png'), ...renderOptions] + ] + }); + } + } + + // Render + svgexport.render(renderQueue, err => { + if (err) { + throw err; + } + }); + } +} + +module.exports = new Icons(); diff --git a/icons.js.map b/icons.js.map new file mode 100644 index 0000000..d42d390 --- /dev/null +++ b/icons.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["icons.js.flow"],"names":["color","require","fs","Hugo","path","svgexport","octicons","octiconsPath","join","dirname","resolve","Icons","iconColor","alfredThemeFile","alfredTheme","result","text","e","process","env","alfred_theme_background","bgColor","grayscale","negate","rgb","string","projects","options","iconPath","__dirname","octiconNames","icons","iconSize","renderQueue","i","length","hasOwnProperty","icon","parse","dir","indexOf","name","push","onlyMissing","filter","statSync","renderOptions","_pathColor","input","output","render","err","module","exports"],"mappings":"krBAEA,GAAMA,OAAQC,QAAQ,OAAR,CAAd,CACA,GAAMC,IAAKD,QAAQ,IAAR,CAAX,CACA,GAAME,MAAOF,QAAQ,aAAR,CAAb,CACA,GAAMG,MAAOH,QAAQ,MAAR,CAAb,CACA,GAAMI,WAAYJ,QAAQ,WAAR,CAAlB,CAEA,GAAMK,UAAWL,QAAQ,UAAR,CAAjB,CACA,GAAMM,cAAeH,KAAKI,IAAL,CAAUJ,KAAKK,OAAL,CAAaR,QAAQS,OAAR,CAAgB,UAAhB,CAAb,CAAV,CAAqD,OAArD,CAA8D,KAA9D,CAArB,C,GAEMC,M,qJAKmB,CACjB,GAAIC,WAAYZ,MAAM,SAAN,CAAhB,CAGA,GAAIG,KAAKU,eAAT,CAA0B,CACtB,GAAI,CACAD,UAAYZ,MAAMG,KAAKW,WAAL,CAAiBC,MAAjB,CAAwBC,IAAxB,CAA6BhB,KAAnC,CAAZ,CACH,CAAC,MAAOiB,CAAP,CAAU,CAAE,CACjB,CAJD,IAIO,IAAIC,QAAQC,GAAR,CAAYC,uBAAhB,CAAyC,CAC5C,GAAIC,SAAUrB,MAAMkB,QAAQC,GAAR,CAAYC,uBAAlB,CAAd,CACAR,UAAYS,QAAQC,SAAR,GAAoBC,MAApB,EAAZ,CACH,CAED,MAAOX,WAAUY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EAAf,CAAmC,GAAtE,C,CAGpB,IAASb,EAAT,CAAa,CAAb,CAAgBA,GAAIH,MAAMI,MAA1B,CAAkCD,IAAlC,CAAuC,CAC/BG,KAD+B,CACxBN,MAAMG,EAAN,CADwB,CAGnC,GAAIG,OAAQA,MAAKF,MAAL,CAAc,CAA1B,CAA6B,CACzBF,YAAYS,IAAZ,CAAiB,CACbM,MAAO5C,KAAKI,IAAL,CAAUD,YAAV,CAAwB8B,MAAO,MAA/B,CADM,CAEbY,OAAQ,EACH7C,KAAKI,IAAL,CAAUoB,QAAV,CAAoBS,MAAO,MAA3B,CADG,SACoCS,aADpC,EAFK,CAAjB,EAMH,CACJ,CAGDzC,UAAU6C,MAAV,CAAiBjB,WAAjB,CAA8B,aAAO,CACjC,GAAIkB,GAAJ,CAAS,CACL,KAAMA,IAAN,CACH,CACJ,CAJD,E,+JAQRC,OAAOC,OAAP,CAAiB,GAAI1C,MAAJ,EAAjB","file":"icons.js","sourcesContent":["// @flow\n\nconst color = require('color');\nconst fs = require('fs');\nconst Hugo = require('alfred-hugo');\nconst path = require('path');\nconst svgexport = require('svgexport');\n\nconst octicons = require('octicons');\nconst octiconsPath = path.join(path.dirname(require.resolve('octicons')), 'build', 'svg');\n\nclass Icons {\n /**\n * SVG icon path color\n * @return {string}\n */\n _pathColor(): string {\n let iconColor = color('#FFFFFF');\n\n // Decide color based on text or background color\n if (Hugo.alfredThemeFile) {\n try {\n iconColor = color(Hugo.alfredTheme.result.text.color);\n } catch (e) {}\n } else if (process.env.alfred_theme_background) {\n let bgColor = color(process.env.alfred_theme_background);\n iconColor = bgColor.grayscale().negate();\n }\n\n return iconColor.rgb().string();\n }\n\n /**\n * Rebuild icon(s)\n * @param {Array.Object} projects\n * @param {Object} options\n * @return {Promise}\n * @async\n */\n async rebuild(projects: Array, options: Object = {}) {\n // Output path\n const iconPath = path.join(__dirname, 'icons');\n\n // Octicon names\n const octiconNames = Object.keys(octicons);\n\n // Icons to render\n let icons = [];\n\n // Icon size\n let iconSize = 64;\n\n // Render queue\n let renderQueue = [];\n\n // Get used icons from projects list\n for (let i = 0; i < projects.length; i++) {\n if (!projects[i].hasOwnProperty('icon')) {\n continue;\n }\n\n let icon = path.parse(projects[i].icon.path);\n\n if (icon.dir === iconPath && octiconNames.indexOf(icon.name) >= 0) {\n if (icons.indexOf(icon.name) === -1) {\n icons.push(icon.name);\n }\n }\n }\n\n // Filter icons\n if (options && options.onlyMissing === true) {\n icons = icons.filter(icon => {\n try {\n fs.statSync(path.join(iconPath, icon + '.png'));\n return false;\n } catch (e) {\n return true;\n }\n });\n }\n\n if (icons.length === 0) {\n return;\n }\n\n if (Hugo.alfredThemeFile) {\n try {\n iconSize = Hugo.alfredTheme.result.iconSize;\n } catch (e) {}\n }\n\n // Render options\n let renderOptions = [iconSize + ':' + iconSize, 'pad', 'path{fill:' + this._pathColor() + '}'];\n\n // Build render queue\n for (let i = 0; i < icons.length; i++) {\n let icon = icons[i];\n\n if (icon && icon.length > 0) {\n renderQueue.push({\n input: path.join(octiconsPath, icon + '.svg'),\n output: [\n [path.join(iconPath, icon + '.png'), ...renderOptions]\n ]\n });\n }\n }\n\n // Render\n svgexport.render(renderQueue, err => {\n if (err) {\n throw err;\n }\n });\n }\n}\n\nmodule.exports = new Icons();\n"]} \ No newline at end of file diff --git a/info.plist b/info.plist index a8529b1..cd7f63c 100644 --- a/info.plist +++ b/info.plist @@ -8,11 +8,11 @@ Productivity connections - 8AF6156F-3E0C-46B9-8D05-5A5589D09EF5 + 14E5559D-490B-4316-8AB3-F36197AD4437 destinationuid - 8CD25A48-2431-45EE-899F-68D3A2033B02 + A28E26AB-2CA3-4F6D-8A86-A5909476B368 modifiers 0 modifiersubtext @@ -20,53 +20,39 @@ vitoclose + + 8AF6156F-3E0C-46B9-8D05-5A5589D09EF5 + destinationuid - FE88D8C3-EE6E-493C-8265-B5837C2894A5 - modifiers - 1048576 - modifiersubtext - Open in new window - vitoclose - - - - destinationuid - C3803FAD-D59A-416E-829A-0171318A4360 - modifiers - 8388608 - modifiersubtext - Append project path(s) to last open window - vitoclose - - - - destinationuid - 35732D96-5B61-4C6E-90F0-763364B11A6A + 14E5559D-490B-4316-8AB3-F36197AD4437 modifiers - 262144 + 0 modifiersubtext - Open in development mode + vitoclose destinationuid - C714B84E-CE96-400A-BEF0-37799139CA39 + D6E4B519-8F01-4A94-B5EB-E8DC8CFE0CD7 modifiers - 131072 + 0 modifiersubtext - Open project path(s) in finder + vitoclose + + D6E4B519-8F01-4A94-B5EB-E8DC8CFE0CD7 + destinationuid - B1127ADC-5698-4325-9C7E-D9C7F46C478F + 38D13A34-4B8D-4D25-9DDE-8BC333F74A1F modifiers - 524288 + 0 modifiersubtext - Open project path(s) in terminal + vitoclose @@ -88,9 +74,9 @@ concurrently escaping - 98 + 34 script - ${atomPath:-/usr/local/bin/atom} {query} + {query} scriptargtype 0 scriptfile @@ -101,42 +87,38 @@ type alfred.workflow.action.script uid - 8CD25A48-2431-45EE-899F-68D3A2033B02 + A28E26AB-2CA3-4F6D-8A86-A5909476B368 version 2 config - concurrently + inputstring + {var:task} + matchcasesensitive - escaping - 98 - script - ${atomPath:-/usr/local/bin/atom} -n {query} - scriptargtype - 0 - scriptfile - - type - 0 + matchmode + 1 + matchstring + wfUpdate type - alfred.workflow.action.script + alfred.workflow.utility.filter uid - FE88D8C3-EE6E-493C-8265-B5837C2894A5 + 14E5559D-490B-4316-8AB3-F36197AD4437 version - 2 + 1 config alfredfiltersresults - + argumenttype - 1 + 0 escaping - 96 + 102 keyword atom queuedelaycustom @@ -144,25 +126,25 @@ queuedelayimmediatelyinitially queuedelaymode - 1 + 0 queuemode - 2 + 1 runningsubtext Loading projects... script - $nodePath main.js projects + ${nodePath:-/usr/local/bin/node} main.js projects "$1" scriptargtype - 0 + 1 scriptfile subtext - Load Atom project + List all your Atom projects title - Atom + Atom Projects type 0 withspace - + type alfred.workflow.input.scriptfilter @@ -174,94 +156,40 @@ config - concurrently - - escaping - 98 - script - ${atomPath:-/usr/local/bin/atom} -a {query} - scriptargtype - 0 - scriptfile + browser - type - 0 - - type - alfred.workflow.action.script - uid - C3803FAD-D59A-416E-829A-0171318A4360 - version - 2 - - - config - - concurrently - - escaping - 98 - script - ${atomPath:-/usr/local/bin/atom} -d {query} - scriptargtype - 0 - scriptfile + spaces - type - 0 + url + {query} + utf8 + type - alfred.workflow.action.script + alfred.workflow.action.openurl uid - 35732D96-5B61-4C6E-90F0-763364B11A6A + 38D13A34-4B8D-4D25-9DDE-8BC333F74A1F version - 2 + 1 config - concurrently - - escaping - 98 - script - open -a Finder {query} - scriptargtype - 0 - scriptfile - - type - 0 - - type - alfred.workflow.action.script - uid - C714B84E-CE96-400A-BEF0-37799139CA39 - version - 2 - - - config - - concurrently - - escaping - 98 - script - open -a ${terminalApp:-Terminal} {query} - scriptargtype - 0 - scriptfile - - type + inputstring + {var:task} + matchcasesensitive + + matchmode 0 + matchstring + wfUpdate type - alfred.workflow.action.script + alfred.workflow.utility.filter uid - B1127ADC-5698-4325-9C7E-D9C7F46C478F + D6E4B519-8F01-4A94-B5EB-E8DC8CFE0CD7 version - 2 + 1 readme @@ -275,68 +203,56 @@ Usage: Simply type atom and press space to list all projects. Optionally type a search string to filter results. uidata - 35732D96-5B61-4C6E-90F0-763364B11A6A - - note - Open in dev mode - xpos - 740 - ypos - 450 - - 8AF6156F-3E0C-46B9-8D05-5A5589D09EF5 + 14E5559D-490B-4316-8AB3-F36197AD4437 - note - Filter projects + colorindex + 4 xpos - 160 + 410 ypos 220 - 8CD25A48-2431-45EE-899F-68D3A2033B02 - - note - Run atom - xpos - 740 - ypos - 30 - - B1127ADC-5698-4325-9C7E-D9C7F46C478F + 38D13A34-4B8D-4D25-9DDE-8BC333F74A1F + colorindex + 7 note - Open in terminal + Update workflow xpos - 470 + 540 ypos - 640 + 300 - C3803FAD-D59A-416E-829A-0171318A4360 + 8AF6156F-3E0C-46B9-8D05-5A5589D09EF5 + colorindex + 4 note - Append to last window + Filter projects xpos - 740 + 130 ypos - 310 + 220 - C714B84E-CE96-400A-BEF0-37799139CA39 + A28E26AB-2CA3-4F6D-8A86-A5909476B368 + colorindex + 4 note - Reveal in finder + Run atom xpos - 470 + 540 ypos - 500 + 150 - FE88D8C3-EE6E-493C-8265-B5837C2894A5 + D6E4B519-8F01-4A94-B5EB-E8DC8CFE0CD7 - note - Open in new window + colorindex + 7 xpos - 740 + 410 ypos - 170 + 330 variables @@ -350,11 +266,12 @@ Simply type atom and press space to list all projects. Optionally type a search variablesdontexport + nodePath terminalApp atomPath version - 2.2.0 + 2.3.0 webaddress https://github.com/Cloudstek/alfred-atom diff --git a/main.js b/main.js old mode 100755 new mode 100644 index 9d2d9eb..e5a0cdd --- a/main.js +++ b/main.js @@ -1,40 +1,2 @@ -#!/usr/bin/env node - -var AlfredNode = require('alfred-workflow-nodejs'), - workflow = AlfredNode.workflow, - cson = require('season'), - AtomUtil = require('./src/atom-util'); - -AlfredNode.actionHandler.onAction('projects', function(query) { - var file = process.env.HOME + '/.atom/projects.cson'; - - // Read projects file. - cson.readFile(file, function(err, object) { - var projects = []; - - if (err) { - projects.push({ - title: 'No projects file found', - subtitle: file - }); - } - else { - // Parse projects. - projects = AtomUtil.parseProjects(object, query); - if (projects.length < 1) { - projects.push({ - title: 'No projects found' - }); - } - } - - // Add found projects to list. - projects.map(function(project) { - workflow.addItem(new AlfredNode.Item(project)); - }); - - workflow.feedback(); - }); -}); - -AlfredNode.run(); +'use strict';var _regenerator=require('babel-runtime/regenerator');var _regenerator2=_interopRequireDefault(_regenerator);var _asyncToGenerator2=require('babel-runtime/helpers/asyncToGenerator');var _asyncToGenerator3=_interopRequireDefault(_asyncToGenerator2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var Hugo=require('alfred-hugo');var CSON=require('cson-parser');var path=require('path');var fs=require('fs');var Project=require('./project');var Icons=require('./icons');var checkIcons=function(){var _ref=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(projects){var themePath,lastTheme,themeFile;return _regenerator2.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:themePath=Hugo.alfredMeta.themeFile;lastTheme=Hugo.cache.get('lastTheme');_context.prev=2;fs.statSync(path.join(__dirname,'icons'));_context.next=11;break;case 6:_context.prev=6;_context.t0=_context['catch'](2);Hugo.cache.set('lastTheme',Hugo.alfredMeta.theme);Icons.rebuild(projects);return _context.abrupt('return');case 11:if(!(!lastTheme||lastTheme!==Hugo.alfredMeta.theme)){_context.next=15;break;}Hugo.cache.set('lastTheme',Hugo.alfredMeta.theme);Icons.rebuild(projects);return _context.abrupt('return');case 15:if(themePath){themeFile=Hugo.cacheFile(themePath,'theme');themeFile.on('change',function(){Icons.rebuild(projects);});themeFile.get();}case 16:case'end':return _context.stop();}}},_callee,undefined,[[2,6]]);}));return function checkIcons(_x){return _ref.apply(this,arguments);};}();Hugo.action('projects',function(query){if(!query||query.length===0){Hugo.feedback();}var homedir=process.env.HOME||'';var projectsFile=Hugo.cacheFile(path.resolve(homedir,'.atom','projects.cson'),'projects');projectsFile.on('change',function(cache,file){var projects=CSON.parse(file)||[];projects=Project.parseAll(projects);Icons.rebuild(projects,{onlyMissing:true});projects.sort(function(a,b){var nameA=a.title.toLowerCase();var nameB=b.title.toLowerCase();if(nameAnameB){return 1;}return 0;});cache.store(projects);});var projects=projectsFile.get();if(projects&&Array.isArray(projects)){Hugo.addItems(projects);checkIcons(projects);}Hugo.filterItems(query.trim());if(Hugo.itemCount<1){Hugo.addItem({title:'No projects found.'});}Hugo.feedback();}); +//# sourceMappingURL=main.js.map diff --git a/main.js.flow b/main.js.flow new file mode 100644 index 0000000..ac1ca13 --- /dev/null +++ b/main.js.flow @@ -0,0 +1,103 @@ +// @flow + +const Hugo = require('alfred-hugo'); +const CSON = require('cson-parser'); +const path = require('path'); +const fs = require('fs'); + +const Project = require('./project'); +const Icons = require('./icons'); + +const checkIcons = async (projects: Array) => { + const themePath: string = Hugo.alfredMeta.themeFile; + const lastTheme: ?string = Hugo.cache.get('lastTheme'); + + try { + fs.statSync(path.join(__dirname, 'icons')); + } catch (e) { + Hugo.cache.set('lastTheme', Hugo.alfredMeta.theme); + Icons.rebuild(projects); + return; + } + + if (!lastTheme || lastTheme !== Hugo.alfredMeta.theme) { + Hugo.cache.set('lastTheme', Hugo.alfredMeta.theme); + Icons.rebuild(projects); + return; + } + + if (themePath) { + const themeFile = Hugo.cacheFile(themePath, 'theme'); + + themeFile.on('change', () => { + Icons.rebuild(projects); + }); + + themeFile.get(); + } +}; + +Hugo.action('projects', query => { + if (!query || query.length === 0) { + Hugo.feedback(); + } + + // Home dir + const homedir = process.env.HOME || ''; + + // Projects file + const projectsFile = Hugo.cacheFile(path.resolve(homedir, '.atom', 'projects.cson'), 'projects'); + + // Parse projects + projectsFile.on('change', (cache, file) => { + // Read projects file + let projects = CSON.parse(file) || []; + + // Parse projects + projects = Project.parseAll(projects); + + // Rebuild icons when needed + Icons.rebuild(projects, {onlyMissing: true}); + + // Sort projects + projects.sort((a, b) => { + let nameA = a.title.toLowerCase(); + let nameB = b.title.toLowerCase(); + + if (nameA < nameB) { + return -1; + } + + if (nameA > nameB) { + return 1; + } + + return 0; + }); + + cache.store(projects); + }); + + // Add projects to Hugo + let projects = projectsFile.get(); + + if (projects && Array.isArray(projects)) { + Hugo.addItems(projects); + + // Check icons + checkIcons(projects); + } + + // Filter items by query + Hugo.filterItems(query.trim()); + + // Check if any projects found + if (Hugo.itemCount < 1) { + Hugo.addItem({ + title: 'No projects found.' + }); + } + + // Output + Hugo.feedback(); +}); diff --git a/main.js.map b/main.js.map new file mode 100644 index 0000000..8863d19 --- /dev/null +++ b/main.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["main.js.flow"],"names":["Hugo","require","CSON","path","fs","Project","Icons","checkIcons","projects","themePath","alfredMeta","themeFile","lastTheme","cache","get","statSync","join","__dirname","set","theme","rebuild","cacheFile","on","action","query","length","feedback","homedir","process","env","HOME","projectsFile","resolve","file","parse","parseAll","onlyMissing","sort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CSON = require('cson-parser');\nconst path = require('path');\nconst fs = require('fs');\n\nconst Project = require('./project');\nconst Icons = require('./icons');\n\nconst checkIcons = async (projects: Array) => {\n const themePath: string = Hugo.alfredMeta.themeFile;\n const lastTheme: ?string = Hugo.cache.get('lastTheme');\n\n try {\n fs.statSync(path.join(__dirname, 'icons'));\n } catch (e) {\n Hugo.cache.set('lastTheme', Hugo.alfredMeta.theme);\n Icons.rebuild(projects);\n return;\n }\n\n if (!lastTheme || lastTheme !== Hugo.alfredMeta.theme) {\n Hugo.cache.set('lastTheme', Hugo.alfredMeta.theme);\n Icons.rebuild(projects);\n return;\n }\n\n if (themePath) {\n const themeFile = Hugo.cacheFile(themePath, 'theme');\n\n themeFile.on('change', () => {\n Icons.rebuild(projects);\n });\n\n themeFile.get();\n }\n};\n\nHugo.action('projects', query => {\n if (!query || query.length === 0) {\n Hugo.feedback();\n }\n\n // Home dir\n const homedir = process.env.HOME || '';\n\n // Projects file\n const projectsFile = Hugo.cacheFile(path.resolve(homedir, '.atom', 'projects.cson'), 'projects');\n\n // Parse projects\n projectsFile.on('change', (cache, file) => {\n // Read projects file\n let projects = CSON.parse(file) || [];\n\n // Parse projects\n projects = Project.parseAll(projects);\n\n // Rebuild icons when needed\n Icons.rebuild(projects, {onlyMissing: true});\n\n // Sort projects\n projects.sort((a, b) => {\n let nameA = a.title.toLowerCase();\n let nameB = b.title.toLowerCase();\n\n if (nameA < nameB) {\n return -1;\n }\n\n if (nameA > nameB) {\n return 1;\n }\n\n return 0;\n });\n\n cache.store(projects);\n });\n\n // Add projects to Hugo\n let projects = projectsFile.get();\n\n if (projects && Array.isArray(projects)) {\n Hugo.addItems(projects);\n\n // Check icons\n checkIcons(projects);\n }\n\n // Filter items by query\n Hugo.filterItems(query.trim());\n\n // Check if any projects found\n if (Hugo.itemCount < 1) {\n Hugo.addItem({\n title: 'No projects found.'\n });\n }\n\n // Output\n Hugo.feedback();\n});\n"]} \ No newline at end of file diff --git a/octicons/alert-128.png b/octicons/alert-128.png deleted file mode 100644 index f3234d2..0000000 Binary files a/octicons/alert-128.png and /dev/null differ diff --git a/octicons/alignment-align-128.png b/octicons/alignment-align-128.png deleted file mode 100644 index cf5da49..0000000 Binary files a/octicons/alignment-align-128.png and /dev/null differ diff --git a/octicons/alignment-aligned-to-128.png b/octicons/alignment-aligned-to-128.png deleted file mode 100644 index 6a40c61..0000000 Binary files a/octicons/alignment-aligned-to-128.png and /dev/null differ diff --git a/octicons/alignment-unalign-128.png b/octicons/alignment-unalign-128.png deleted file mode 100644 index 7724ac7..0000000 Binary files a/octicons/alignment-unalign-128.png and /dev/null differ diff --git a/octicons/arrow-down-128.png b/octicons/arrow-down-128.png deleted file mode 100644 index 3b7f6fc..0000000 Binary files a/octicons/arrow-down-128.png and /dev/null differ diff --git a/octicons/arrow-left-128.png b/octicons/arrow-left-128.png deleted file mode 100644 index 3eeeaa1..0000000 Binary files a/octicons/arrow-left-128.png and /dev/null differ diff --git a/octicons/arrow-right-128.png b/octicons/arrow-right-128.png deleted file mode 100644 index bce5dcf..0000000 Binary files a/octicons/arrow-right-128.png and /dev/null differ diff --git a/octicons/arrow-small-down-128.png b/octicons/arrow-small-down-128.png deleted file mode 100644 index 5140535..0000000 Binary files a/octicons/arrow-small-down-128.png and /dev/null differ diff --git a/octicons/arrow-small-left-128.png b/octicons/arrow-small-left-128.png deleted file mode 100644 index 5dcc91b..0000000 Binary files a/octicons/arrow-small-left-128.png and /dev/null differ diff --git a/octicons/arrow-small-right-128.png b/octicons/arrow-small-right-128.png deleted file mode 100644 index d103d82..0000000 Binary files a/octicons/arrow-small-right-128.png and /dev/null differ diff --git a/octicons/arrow-small-up-128.png b/octicons/arrow-small-up-128.png deleted file mode 100644 index c2df153..0000000 Binary files a/octicons/arrow-small-up-128.png and /dev/null differ diff --git a/octicons/arrow-up-128.png b/octicons/arrow-up-128.png deleted file mode 100644 index a6c5734..0000000 Binary files a/octicons/arrow-up-128.png and /dev/null differ diff --git a/octicons/beer-128.png b/octicons/beer-128.png deleted file mode 100644 index df28219..0000000 Binary files a/octicons/beer-128.png and /dev/null differ diff --git a/octicons/book-128.png b/octicons/book-128.png deleted file mode 100644 index 9583586..0000000 Binary files a/octicons/book-128.png and /dev/null differ diff --git a/octicons/bookmark-128.png b/octicons/bookmark-128.png deleted file mode 100644 index 37e1a1a..0000000 Binary files a/octicons/bookmark-128.png and /dev/null differ diff --git a/octicons/briefcase-128.png b/octicons/briefcase-128.png deleted file mode 100644 index f01581a..0000000 Binary files a/octicons/briefcase-128.png and /dev/null differ diff --git a/octicons/broadcast-128.png b/octicons/broadcast-128.png deleted file mode 100644 index cb06809..0000000 Binary files a/octicons/broadcast-128.png and /dev/null differ diff --git a/octicons/browser-128.png b/octicons/browser-128.png deleted file mode 100644 index 2979671..0000000 Binary files a/octicons/browser-128.png and /dev/null differ diff --git a/octicons/bug-128.png b/octicons/bug-128.png deleted file mode 100644 index 4bbb9b4..0000000 Binary files a/octicons/bug-128.png and /dev/null differ diff --git a/octicons/calendar-128.png b/octicons/calendar-128.png deleted file mode 100644 index c211f14..0000000 Binary files a/octicons/calendar-128.png and /dev/null differ diff --git a/octicons/check-128.png b/octicons/check-128.png deleted file mode 100644 index fbe06cb..0000000 Binary files a/octicons/check-128.png and /dev/null differ diff --git a/octicons/checklist-128.png b/octicons/checklist-128.png deleted file mode 100644 index b90edf0..0000000 Binary files a/octicons/checklist-128.png and /dev/null differ diff --git a/octicons/chevron-down-128.png b/octicons/chevron-down-128.png deleted file mode 100644 index 6781852..0000000 Binary files a/octicons/chevron-down-128.png and /dev/null differ diff --git a/octicons/chevron-left-128.png b/octicons/chevron-left-128.png deleted file mode 100644 index 043cc7b..0000000 Binary files a/octicons/chevron-left-128.png and /dev/null differ diff --git a/octicons/chevron-right-128.png b/octicons/chevron-right-128.png deleted file mode 100644 index 53d3e3d..0000000 Binary files a/octicons/chevron-right-128.png and /dev/null differ diff --git a/octicons/chevron-up-128.png b/octicons/chevron-up-128.png deleted file mode 100644 index be1f641..0000000 Binary files a/octicons/chevron-up-128.png and /dev/null differ diff --git a/octicons/circle-slash-128.png b/octicons/circle-slash-128.png deleted file mode 100644 index b4ea027..0000000 Binary files a/octicons/circle-slash-128.png and /dev/null differ diff --git a/octicons/circuit-board-128.png b/octicons/circuit-board-128.png deleted file mode 100644 index 785e984..0000000 Binary files a/octicons/circuit-board-128.png and /dev/null differ diff --git a/octicons/clippy-128.png b/octicons/clippy-128.png deleted file mode 100644 index 034ce31..0000000 Binary files a/octicons/clippy-128.png and /dev/null differ diff --git a/octicons/clock-128.png b/octicons/clock-128.png deleted file mode 100644 index 91dc024..0000000 Binary files a/octicons/clock-128.png and /dev/null differ diff --git a/octicons/cloud-download-128.png b/octicons/cloud-download-128.png deleted file mode 100644 index 0293858..0000000 Binary files a/octicons/cloud-download-128.png and /dev/null differ diff --git a/octicons/cloud-upload-128.png b/octicons/cloud-upload-128.png deleted file mode 100644 index c006f99..0000000 Binary files a/octicons/cloud-upload-128.png and /dev/null differ diff --git a/octicons/code-128.png b/octicons/code-128.png deleted file mode 100644 index 5169751..0000000 Binary files a/octicons/code-128.png and /dev/null differ diff --git a/octicons/color-mode-128.png b/octicons/color-mode-128.png deleted file mode 100644 index 8c6b677..0000000 Binary files a/octicons/color-mode-128.png and /dev/null differ diff --git a/octicons/comment-128.png b/octicons/comment-128.png deleted file mode 100644 index 9f0c641..0000000 Binary files a/octicons/comment-128.png and /dev/null differ diff --git a/octicons/comment-discussion-128.png b/octicons/comment-discussion-128.png deleted file mode 100644 index 231293f..0000000 Binary files a/octicons/comment-discussion-128.png and /dev/null differ diff --git a/octicons/credit-card-128.png b/octicons/credit-card-128.png deleted file mode 100644 index 9346a41..0000000 Binary files a/octicons/credit-card-128.png and /dev/null differ diff --git a/octicons/dash-128.png b/octicons/dash-128.png deleted file mode 100644 index f4746c2..0000000 Binary files a/octicons/dash-128.png and /dev/null differ diff --git a/octicons/dashboard-128.png b/octicons/dashboard-128.png deleted file mode 100644 index 552646e..0000000 Binary files a/octicons/dashboard-128.png and /dev/null differ diff --git a/octicons/database-128.png b/octicons/database-128.png deleted file mode 100644 index 93bc592..0000000 Binary files a/octicons/database-128.png and /dev/null differ diff --git a/octicons/device-camera-128.png b/octicons/device-camera-128.png deleted file mode 100644 index d9eeb56..0000000 Binary files a/octicons/device-camera-128.png and /dev/null differ diff --git a/octicons/device-camera-video-128.png b/octicons/device-camera-video-128.png deleted file mode 100644 index 189d7cd..0000000 Binary files a/octicons/device-camera-video-128.png and /dev/null differ diff --git a/octicons/device-desktop-128.png b/octicons/device-desktop-128.png deleted file mode 100644 index 122f7e2..0000000 Binary files a/octicons/device-desktop-128.png and /dev/null differ diff --git a/octicons/device-mobile-128.png b/octicons/device-mobile-128.png deleted file mode 100644 index d524c39..0000000 Binary files a/octicons/device-mobile-128.png and /dev/null differ diff --git a/octicons/diff-128.png b/octicons/diff-128.png deleted file mode 100644 index 27903a4..0000000 Binary files a/octicons/diff-128.png and /dev/null differ diff --git a/octicons/diff-added-128.png b/octicons/diff-added-128.png deleted file mode 100644 index 917e61d..0000000 Binary files a/octicons/diff-added-128.png and /dev/null differ diff --git a/octicons/diff-ignored-128.png b/octicons/diff-ignored-128.png deleted file mode 100644 index 27c6bc1..0000000 Binary files a/octicons/diff-ignored-128.png and /dev/null differ diff --git a/octicons/diff-modified-128.png b/octicons/diff-modified-128.png deleted file mode 100644 index 6860bb7..0000000 Binary files a/octicons/diff-modified-128.png and /dev/null differ diff --git a/octicons/diff-removed-128.png b/octicons/diff-removed-128.png deleted file mode 100644 index 382020c..0000000 Binary files a/octicons/diff-removed-128.png and /dev/null differ diff --git a/octicons/diff-renamed-128.png b/octicons/diff-renamed-128.png deleted file mode 100644 index 9ea9b08..0000000 Binary files a/octicons/diff-renamed-128.png and /dev/null differ diff --git a/octicons/ellipsis-128.png b/octicons/ellipsis-128.png deleted file mode 100644 index 3fbdb43..0000000 Binary files a/octicons/ellipsis-128.png and /dev/null differ diff --git a/octicons/eye-128.png b/octicons/eye-128.png deleted file mode 100644 index e2282f0..0000000 Binary files a/octicons/eye-128.png and /dev/null differ diff --git a/octicons/file-binary-128.png b/octicons/file-binary-128.png deleted file mode 100644 index 9b6dc12..0000000 Binary files a/octicons/file-binary-128.png and /dev/null differ diff --git a/octicons/file-code-128.png b/octicons/file-code-128.png deleted file mode 100644 index 6e6c3e6..0000000 Binary files a/octicons/file-code-128.png and /dev/null differ diff --git a/octicons/file-directory-128.png b/octicons/file-directory-128.png deleted file mode 100644 index 5b68e5e..0000000 Binary files a/octicons/file-directory-128.png and /dev/null differ diff --git a/octicons/file-media-128.png b/octicons/file-media-128.png deleted file mode 100644 index d0ffc9d..0000000 Binary files a/octicons/file-media-128.png and /dev/null differ diff --git a/octicons/file-pdf-128.png b/octicons/file-pdf-128.png deleted file mode 100644 index 8f70656..0000000 Binary files a/octicons/file-pdf-128.png and /dev/null differ diff --git a/octicons/file-submodule-128.png b/octicons/file-submodule-128.png deleted file mode 100644 index 3e7ce23..0000000 Binary files a/octicons/file-submodule-128.png and /dev/null differ diff --git a/octicons/file-symlink-directory-128.png b/octicons/file-symlink-directory-128.png deleted file mode 100644 index bc801c1..0000000 Binary files a/octicons/file-symlink-directory-128.png and /dev/null differ diff --git a/octicons/file-symlink-file-128.png b/octicons/file-symlink-file-128.png deleted file mode 100644 index 1a57a35..0000000 Binary files a/octicons/file-symlink-file-128.png and /dev/null differ diff --git a/octicons/file-text-128.png b/octicons/file-text-128.png deleted file mode 100644 index 24823be..0000000 Binary files a/octicons/file-text-128.png and /dev/null differ diff --git a/octicons/file-zip-128.png b/octicons/file-zip-128.png deleted file mode 100644 index 99010ac..0000000 Binary files a/octicons/file-zip-128.png and /dev/null differ diff --git a/octicons/flame-128.png b/octicons/flame-128.png deleted file mode 100644 index 597ca47..0000000 Binary files a/octicons/flame-128.png and /dev/null differ diff --git a/octicons/fold-128.png b/octicons/fold-128.png deleted file mode 100644 index bb31fe1..0000000 Binary files a/octicons/fold-128.png and /dev/null differ diff --git a/octicons/gear-128.png b/octicons/gear-128.png deleted file mode 100644 index 2c3b3f1..0000000 Binary files a/octicons/gear-128.png and /dev/null differ diff --git a/octicons/gift-128.png b/octicons/gift-128.png deleted file mode 100644 index cb942df..0000000 Binary files a/octicons/gift-128.png and /dev/null differ diff --git a/octicons/gist-128.png b/octicons/gist-128.png deleted file mode 100644 index 10d10f2..0000000 Binary files a/octicons/gist-128.png and /dev/null differ diff --git a/octicons/gist-secret-128.png b/octicons/gist-secret-128.png deleted file mode 100644 index f2afbb1..0000000 Binary files a/octicons/gist-secret-128.png and /dev/null differ diff --git a/octicons/git-branch-128.png b/octicons/git-branch-128.png deleted file mode 100644 index 37fcad5..0000000 Binary files a/octicons/git-branch-128.png and /dev/null differ diff --git a/octicons/git-commit-128.png b/octicons/git-commit-128.png deleted file mode 100644 index 36eccd3..0000000 Binary files a/octicons/git-commit-128.png and /dev/null differ diff --git a/octicons/git-compare-128.png b/octicons/git-compare-128.png deleted file mode 100644 index 6884c68..0000000 Binary files a/octicons/git-compare-128.png and /dev/null differ diff --git a/octicons/git-merge-128.png b/octicons/git-merge-128.png deleted file mode 100644 index 1ae351b..0000000 Binary files a/octicons/git-merge-128.png and /dev/null differ diff --git a/octicons/git-pull-request-128.png b/octicons/git-pull-request-128.png deleted file mode 100644 index 3fcf90e..0000000 Binary files a/octicons/git-pull-request-128.png and /dev/null differ diff --git a/octicons/globe-128.png b/octicons/globe-128.png deleted file mode 100644 index 13d856b..0000000 Binary files a/octicons/globe-128.png and /dev/null differ diff --git a/octicons/graph-128.png b/octicons/graph-128.png deleted file mode 100644 index f9ad38a..0000000 Binary files a/octicons/graph-128.png and /dev/null differ diff --git a/octicons/heart-128.png b/octicons/heart-128.png deleted file mode 100644 index d9e9f62..0000000 Binary files a/octicons/heart-128.png and /dev/null differ diff --git a/octicons/history-128.png b/octicons/history-128.png deleted file mode 100644 index 2ee3c6a..0000000 Binary files a/octicons/history-128.png and /dev/null differ diff --git a/octicons/home-128.png b/octicons/home-128.png deleted file mode 100644 index 538088a..0000000 Binary files a/octicons/home-128.png and /dev/null differ diff --git a/octicons/horizontal-rule-128.png b/octicons/horizontal-rule-128.png deleted file mode 100644 index 5e147b2..0000000 Binary files a/octicons/horizontal-rule-128.png and /dev/null differ diff --git a/octicons/hourglass-128.png b/octicons/hourglass-128.png deleted file mode 100644 index 11a7d07..0000000 Binary files a/octicons/hourglass-128.png and /dev/null differ diff --git a/octicons/hubot-128.png b/octicons/hubot-128.png deleted file mode 100644 index f0c616e..0000000 Binary files a/octicons/hubot-128.png and /dev/null differ diff --git a/octicons/inbox-128.png b/octicons/inbox-128.png deleted file mode 100644 index 1e2d4e6..0000000 Binary files a/octicons/inbox-128.png and /dev/null differ diff --git a/octicons/info-128.png b/octicons/info-128.png deleted file mode 100644 index fa19609..0000000 Binary files a/octicons/info-128.png and /dev/null differ diff --git a/octicons/issue-closed-128.png b/octicons/issue-closed-128.png deleted file mode 100644 index 09611ca..0000000 Binary files a/octicons/issue-closed-128.png and /dev/null differ diff --git a/octicons/issue-opened-128.png b/octicons/issue-opened-128.png deleted file mode 100644 index 1facf7e..0000000 Binary files a/octicons/issue-opened-128.png and /dev/null differ diff --git a/octicons/issue-reopened-128.png b/octicons/issue-reopened-128.png deleted file mode 100644 index b307b17..0000000 Binary files a/octicons/issue-reopened-128.png and /dev/null differ diff --git a/octicons/jersey-128.png b/octicons/jersey-128.png deleted file mode 100644 index 53ed371..0000000 Binary files a/octicons/jersey-128.png and /dev/null differ diff --git a/octicons/jump-down-128.png b/octicons/jump-down-128.png deleted file mode 100644 index f0b9b94..0000000 Binary files a/octicons/jump-down-128.png and /dev/null differ diff --git a/octicons/jump-left-128.png b/octicons/jump-left-128.png deleted file mode 100644 index d111418..0000000 Binary files a/octicons/jump-left-128.png and /dev/null differ diff --git a/octicons/jump-right-128.png b/octicons/jump-right-128.png deleted file mode 100644 index fb8633f..0000000 Binary files a/octicons/jump-right-128.png and /dev/null differ diff --git a/octicons/jump-up-128.png b/octicons/jump-up-128.png deleted file mode 100644 index e3ba429..0000000 Binary files a/octicons/jump-up-128.png and /dev/null differ diff --git a/octicons/key-128.png b/octicons/key-128.png deleted file mode 100644 index 2267da4..0000000 Binary files a/octicons/key-128.png and /dev/null differ diff --git a/octicons/keyboard-128.png b/octicons/keyboard-128.png deleted file mode 100644 index b6f5dbd..0000000 Binary files a/octicons/keyboard-128.png and /dev/null differ diff --git a/octicons/law-128.png b/octicons/law-128.png deleted file mode 100644 index 25958c1..0000000 Binary files a/octicons/law-128.png and /dev/null differ diff --git a/octicons/light-bulb-128.png b/octicons/light-bulb-128.png deleted file mode 100644 index 2a363a0..0000000 Binary files a/octicons/light-bulb-128.png and /dev/null differ diff --git a/octicons/link-128.png b/octicons/link-128.png deleted file mode 100644 index e70e807..0000000 Binary files a/octicons/link-128.png and /dev/null differ diff --git a/octicons/link-external-128.png b/octicons/link-external-128.png deleted file mode 100644 index 6df9104..0000000 Binary files a/octicons/link-external-128.png and /dev/null differ diff --git a/octicons/list-ordered-128.png b/octicons/list-ordered-128.png deleted file mode 100644 index 0a01c79..0000000 Binary files a/octicons/list-ordered-128.png and /dev/null differ diff --git a/octicons/list-unordered-128.png b/octicons/list-unordered-128.png deleted file mode 100644 index bb5879c..0000000 Binary files a/octicons/list-unordered-128.png and /dev/null differ diff --git a/octicons/location-128.png b/octicons/location-128.png deleted file mode 100644 index 0a8fbf1..0000000 Binary files a/octicons/location-128.png and /dev/null differ diff --git a/octicons/lock-128.png b/octicons/lock-128.png deleted file mode 100644 index ef3c7bc..0000000 Binary files a/octicons/lock-128.png and /dev/null differ diff --git a/octicons/mail-128.png b/octicons/mail-128.png deleted file mode 100644 index 94ed353..0000000 Binary files a/octicons/mail-128.png and /dev/null differ diff --git a/octicons/mail-read-128.png b/octicons/mail-read-128.png deleted file mode 100644 index b22d718..0000000 Binary files a/octicons/mail-read-128.png and /dev/null differ diff --git a/octicons/mail-reply-128.png b/octicons/mail-reply-128.png deleted file mode 100644 index 51df18d..0000000 Binary files a/octicons/mail-reply-128.png and /dev/null differ diff --git a/octicons/mark-github-128.png b/octicons/mark-github-128.png deleted file mode 100644 index fd168a4..0000000 Binary files a/octicons/mark-github-128.png and /dev/null differ diff --git a/octicons/markdown-128.png b/octicons/markdown-128.png deleted file mode 100644 index f8b87d9..0000000 Binary files a/octicons/markdown-128.png and /dev/null differ diff --git a/octicons/megaphone-128.png b/octicons/megaphone-128.png deleted file mode 100644 index ef6deb3..0000000 Binary files a/octicons/megaphone-128.png and /dev/null differ diff --git a/octicons/mention-128.png b/octicons/mention-128.png deleted file mode 100644 index fa5539f..0000000 Binary files a/octicons/mention-128.png and /dev/null differ diff --git a/octicons/microscope-128.png b/octicons/microscope-128.png deleted file mode 100644 index 3080984..0000000 Binary files a/octicons/microscope-128.png and /dev/null differ diff --git a/octicons/milestone-128.png b/octicons/milestone-128.png deleted file mode 100644 index b712cd1..0000000 Binary files a/octicons/milestone-128.png and /dev/null differ diff --git a/octicons/mirror-128.png b/octicons/mirror-128.png deleted file mode 100644 index 19a1e7b..0000000 Binary files a/octicons/mirror-128.png and /dev/null differ diff --git a/octicons/mortar-board-128.png b/octicons/mortar-board-128.png deleted file mode 100644 index 6e0e800..0000000 Binary files a/octicons/mortar-board-128.png and /dev/null differ diff --git a/octicons/move-down-128.png b/octicons/move-down-128.png deleted file mode 100644 index 4991714..0000000 Binary files a/octicons/move-down-128.png and /dev/null differ diff --git a/octicons/move-left-128.png b/octicons/move-left-128.png deleted file mode 100644 index 427a5d4..0000000 Binary files a/octicons/move-left-128.png and /dev/null differ diff --git a/octicons/move-right-128.png b/octicons/move-right-128.png deleted file mode 100644 index 6f3d80b..0000000 Binary files a/octicons/move-right-128.png and /dev/null differ diff --git a/octicons/move-up-128.png b/octicons/move-up-128.png deleted file mode 100644 index ac5e9cf..0000000 Binary files a/octicons/move-up-128.png and /dev/null differ diff --git a/octicons/mute-128.png b/octicons/mute-128.png deleted file mode 100644 index 2042edd..0000000 Binary files a/octicons/mute-128.png and /dev/null differ diff --git a/octicons/no-newline-128.png b/octicons/no-newline-128.png deleted file mode 100644 index 22792e6..0000000 Binary files a/octicons/no-newline-128.png and /dev/null differ diff --git a/octicons/octoface-128.png b/octicons/octoface-128.png deleted file mode 100644 index 896b43c..0000000 Binary files a/octicons/octoface-128.png and /dev/null differ diff --git a/octicons/organization-128.png b/octicons/organization-128.png deleted file mode 100644 index ca80f6f..0000000 Binary files a/octicons/organization-128.png and /dev/null differ diff --git a/octicons/package-128.png b/octicons/package-128.png deleted file mode 100644 index 8b783f4..0000000 Binary files a/octicons/package-128.png and /dev/null differ diff --git a/octicons/paintcan-128.png b/octicons/paintcan-128.png deleted file mode 100644 index 68c0319..0000000 Binary files a/octicons/paintcan-128.png and /dev/null differ diff --git a/octicons/pencil-128.png b/octicons/pencil-128.png deleted file mode 100644 index a938e5d..0000000 Binary files a/octicons/pencil-128.png and /dev/null differ diff --git a/octicons/person-128.png b/octicons/person-128.png deleted file mode 100644 index 42c0f41..0000000 Binary files a/octicons/person-128.png and /dev/null differ diff --git a/octicons/pin-128.png b/octicons/pin-128.png deleted file mode 100644 index 7a67ae4..0000000 Binary files a/octicons/pin-128.png and /dev/null differ diff --git a/octicons/playback-fast-forward-128.png b/octicons/playback-fast-forward-128.png deleted file mode 100644 index e1ac383..0000000 Binary files a/octicons/playback-fast-forward-128.png and /dev/null differ diff --git a/octicons/playback-pause-128.png b/octicons/playback-pause-128.png deleted file mode 100644 index 7c62b80..0000000 Binary files a/octicons/playback-pause-128.png and /dev/null differ diff --git a/octicons/playback-play-128.png b/octicons/playback-play-128.png deleted file mode 100644 index 76aed5b..0000000 Binary files a/octicons/playback-play-128.png and /dev/null differ diff --git a/octicons/playback-rewind-128.png b/octicons/playback-rewind-128.png deleted file mode 100644 index da14b3b..0000000 Binary files a/octicons/playback-rewind-128.png and /dev/null differ diff --git a/octicons/plug-128.png b/octicons/plug-128.png deleted file mode 100644 index 60c358d..0000000 Binary files a/octicons/plug-128.png and /dev/null differ diff --git a/octicons/plus-128.png b/octicons/plus-128.png deleted file mode 100644 index 66e1255..0000000 Binary files a/octicons/plus-128.png and /dev/null differ diff --git a/octicons/podium-128.png b/octicons/podium-128.png deleted file mode 100644 index e0864c8..0000000 Binary files a/octicons/podium-128.png and /dev/null differ diff --git a/octicons/primitive-dot-128.png b/octicons/primitive-dot-128.png deleted file mode 100644 index 72bc080..0000000 Binary files a/octicons/primitive-dot-128.png and /dev/null differ diff --git a/octicons/primitive-square-128.png b/octicons/primitive-square-128.png deleted file mode 100644 index 731cd78..0000000 Binary files a/octicons/primitive-square-128.png and /dev/null differ diff --git a/octicons/pulse-128.png b/octicons/pulse-128.png deleted file mode 100644 index 41a4ddb..0000000 Binary files a/octicons/pulse-128.png and /dev/null differ diff --git a/octicons/puzzle-128.png b/octicons/puzzle-128.png deleted file mode 100644 index 212d15b..0000000 Binary files a/octicons/puzzle-128.png and /dev/null differ diff --git a/octicons/question-128.png b/octicons/question-128.png deleted file mode 100644 index 5b69687..0000000 Binary files a/octicons/question-128.png and /dev/null differ diff --git a/octicons/quote-128.png b/octicons/quote-128.png deleted file mode 100644 index 3359804..0000000 Binary files a/octicons/quote-128.png and /dev/null differ diff --git a/octicons/radio-tower-128.png b/octicons/radio-tower-128.png deleted file mode 100644 index 16aa7d5..0000000 Binary files a/octicons/radio-tower-128.png and /dev/null differ diff --git a/octicons/repo-128.png b/octicons/repo-128.png deleted file mode 100644 index ed62673..0000000 Binary files a/octicons/repo-128.png and /dev/null differ diff --git a/octicons/repo-clone-128.png b/octicons/repo-clone-128.png deleted file mode 100644 index daabb42..0000000 Binary files a/octicons/repo-clone-128.png and /dev/null differ diff --git a/octicons/repo-force-push-128.png b/octicons/repo-force-push-128.png deleted file mode 100644 index 908dbb3..0000000 Binary files a/octicons/repo-force-push-128.png and /dev/null differ diff --git a/octicons/repo-forked-128.png b/octicons/repo-forked-128.png deleted file mode 100644 index aec0979..0000000 Binary files a/octicons/repo-forked-128.png and /dev/null differ diff --git a/octicons/repo-pull-128.png b/octicons/repo-pull-128.png deleted file mode 100644 index 0197b88..0000000 Binary files a/octicons/repo-pull-128.png and /dev/null differ diff --git a/octicons/repo-push-128.png b/octicons/repo-push-128.png deleted file mode 100644 index f4d997b..0000000 Binary files a/octicons/repo-push-128.png and /dev/null differ diff --git a/octicons/rocket-128.png b/octicons/rocket-128.png deleted file mode 100644 index b5ebc49..0000000 Binary files a/octicons/rocket-128.png and /dev/null differ diff --git a/octicons/rss-128.png b/octicons/rss-128.png deleted file mode 100644 index 63f71fb..0000000 Binary files a/octicons/rss-128.png and /dev/null differ diff --git a/octicons/ruby-128.png b/octicons/ruby-128.png deleted file mode 100644 index 6728d5a..0000000 Binary files a/octicons/ruby-128.png and /dev/null differ diff --git a/octicons/screen-full-128.png b/octicons/screen-full-128.png deleted file mode 100644 index bb4f799..0000000 Binary files a/octicons/screen-full-128.png and /dev/null differ diff --git a/octicons/screen-normal-128.png b/octicons/screen-normal-128.png deleted file mode 100644 index b30e841..0000000 Binary files a/octicons/screen-normal-128.png and /dev/null differ diff --git a/octicons/search-128.png b/octicons/search-128.png deleted file mode 100644 index fa3a689..0000000 Binary files a/octicons/search-128.png and /dev/null differ diff --git a/octicons/server-128.png b/octicons/server-128.png deleted file mode 100644 index 8d00680..0000000 Binary files a/octicons/server-128.png and /dev/null differ diff --git a/octicons/settings-128.png b/octicons/settings-128.png deleted file mode 100644 index a7d9329..0000000 Binary files a/octicons/settings-128.png and /dev/null differ diff --git a/octicons/sign-in-128.png b/octicons/sign-in-128.png deleted file mode 100644 index 3646881..0000000 Binary files a/octicons/sign-in-128.png and /dev/null differ diff --git a/octicons/sign-out-128.png b/octicons/sign-out-128.png deleted file mode 100644 index e702127..0000000 Binary files a/octicons/sign-out-128.png and /dev/null differ diff --git a/octicons/split-128.png b/octicons/split-128.png deleted file mode 100644 index 14ea389..0000000 Binary files a/octicons/split-128.png and /dev/null differ diff --git a/octicons/squirrel-128.png b/octicons/squirrel-128.png deleted file mode 100644 index ce03723..0000000 Binary files a/octicons/squirrel-128.png and /dev/null differ diff --git a/octicons/star-128.png b/octicons/star-128.png deleted file mode 100644 index 6ee20f3..0000000 Binary files a/octicons/star-128.png and /dev/null differ diff --git a/octicons/steps-128.png b/octicons/steps-128.png deleted file mode 100644 index 2413b8b..0000000 Binary files a/octicons/steps-128.png and /dev/null differ diff --git a/octicons/stop-128.png b/octicons/stop-128.png deleted file mode 100644 index cdefe79..0000000 Binary files a/octicons/stop-128.png and /dev/null differ diff --git a/octicons/sync-128.png b/octicons/sync-128.png deleted file mode 100644 index 75d4e0e..0000000 Binary files a/octicons/sync-128.png and /dev/null differ diff --git a/octicons/tag-128.png b/octicons/tag-128.png deleted file mode 100644 index dbbfd67..0000000 Binary files a/octicons/tag-128.png and /dev/null differ diff --git a/octicons/telescope-128.png b/octicons/telescope-128.png deleted file mode 100644 index 9015718..0000000 Binary files a/octicons/telescope-128.png and /dev/null differ diff --git a/octicons/terminal-128.png b/octicons/terminal-128.png deleted file mode 100644 index ad47034..0000000 Binary files a/octicons/terminal-128.png and /dev/null differ diff --git a/octicons/three-bars-128.png b/octicons/three-bars-128.png deleted file mode 100644 index 710603f..0000000 Binary files a/octicons/three-bars-128.png and /dev/null differ diff --git a/octicons/tools-128.png b/octicons/tools-128.png deleted file mode 100644 index 7a3e3a7..0000000 Binary files a/octicons/tools-128.png and /dev/null differ diff --git a/octicons/trashcan-128.png b/octicons/trashcan-128.png deleted file mode 100644 index 4e932ef..0000000 Binary files a/octicons/trashcan-128.png and /dev/null differ diff --git a/octicons/triangle-down-128.png b/octicons/triangle-down-128.png deleted file mode 100644 index 490f3bd..0000000 Binary files a/octicons/triangle-down-128.png and /dev/null differ diff --git a/octicons/triangle-left-128.png b/octicons/triangle-left-128.png deleted file mode 100644 index cd8a39e..0000000 Binary files a/octicons/triangle-left-128.png and /dev/null differ diff --git a/octicons/triangle-right-128.png b/octicons/triangle-right-128.png deleted file mode 100644 index ddafc15..0000000 Binary files a/octicons/triangle-right-128.png and /dev/null differ diff --git a/octicons/triangle-up-128.png b/octicons/triangle-up-128.png deleted file mode 100644 index c84698c..0000000 Binary files a/octicons/triangle-up-128.png and /dev/null differ diff --git a/octicons/unfold-128.png b/octicons/unfold-128.png deleted file mode 100644 index 5d01462..0000000 Binary files a/octicons/unfold-128.png and /dev/null differ diff --git a/octicons/unmute-128.png b/octicons/unmute-128.png deleted file mode 100644 index 7086a6b..0000000 Binary files a/octicons/unmute-128.png and /dev/null differ diff --git a/octicons/versions-128.png b/octicons/versions-128.png deleted file mode 100644 index 3707896..0000000 Binary files a/octicons/versions-128.png and /dev/null differ diff --git a/octicons/x-128.png b/octicons/x-128.png deleted file mode 100644 index 3cd6513..0000000 Binary files a/octicons/x-128.png and /dev/null differ diff --git a/octicons/zap-128.png b/octicons/zap-128.png deleted file mode 100644 index cc45f5e..0000000 Binary files a/octicons/zap-128.png and /dev/null differ diff --git a/package.json b/package.json index c031b62..3698673 100644 --- a/package.json +++ b/package.json @@ -1,29 +1,45 @@ { "name": "alfred-atom", - "version": "2.1.0", + "version": "2.3.0", "description": "Simple workflow that allows you to browse and open Atom projects", "dependencies": { - "alfred-workflow-nodejs": "^2.0.1", - "fuzzaldrin": "^2.1.0", - "season": "^5.4.1" - }, - "devDependencies": { - "chai": "^3.5.0", - "istanbul": "^0.4.5", - "mocha": "^3.1.2" + "alfred-hugo": "^1.1.0", + "alfred-link": "^0.2.0", + "babel-runtime": "^6.23.0", + "color": "^1.0.3", + "cson-parser": "^1.3.5", + "moment": "^2.18.0", + "octicons": "^5.0.1", + "svgexport": "github:cloudstek/svgexport" }, "scripts": { - "test": "mocha", - "coverage": "istanbul cover ./node_modules/.bin/_mocha" + "build": "gulp", + "watch": "gulp watch", + "postinstall": "alfred-link", + "preuninstall": "alfred-unlink" }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/mdeboer/alfred-atom.git" - }, - "author": "Maarten de Boer ", - "license": "GPL-2.0", - "bugs": { - "url": "https://github.com/mdeboer/alfred-atom/issues" + "repository": "Cloudstek/alfred-atom", + "author": "Maarten de Boer (https://cloudstek.nl)", + "license": "BSD-2-Clause", + "bugs": "https://github.com/Cloudstek/alfred-atom/issues", + "devDependencies": { + "babel-eslint": "^7.1.1", + "babel-plugin-transform-class-properties": "^6.23.0", + "babel-plugin-transform-runtime": "^6.23.0", + "babel-preset-env": "^1.2.2", + "babel-preset-flow": "^6.23.0", + "eslint": "^3.18.0", + "eslint-config-xo": "^0.18.1", + "eslint-formatter-pretty": "^1.1.0", + "eslint-plugin-flowtype-errors": "^3.0.1", + "flow-bin": "^0.42.0", + "gulp": "^3.9.1", + "gulp-babel": "^6.1.2", + "gulp-eslint": "^3.0.1", + "gulp-rename": "^1.2.2", + "gulp-sourcemaps": "^2.6.0" }, - "homepage": "https://github.com/mdeboer/alfred-atom#readme" + "engines": { + "node": ">=4" + } } diff --git a/project.js b/project.js new file mode 100644 index 0000000..5c9029e --- /dev/null +++ b/project.js @@ -0,0 +1,2 @@ +'use strict';var _keys=require('babel-runtime/core-js/object/keys');var _keys2=_interopRequireDefault(_keys);var _classCallCheck2=require('babel-runtime/helpers/classCallCheck');var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _createClass2=require('babel-runtime/helpers/createClass');var _createClass3=_interopRequireDefault(_createClass2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var fs=require('fs');var octicons=require('octicons');var path=require('path');var Project=function(){function Project(){(0,_classCallCheck3.default)(this,Project);}(0,_createClass3.default)(Project,[{key:'_fileExists',value:function _fileExists(path){try{fs.statSync(path);return true;}catch(err){return false;}}},{key:'_uid',value:function _uid(project){return project.title.toLowerCase().replace(' ','_');}},{key:'_title',value:function _title(project){var title=project.title;if(project.group){title+=' - '+project.group;}return title;}},{key:'_subtitle',value:function _subtitle(project){if(project.paths){return project.paths.join(', ');}return'';}},{key:'_icon',value:function _icon(project){var iconPaths=[];if(project.icon){if(project.icon.startsWith('icon-')){var octiconNames=(0,_keys2.default)(octicons);if(octiconNames.indexOf(project.icon.slice(5))>=0){return path.join(__dirname,'icons',project.icon.slice(5)+'.png');}}if(project.icon.startsWith('~/')){var homedir=process.env.HOME||'';project.icon=path.resolve(homedir,project.icon.slice(2));}if(!path.isAbsolute(project.icon)){for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:[];var atomPath=process.env.atomPath||'/usr/local/bin/atom';var command=[atomPath];command=command.concat(options);if(project.paths){command.push('"'+project.paths.join('" "')+'"');}return command.join(' ');}},{key:'_openArgument',value:function _openArgument(project,app){var command=['open','-a',`"${app}"`];if(project.paths){command.push('"'+project.paths.join('" "')+'"');}return command.join(' ');}},{key:'parse',value:function parse(project){var item={title:this._title(project),subtitle:this._subtitle(project),icon:{path:this._icon(project)},arg:this._atomArgument(project),valid:project.paths&&project.paths.length>0,mods:{alt:{valid:true,subtitle:'Open project path(s) in terminal',arg:this._openArgument(project,process.env.terminalApp||'Terminal')},cmd:{valid:true,subtitle:'Open in new window',arg:this._atomArgument(project,['-n'])},ctrl:{valid:true,subtitle:'Open in development mode',arg:this._atomArgument(project,['-d'])},fn:{valid:true,subtitle:'Append project path(s) to last open window',arg:this._atomArgument(project,['-a'])},shift:{valid:true,subtitle:'Open project path(s) in finder',arg:this._openArgument(project,'Finder')}}};return item;}},{key:'parseAll',value:function parseAll(projects){var result=[];for(var i=0;i= 0) { + return path.join(__dirname, 'icons', project.icon.slice(5) + '.png'); + } + } + + // Replace tilde + if (project.icon.startsWith('~/')) { + let homedir = process.env.HOME || ''; + project.icon = path.resolve(homedir, project.icon.slice(2)); + } + + // Search for project icon if its path is relative + if (!path.isAbsolute(project.icon)) { + for (let i = 0; i < project.paths.length; i++) { + iconPaths.push(path.resolve(project.paths[i], project.icon)); + } + } + + // Absolute path + if (this._fileExists(project.icon)) { + return project.icon; + } + } + + // Search every project root dir for icon.png + for (let i = 0; i < project.paths.length; i++) { + iconPaths.push(path.join(project.paths[i], 'icon.png')); + } + + // Find project icon + for (let i = 0; i < iconPaths.length; i++) { + if (this._fileExists(iconPaths[i])) { + return iconPaths[i]; + } + } + + return 'icon.png'; + } + + /** + * Alfred item arguments + * @param {Object} project + * @return {string} + */ + _atomArgument(project: Object, options: Array = []): string { + let atomPath = process.env.atomPath || '/usr/local/bin/atom'; + + // Build shell command + let command = [ + atomPath + ]; + + // Append Atom options + command = command.concat(options); + + // Append project path(s) + if (project.paths) { + command.push('"' + project.paths.join('" "') + '"'); + } + + return command.join(' '); + } + + _openArgument(project: Object, app: string): string { + // Build shell command + let command = [ + 'open', + '-a', + `"${app}"` + ]; + + // Append project path(s) + if (project.paths) { + command.push('"' + project.paths.join('" "') + '"'); + } + + return command.join(' '); + } + + /** + * Parse project + * @param {Object} project + * @return {Object} + */ + parse(project: Object): Object { + let item = { + title: this._title(project), + subtitle: this._subtitle(project), + icon: { + path: this._icon(project) + }, + arg: this._atomArgument(project), + valid: project.paths && project.paths.length > 0, + mods: { + alt: { + valid: true, + subtitle: 'Open project path(s) in terminal', + arg: this._openArgument(project, process.env.terminalApp || 'Terminal') + }, + cmd: { + valid: true, + subtitle: 'Open in new window', + arg: this._atomArgument(project, ['-n']) + }, + ctrl: { + valid: true, + subtitle: 'Open in development mode', + arg: this._atomArgument(project, ['-d']) + }, + fn: { + valid: true, + subtitle: 'Append project path(s) to last open window', + arg: this._atomArgument(project, ['-a']) + }, + shift: { + valid: true, + subtitle: 'Open project path(s) in finder', + arg: this._openArgument(project, 'Finder') + } + } + }; + + return item; + } + + /** + * Parse a list of projects + * @param {Array.Object} projects + * @return {Array.Object} + */ + parseAll(projects: Array): Array { + let result = []; + + for (let i = 0; i < projects.length; i++) { + result.push(this.parse(projects[i])); + } + + return result; + } +} + +module.exports = new Project(); diff --git a/project.js.map b/project.js.map new file mode 100644 index 0000000..b0c12db --- /dev/null +++ b/project.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["project.js.flow"],"names":["fs","require","octicons","path","Project","statSync","err","project","title","toLowerCase","replace","group","paths","join","iconPaths","icon","startsWith","octiconNames","indexOf","slice","__dirname","homedir","process","env","HOME","resolve","isAbsolute","i","length","push","_fileExists","options","atomPath","command","concat","app","item","_title","subtitle","_subtitle","_icon","arg","_atomArgument","valid","mods","alt","_openArgument","terminalApp","cmd","ctrl","fn","shift","projects","result","parse","module","exports"],"mappings":"0bAEA,GAAMA,IAAKC,QAAQ,IAAR,CAAX,CACA,GAAMC,UAAWD,QAAQ,UAAR,CAAjB,CACA,GAAME,MAAOF,QAAQ,MAAR,CAAb,C,GAMMG,Q,4JAMUD,I,CAAuB,CAC/B,GAAI,CACAH,GAAGK,QAAH,CAAYF,IAAZ,EACA,MAAO,KAAP,CACH,CAAC,MAAOG,GAAP,CAAY,CACV,MAAO,MAAP,CACH,CACJ,C,kCAOIC,O,CAAyB,CAC1B,MAAOA,SAAQC,KAAR,CAAcC,WAAd,GAA4BC,OAA5B,CAAoC,GAApC,CAAyC,GAAzC,CAAP,CACH,C,sCAOMH,O,CAAyB,CAC5B,GAAIC,OAAeD,QAAQC,KAA3B,CAEA,GAAID,QAAQI,KAAZ,CAAmB,CACfH,OAAS,MAAQD,QAAQI,KAAzB,CACH,CAED,MAAOH,MAAP,CACH,C,4CAOSD,O,CAAyB,CAC/B,GAAIA,QAAQK,KAAZ,CAAmB,CACf,MAAOL,SAAQK,KAAR,CAAcC,IAAd,CAAmB,IAAnB,CAAP,CACH,CAED,MAAO,EAAP,CACH,C,oCAOKN,O,CAAiB,CACnB,GAAIO,WAAY,EAAhB,CAEA,GAAIP,QAAQQ,IAAZ,CAAkB,CAEd,GAAIR,QAAQQ,IAAR,CAAaC,UAAb,CAAwB,OAAxB,CAAJ,CAAsC,CAClC,GAAIC,cAAe,mBAAYf,QAAZ,CAAnB,CACA,GAAIe,aAAaC,OAAb,CAAqBX,QAAQQ,IAAR,CAAaI,KAAb,CAAmB,CAAnB,CAArB,GAA+C,CAAnD,CAAsD,CAClD,MAAOhB,MAAKU,IAAL,CAAUO,SAAV,CAAqB,OAArB,CAA8Bb,QAAQQ,IAAR,CAAaI,KAAb,CAAmB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,CACFN,MAAO,IADL,CAEFL,SAAU,0BAFR,CAGFG,IAAK,KAAKC,aAAL,CAAmBnC,OAAnB,CAA4B,CAAC,IAAD,CAA5B,CAHH,CAXJ,CAgBF2C,GAAI,CACAP,MAAO,IADP,CAEAL,SAAU,4CAFV,CAGAG,IAAK,KAAKC,aAAL,CAAmBnC,OAAnB,CAA4B,CAAC,IAAD,CAA5B,CAHL,CAhBF,CAqBF4C,MAAO,CACHR,MAAO,IADJ,CAEHL,SAAU,gCAFP,CAGHG,IAAK,KAAKK,aAAL,CAAmBvC,OAAnB,CAA4B,QAA5B,CAHF,CArBL,CARC,CAAX,CAqCA,MAAO6B,KAAP,CACH,C,0CAOQgB,Q,CAAwC,CAC7C,GAAIC,QAAS,EAAb,CAEA,IAAK,GAAI1B,GAAI,CAAb,CAAgBA,EAAIyB,SAASxB,MAA7B,CAAqCD,GAArC,CAA0C,CACtC0B,OAAOxB,IAAP,CAAY,KAAKyB,KAAL,CAAWF,SAASzB,CAAT,CAAX,CAAZ,EACH,CAED,MAAO0B,OAAP,CACH,C,uBAGLE,OAAOC,OAAP,CAAiB,GAAIpD,QAAJ,EAAjB","file":"project.js","sourcesContent":["// @flow\n\nconst fs = require('fs');\nconst octicons = require('octicons');\nconst path = require('path');\n\n/**\n * Atom Project\n * @class\n */\nclass Project {\n /**\n * Check if file exists\n * @param {string} path\n * @return {boolean}\n */\n _fileExists(path: string): boolean {\n try {\n fs.statSync(path);\n return true;\n } catch (err) {\n return false;\n }\n }\n\n /**\n * Project UID\n * @param {Object} project\n * @return {string}\n */\n _uid(project: Object): string {\n return project.title.toLowerCase().replace(' ', '_');\n }\n\n /**\n * Project title\n * @param {Object} project\n * @return {string}\n */\n _title(project: Object): string {\n let title:string = project.title;\n\n if (project.group) {\n title += ' - ' + project.group;\n }\n\n return title;\n }\n\n /**\n * Project sub-title\n * @param {Object} project\n * @return {string}\n */\n _subtitle(project: Object): string {\n if (project.paths) {\n return project.paths.join(', ');\n }\n\n return '';\n }\n\n /**\n * Project icon\n * @param {Object} project\n * @return {string} Full path to icon\n */\n _icon(project: Object) {\n let iconPaths = [];\n\n if (project.icon) {\n // Octicon\n if (project.icon.startsWith('icon-')) {\n let octiconNames = Object.keys(octicons);\n if (octiconNames.indexOf(project.icon.slice(5)) >= 0) {\n return path.join(__dirname, 'icons', project.icon.slice(5) + '.png');\n }\n }\n\n // Replace tilde\n if (project.icon.startsWith('~/')) {\n let homedir = process.env.HOME || '';\n project.icon = path.resolve(homedir, project.icon.slice(2));\n }\n\n // Search for project icon if its path is relative\n if (!path.isAbsolute(project.icon)) {\n for (let i = 0; i < project.paths.length; i++) {\n iconPaths.push(path.resolve(project.paths[i], project.icon));\n }\n }\n\n // Absolute path\n if (this._fileExists(project.icon)) {\n return project.icon;\n }\n }\n\n // Search every project root dir for icon.png\n for (let i = 0; i < project.paths.length; i++) {\n iconPaths.push(path.join(project.paths[i], 'icon.png'));\n }\n\n // Find project icon\n for (let i = 0; i < iconPaths.length; i++) {\n if (this._fileExists(iconPaths[i])) {\n return iconPaths[i];\n }\n }\n\n return 'icon.png';\n }\n\n /**\n * Alfred item arguments\n * @param {Object} project\n * @return {string}\n */\n _atomArgument(project: Object, options: Array = []): string {\n let atomPath = process.env.atomPath || '/usr/local/bin/atom';\n\n // Build shell command\n let command = [\n atomPath\n ];\n\n // Append Atom options\n command = command.concat(options);\n\n // Append project path(s)\n if (project.paths) {\n command.push('\"' + project.paths.join('\" \"') + '\"');\n }\n\n return command.join(' ');\n }\n\n _openArgument(project: Object, app: string): string {\n // Build shell command\n let command = [\n 'open',\n '-a',\n `\"${app}\"`\n ];\n\n // Append project path(s)\n if (project.paths) {\n command.push('\"' + project.paths.join('\" \"') + '\"');\n }\n\n return command.join(' ');\n }\n\n /**\n * Parse project\n * @param {Object} project\n * @return {Object}\n */\n parse(project: Object): Object {\n let item = {\n title: this._title(project),\n subtitle: this._subtitle(project),\n icon: {\n path: this._icon(project)\n },\n arg: this._atomArgument(project),\n valid: project.paths && project.paths.length > 0,\n mods: {\n alt: {\n valid: true,\n subtitle: 'Open project path(s) in terminal',\n arg: this._openArgument(project, process.env.terminalApp || 'Terminal')\n },\n cmd: {\n valid: true,\n subtitle: 'Open in new window',\n arg: this._atomArgument(project, ['-n'])\n },\n ctrl: {\n valid: true,\n subtitle: 'Open in development mode',\n arg: this._atomArgument(project, ['-d'])\n },\n fn: {\n valid: true,\n subtitle: 'Append project path(s) to last open window',\n arg: this._atomArgument(project, ['-a'])\n },\n shift: {\n valid: true,\n subtitle: 'Open project path(s) in finder',\n arg: this._openArgument(project, 'Finder')\n }\n }\n };\n\n return item;\n }\n\n /**\n * Parse a list of projects\n * @param {Array.Object} projects\n * @return {Array.Object}\n */\n parseAll(projects: Array): Array {\n let result = [];\n\n for (let i = 0; i < projects.length; i++) {\n result.push(this.parse(projects[i]));\n }\n\n return result;\n }\n}\n\nmodule.exports = new Project();\n"]} \ No newline at end of file diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..9b772ab Binary files /dev/null and b/screenshot.png differ diff --git a/src/atom-util.js b/src/atom-util.js deleted file mode 100644 index d65187f..0000000 --- a/src/atom-util.js +++ /dev/null @@ -1,185 +0,0 @@ -var fs = require('fs'), - path = require('path'), - fuzzaldrin = require('fuzzaldrin'); - -var AtomUtil = {}; - -/** - * File exists - * @param {string} file File path - * @return {boolean} - */ -function fileExists(file) -{ - try { - fs.statSync(file); - return true; - } - catch (e) { - return false; - } -} - -function getUid(project) -{ - return project.title.toLowerCase().replace(' ', '_'); -} - -/** - * Project title - * @param {object} project Project object - * @return {string} - */ -function getTitle(project) -{ - var title = project.title; - - if (project.group) { - title += ' - ' + project.group; - } - - return title; -} - -/** - * Project subtitle - * @param {object} project Project object - * @return {string} - */ -function getSubtitle(project) -{ - return project.paths.join(', ') -} - -/** - * Project icon - * @param {object} project Project object - * @return {string} Icon file - */ -function getIcon(project) -{ - let iconPaths = project.paths.map((projectPath) => { - return path.join(projectPath, 'icon.png'); - }); - - if (project.icon) { - let icon = project.icon.replace('icon-', '') + '-128.png'; - iconPaths.unshift(path.join('octicons', icon)); - } - - for (let iconPath in iconPaths) { - if(fileExists(iconPaths[iconPath])) { - return iconPaths[iconPath]; - } - } - - return 'icon.png'; -} - -/** - * Get atom arguments - * @param {object} project Project object - * @param {array} args Extra commandline arguments - * @param {string} app Command to open project paths with - * @return {string} - */ -function getArgument(project) -{ - return '"' + project.paths.join('" "') + '"'; -} - -/** - * Filter projects - * - * @param {array} projects Projects list - * @param {string} query Search query - * @param {array} keys Project object keys to search - * @return {array} Filtered and sorted projects - */ -AtomUtil.filterProjects = function(projects, query, keys) -{ - // TODO: Use fuzzaldrin directly once it has support for multpiple keys. PR has been made. - if (query) { - let scoredCandidates = {}; - - for (let projectIndex in projects) { - let project = projects[projectIndex]; - for (let keyIndex in keys) { - let key = keys[keyIndex]; - let score = fuzzaldrin.score(project[key], query); - - if (score > 0) { - if (!scoredCandidates[project.title]) { - scoredCandidates[project.title] = {project, score}; - continue; - } - scoredCandidates[project.title].score += score - } - } - } - - // Sort by score - scoredCandidates = Object.entries(scoredCandidates).sort((a, b) => { - return b[1].score - a[1].score; - }); - - // Only return projects - projects = scoredCandidates.map((a) => { - return a[1].project; - }); - } - - return projects; -} - -/** - * Parse projects - * @param {object} object Projects list - * @param {string} query Search query - * @return {object} - */ -AtomUtil.parseProjects = function(object, query) -{ - var projects = []; - - // Check and add project to list. - Object.keys(object || {}).map(function(key) { - var project = object[key]; - if (project && project.paths && project.title) { - projects.push(project); - } - }); - - // Sort projects - projects = projects.sort(function(a, b) { - return a.title.localeCompare(b.title); - }); - - // Perform search. - if (query) { - projects = this.filterProjects(projects, query, ['title', 'group']); - } - - // Return list. - return projects.map(function(project) { - var item = { - title: getTitle(project), - subtitle: getSubtitle(project), - icon: getIcon(project), - arg: getArgument(project), - valid: true, - text: { - copy: getArgument(project) - } - }; - - // If atom filters results, set UID. - if(!query) { - item.uid = getUid(project); - } - - return item; - }); -}; - -module.exports = AtomUtil; diff --git a/test/atom-util-tests.js b/test/atom-util-tests.js deleted file mode 100644 index 23f52f8..0000000 --- a/test/atom-util-tests.js +++ /dev/null @@ -1,132 +0,0 @@ -var path = require('path'), - expect = require('chai').expect, - AtomUtil = require('../src/atom-util'); - -describe('Atom Util', function() { - var object; - - beforeEach(function() { - object = { - 'project1': { - title: 'Project #1', - paths: ['dir/path1'] - }, - 'project2': { - title: 'Project #2', - paths: ['dir/path2'] - } - }; - }); - - describe('Projects object parsing', function() { - it('parses basic object', function() { - var projects = AtomUtil.parseProjects(object); - expect(projects).to.have.lengthOf(2); - expect(projects[0]).to.deep.equal({ - title: 'Project #1', - subtitle: 'dir/path1', - icon: 'icon.png', - arg: '\"dir/path1\"', - valid: true, - uid: 'project_#1', - text: { - copy: '\"dir/path1\"' - } - }); - expect(projects[1]).to.deep.equal({ - title: 'Project #2', - subtitle: 'dir/path2', - icon: 'icon.png', - arg: '\"dir/path2\"', - valid: true, - uid: 'project_#2', - text: { - copy: '\"dir/path2\"' - } - }); - }); - - it('handles no arguments', function() { - var projects = AtomUtil.parseProjects(); - expect(projects).to.be.a('array'); - expect(projects).to.have.lengthOf(0); - }); - - it('handles undefined object', function() { - var projects = AtomUtil.parseProjects(undefined, 'project'); - expect(projects).to.be.a('array'); - expect(projects).to.have.lengthOf(0); - }); - - it('parses project with multiple paths', function() { - object.project1.paths = ['dir/path3', 'dir/path4']; - var projects = AtomUtil.parseProjects(object); - expect(projects).to.have.lengthOf(2); - expect(projects[0]).to.deep.include({ - subtitle: 'dir/path3, dir/path4', - arg: '\"dir/path3\" \"dir/path4\"' - }); - }); - - it('append group', function() { - object.project1.group = 'group1'; - var projects = AtomUtil.parseProjects(object); - expect(projects[0].title).to.equal('Project #1 - group1'); - }); - - it('checks paths for an icon', function() { - var projectPath = path.join(__dirname, '..'); - object.project1.paths.push(projectPath); - var projects = AtomUtil.parseProjects(object); - expect(projects[0].icon).to.equal(path.join(projectPath, 'icon.png')); - expect(projects[1].icon).to.equal('icon.png'); - }); - - it('accepts icon key', function() { - object.project1.icon = 'icon-book'; - var projects = AtomUtil.parseProjects(object); - expect(projects[0].icon).to.equal('octicons/book-128.png'); - expect(projects[1].icon).to.equal('icon.png'); - }); - - it('handles non-existing icon', function() { - object.project2.icon = 'non-existing'; - var projects = AtomUtil.parseProjects(object); - expect(projects[1].icon).to.equal('icon.png'); - }); - }); - - describe('Projects filtering', function() { - it('filters results by title', function() { - var projects = AtomUtil.parseProjects(object, 'ct2'); - expect(projects).to.have.lengthOf(1); - expect(projects[0].title).to.equal('Project #2'); - }); - - it('filters results by group', function() { - object.project1.group = 'test group'; - var projects = AtomUtil.parseProjects(object, 'test group'); - expect(projects).to.have.lengthOf(1); - expect(projects[0].title).to.equal('Project #1 - test group'); - }); - - it('handles empty filter query', function() { - var projects = AtomUtil.parseProjects(object, ''); - expect(projects).to.have.lengthOf(2); - }); - }); - - describe('Malformed projects object', function() { - it('handles missing title', function() { - delete object.project1.title; - var projects = AtomUtil.parseProjects(object, ''); - expect(projects).to.have.lengthOf(1); - }); - - it('handles missing path (templates)', function() { - delete object.project1.paths; - var projects = AtomUtil.parseProjects(object, ''); - expect(projects).to.have.lengthOf(1); - }); - }); -});