-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContext.py
113 lines (105 loc) · 4.28 KB
/
Context.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import os
import sublime
import subprocess
import sublime_plugin
import time
from threading import Thread
class RunTerminalCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = self.view.file_name().split("\\")
#current_driver = path[0]
file = path.pop()
current_directory="\\".join(path)
cmd = ['cmd']
thread = subprocess.Popen(cmd,shell=False,cwd=current_directory)
thread.daemon = True
class RunNodeCommand(sublime_plugin.TextCommand,):
def run(self, edit):
path = self.view.file_name().split("\\")
current_driver = path[0]
file = path.pop()
current_directory="\\".join(path)
ext = file.split(".")
extension = ext.pop()
# command = "cd "+ current_directory + " & node " + file +" & start cmd"
# os.system(command);
if(extension == "js" or extension == "json"):
#print(current_directory)
cmd = ['cmd','/k node ' + self.view.file_name()]
# p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, creationflags=subprocess.SW_HIDE)
thread = subprocess.Popen(cmd,shell=False,cwd=current_directory)
thread.daemon = True
class RunNodemonCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = self.view.file_name().split("\\")
current_driver = path[0]
file = path.pop()
current_directory="\\".join(path)
ext = file.split(".")
extension = ext.pop()
# command = "cd "+ current_directory + " & nodemon " + file +" & start cmd"
# os.system(command);
if(extension == "js"):
print(current_directory)
cmd = ['cmd','/k nodemon ' + self.view.file_name()]
# p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, creationflags=subprocess.SW_HIDE)
thread = subprocess.Popen(cmd,shell=False,cwd=current_directory)
thread.daemon = True
class RunNwCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = self.view.file_name().split("\\")
current_driver = path[0]
file = path.pop()
current_directory="\\".join(path)
ext = file.split(".")
extension = ext.pop()
# command = "cd "+ current_directory + " & nodemon " + file +" & start cmd"
# os.system(command);
#if(extension == "json"):
print(current_directory)
cmd = ['cmd','/k nw.exe . --enable-transparent-visuals --force-cpu-draw']
# p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, creationflags=subprocess.SW_HIDE)
thread = subprocess.Popen(cmd,shell=False,cwd=current_directory)
thread.daemon = False
class RunGruntCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = self.view.file_name().split("\\")
current_driver = path[0]
file = path.pop()
current_directory="\\".join(path)
ext = file.split(".")
extension = ext.pop()
# command = "cd "+ current_directory + " & nodemon " + file +" & start cmd"
# os.system(command);
if(extension == "js"):
print(current_directory)
cmd = ['cmd','/k grunt']
# p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, creationflags=subprocess.SW_HIDE)
thread = subprocess.Popen(cmd,shell=False,cwd=current_directory)
thread.daemon = True
class RunMongoCommand(sublime_plugin.TextCommand):
def run(self, edit):
cmd = ['cmd','/k mongod --bind_ip=localhost --dbpath=c:\mongo-data\db --rest'] # set you mongodb database path
thread = subprocess.Popen(cmd,shell=False)
thread.daemon = True
class RunJsonServerCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = self.view.file_name().split("\\")
current_driver = path[0]
file = path.pop()
current_directory="\\".join(path)
ext = file.split(".")
extension = ext.pop()
# command = "cd "+ current_directory + " & nodemon " + file +" & start cmd"
# os.system(command);
if(extension == "json"):
print(current_directory)
cmd = ['cmd','/k json-server --watch ' + self.view.file_name()]
# p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, creationflags=subprocess.SW_HIDE)
thread = subprocess.Popen(cmd,shell=False,cwd=current_directory)
thread.daemon = True
class RunNotepadCommand(sublime_plugin.TextCommand):
def run(self, edit):
cmd = ['notepad.exe',self.view.file_name()]
thread = subprocess.Popen(cmd,shell=False)
thread.daemon = True