-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuildproject.py
More file actions
41 lines (33 loc) · 1.17 KB
/
buildproject.py
File metadata and controls
41 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
import sublime
import sublime_plugin
settings = sublime.load_settings("InfoProjects-SublimeText.sublime-settings")
class BuildProjectCommand(sublime_plugin.WindowCommand):
def run(self, deploy=False, cleanup=False):
self.cleanup = cleanup
self.deploy = deploy
self.view = self.window.active_view()
if self.deploy:
self.on_done()
else:
sublime.status_message("Commands like: 'less', 'csslint' or 'less,coffee'")
self.window.show_input_panel("Build command", "", self.on_done, None, None)
def on_done(self, buildcmd="all"):
sublime.status_message("")
working_dir = os.path.dirname(self.view.file_name())
psscript = "Invoke-Build.ps1"
if self.deploy:
psscript = "Invoke-BuildDevelop.ps1"
psargs = ""
if settings.get("auto_pull_tools", False):
psargs += " -p"
if self.deploy and not self.cleanup:
psargs += " -k"
if "\\src\\" in working_dir:
cmd = {
"cmd": ["powershell", "-NoLogo", psscript, psargs, buildcmd],
"working_dir": working_dir
}
self.window.run_command("exec", cmd)
else:
sublime.status_message("You need to edit an InfoProjects-project")