Skip to content

Commit

Permalink
fix: make isStoredInDotAtom a free function
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Dec 31, 2020
1 parent 6ab825c commit d1061a2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/minimap-plugin-generator-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,10 @@ class MinimapPluginGeneratorElement {
runCommand(atom.packages.getApmPath(), args, callback, { cwd: packagePath })
}

isStoredInDotAtom (packagePath) {
const packagesPath = path.join(atom.getConfigDirPath(), 'packages', path.sep)
if (packagePath.indexOf(packagesPath) === 0) { return true }

const devPackagesPath = path.join(atom.getConfigDirPath(), 'dev', 'packages', path.sep)

return packagePath.indexOf(devPackagesPath) === 0
}

createPackageFiles (callback) {
const packagePath = this.getPackagePath()

if (this.isStoredInDotAtom(packagePath)) {
if (isStoredInDotAtom(packagePath)) {
this.initPackage(packagePath, () => {
this.installPackage(packagePath, callback)
})
Expand All @@ -176,6 +167,14 @@ class MinimapPluginGeneratorElement {
const minimapPluginGeneratorElement = MinimapPluginGeneratorElement.initClass()
export default minimapPluginGeneratorElement

function isStoredInDotAtom (packagePath) {
const packagesPath = path.join(atom.getConfigDirPath(), 'packages', path.sep)
if (packagePath.indexOf(packagesPath) === 0) { return true }

const devPackagesPath = path.join(atom.getConfigDirPath(), 'dev', 'packages', path.sep)

return packagePath.indexOf(devPackagesPath) === 0
}

function runCommand (command, args, exit, options = {}) {
return new BufferedProcess({ command, args, exit, options })
Expand Down

0 comments on commit d1061a2

Please sign in to comment.