diff --git a/internal_packages/open-tracking/assets/InMessage-Read@1x.png b/internal_packages/open-tracking/assets/InMessage-Read@1x.png new file mode 100644 index 000000000..0ed393ff1 Binary files /dev/null and b/internal_packages/open-tracking/assets/InMessage-Read@1x.png differ diff --git a/internal_packages/open-tracking/assets/InMessage-Read@2x.png b/internal_packages/open-tracking/assets/InMessage-Read@2x.png new file mode 100644 index 000000000..db241f088 Binary files /dev/null and b/internal_packages/open-tracking/assets/InMessage-Read@2x.png differ diff --git a/internal_packages/open-tracking/lib/open-tracking-message-status.jsx b/internal_packages/open-tracking/lib/open-tracking-message-status.jsx index 556e57a2f..4b38bb59a 100644 --- a/internal_packages/open-tracking/lib/open-tracking-message-status.jsx +++ b/internal_packages/open-tracking/lib/open-tracking-message-status.jsx @@ -37,7 +37,8 @@ export default class OpenTrackingMessageStatus extends React.Component { return ( ); } diff --git a/internal_packages/plugins/lib/packages-store.coffee b/internal_packages/plugins/lib/packages-store.coffee index 3f5838ed1..1e1ab4aa6 100644 --- a/internal_packages/plugins/lib/packages-store.coffee +++ b/internal_packages/plugins/lib/packages-store.coffee @@ -173,15 +173,13 @@ PackagesStore = Reflux.createStore properties: ['openDirectory'] , (filenames) => return if not filenames or filenames.length is 0 - NylasEnv.packages.installPackageFromPath filenames[0], (err, packageTargetDir) => + NylasEnv.packages.installPackageFromPath filenames[0], (err) => return if err packageName = path.basename(filenames[0]) msg = "#{packageName} has been installed and enabled. No need to \ restart! If you don't see the package loaded, check the \ console for errors." - @_displayMessage("Package installed", msg) - if packageTargetDir - shell.showItemInFolder(packageTargetDir) + @_displayMessage("Plugin installed 🎉", msg) _onCreatePackage: -> if not NylasEnv.inDevMode() @@ -210,19 +208,19 @@ PackagesStore = Reflux.createStore packageName = path.basename(packageDir) if not packageDir.startsWith(packagesDir) - return @_displayMessage('Invalid package location', 'Sorry, you must - create packages in the packages folder.') + return @_displayMessage('Invalid plugin location', 'Sorry, you must + create plugins in the packages folder.') if NylasEnv.packages.resolvePackagePath(packageName) - return @_displayMessage('Invalid package name', 'Sorry, you must - give your package a unqiue name.') + return @_displayMessage('Invalid plugin name', 'Sorry, you must + give your plugin a unqiue name.') if packageName.indexOf(' ') isnt -1 - return @_displayMessage('Invalid package name', 'Sorry, package names + return @_displayMessage('Invalid plugin name', 'Sorry, plugin names cannot contain spaces.') fs.mkdir packageDir, (err) => - return @_displayMessage('Could not create package', err.toString()) if err + return @_displayMessage('Could not create plugin', err.toString()) if err {resourcePath} = NylasEnv.getLoadSettings() packageTemplatePath = path.join(resourcePath, 'static', 'package-template') diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 227d755ec..1be4f5b16 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -6,6 +6,7 @@ EmitterMixin = require('emissary').Emitter fs = require 'fs-plus' Q = require 'q' Grim = require 'grim' +CSON = require 'season' ServiceHub = require 'service-hub' Package = require './package' @@ -338,6 +339,8 @@ class PackageManager dialog = require('remote').require('dialog') shell = require('shell') + return unless @verifyValidPackage(packageSourceDir, callback) + packagesDir = path.join(NylasEnv.getConfigDirPath(), 'packages') packageName = path.basename(packageSourceDir) packageTargetDir = path.join(packagesDir, packageName) @@ -376,6 +379,22 @@ class PackageManager @activatePackage(packageName) callback(null, packageTargetDir) + verifyValidPackage: (packageSourceDir, callback) -> + if CSON.resolve(path.join(packageSourceDir, 'package')) + return true + else + errMsg = "The folder you selected doesn't look like a valid N1 plugin. All N1 plugins must have a package.json file in the top level of the folder. Check the contents of #{packageSourceDir} and try again" + + dialog = require('remote').require('dialog') + dialog.showMessageBox({ + type: 'warning' + buttons: ['OK'] + title: 'Not a valid plugin folder' + message: errMsg + }) + + callback(errMsg) + return false ### Section: Private ###