Skip to content

Commit 32987c7

Browse files
committed
fix: make linkPackage and installPackage free functions
1 parent b592149 commit 32987c7

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/minimap-plugin-generator-element.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,31 +127,17 @@ class MinimapPluginGeneratorElement {
127127
runCommand(atom.packages.getApmPath(), ['init', '-p', `${packagePath}`, '--template', templatePath], callback)
128128
}
129129

130-
linkPackage (packagePath, callback) {
131-
const args = ['link']
132-
if (atom.config.get('minimap.createPluginInDevMode')) { args.push('--dev') }
133-
args.push(packagePath.toString())
134-
135-
runCommand(atom.packages.getApmPath(), args, callback)
136-
}
137-
138-
installPackage (packagePath, callback) {
139-
const args = ['install']
140-
141-
runCommand(atom.packages.getApmPath(), args, callback, { cwd: packagePath })
142-
}
143-
144130
createPackageFiles (callback) {
145131
const packagePath = this.getPackagePath()
146132

147133
if (isStoredInDotAtom(packagePath)) {
148134
this.initPackage(packagePath, () => {
149-
this.installPackage(packagePath, callback)
135+
installPackage(packagePath, callback)
150136
})
151137
} else {
152138
this.initPackage(packagePath, () => {
153-
this.linkPackage(packagePath, () => {
154-
this.installPackage(packagePath, callback)
139+
linkPackage(packagePath, () => {
140+
installPackage(packagePath, callback)
155141
})
156142
})
157143
}
@@ -161,6 +147,20 @@ class MinimapPluginGeneratorElement {
161147
const minimapPluginGeneratorElement = MinimapPluginGeneratorElement.initClass()
162148
export default minimapPluginGeneratorElement
163149

150+
function linkPackage (packagePath, callback) {
151+
const args = ['link']
152+
if (atom.config.get('minimap.createPluginInDevMode')) { args.push('--dev') }
153+
args.push(packagePath.toString())
154+
155+
runCommand(atom.packages.getApmPath(), args, callback)
156+
}
157+
158+
function installPackage (packagePath, callback) {
159+
const args = ['install']
160+
161+
runCommand(atom.packages.getApmPath(), args, callback, { cwd: packagePath })
162+
}
163+
164164
function getPackagesDirectory () {
165165
return atom.config.get('core.projectHome') ||
166166
process.env.ATOM_REPOS_HOME ||

0 commit comments

Comments
 (0)