#Create directory for files to append in the main file
+#Extract information from preferences and subscribe method to create required objects
+os.system("python Extractor/ExtractorScript.py")
+
#Files for both Apps
Out = open("main.groovy", "w+")
GlobalVariablesBothApps = open("GlobalVariables/"+"GlobalVariablesBothApps.groovy", "r")
outGlobal = open("Extractor/"+"outGlobal.groovy", "r")
-
+eventSimulator = open("eventSimulator/"+"eventSimulator.groovy", "r")
#For App1
GlobalVariablesEachApp = open("GlobalVariables/"+"GlobalVariablesEachApp.groovy", "r")
unschedule = open("Methods/"+"unschedule.groovy", "r")
sendNotificationToContacts = open("Methods/"+"sendNotificationToContacts.groovy", "r")
sendSms = open("Methods/"+"sendSms.groovy", "r")
+sendPush = open("Methods/"+"sendPush.groovy", "r")
eventHandler = open("Methods/"+"eventHandler.groovy", "r")
-App1 = open("Extractor/"+"App1.groovy", "r")
-extractedObjectsApp1 = open("Extractor/"+"extractedObjectsApp1.groovy", "r")
-extractedObjectsConstructorApp1 = open("Extractor/"+"extractedObjectsConstructorApp1.groovy", "r")
+schedule = open("Methods/"+"schedule.groovy", "r")
+App1 = open("Extractor/"+"App1/App1.groovy", "r")
+extractedObjectsApp1 = open("Extractor/"+"App1/extractedObjectsApp1.groovy", "r")
+extractedObjectsConstructorApp1 = open("Extractor/"+"App1/extractedObjectsConstructorApp1.groovy", "r")
+extractedFunctionsApp1 = open("Extractor/"+"App1/extractedFunctionsApp1.groovy", "r")
+
-#Extract information from preferences and subscribe method to create required objects
-os.system("python Extractor/ExtractorScript.py")
Out.write("//Infrastructure for SmartThings Application\n")
Out.write("//Importing Libraries\n")
Out.write("import Location.Phrase\n")
Out.write("import appTouch.Touched\n")
Out.write("import Event.Event\n")
+Out.write("import Timer.SimulatedTimer\n")
Out.write("\n")
Out.write("//Global eventHandler\n")
for line in eventHandler:
for line in extractedObjectsApp1:
Out.write("\t"+line)
Out.write("\n")
+Out.write("\t//Extracted objects for functions for App1\n")
+for line in extractedFunctionsApp1:
+ Out.write("\t"+line)
+Out.write("\n")
Out.write("\tApp1(Object obj) {\n")
Out.write("\t\treference = obj\n")
Out.write("\t\tlocation = obj.locationObject\n")
Out.write("\t"+line)
for line in sendSms:
Out.write("\t"+line)
+for line in sendPush:
+ Out.write("\t"+line)
+for line in schedule:
+ Out.write("\t"+line)
Out.write("\n")
Start = 0
for line in App1:
sendNotificationToContacts = open("Methods/"+"sendNotificationToContacts.groovy", "r")
sendSms = open("Methods/"+"sendSms.groovy", "r")
eventHandler = open("Methods/"+"eventHandler.groovy", "r")
-App2 = open("Extractor/"+"App2.groovy", "r")
-extractedObjectsApp2 = open("Extractor/"+"extractedObjectsApp2.groovy", "r")
-extractedObjectsConstructorApp2 = open("Extractor/"+"extractedObjectsConstructorApp2.groovy", "r")
+schedule = open("Methods/"+"schedule.groovy", "r")
+App2 = open("Extractor/"+"App2/App2.groovy", "r")
+extractedObjectsApp2 = open("Extractor/"+"App2/extractedObjectsApp2.groovy", "r")
+extractedObjectsConstructorApp2 = open("Extractor/"+"App2/extractedObjectsConstructorApp2.groovy", "r")
+extractedFunctionsApp2 = open("Extractor/"+"App2/extractedFunctionsApp2.groovy", "r")
Out.write("//Application #2\n")
Out.write("class App2 {\n")
for line in extractedObjectsApp2:
Out.write("\t"+line)
Out.write("\n")
+Out.write("\t//Extracted objects for functions for App2\n")
+for line in extractedFunctionsApp2:
+ Out.write("\t"+line)
+Out.write("\n")
Out.write("\tApp2(Object obj) {\n")
Out.write("\t\treference = obj\n")
Out.write("\t\tlocation = obj.locationObject\n")
Out.write("\t"+line)
for line in sendSms:
Out.write("\t"+line)
+for line in sendPush:
+ Out.write("\t"+line)
+for line in schedule:
+ Out.write("\t"+line)
Out.write("\n")
Start = 0
for line in App2:
Out.write("@Field def app2 = new App2(this)\n")
Out.write("app1.installed()\n")
Out.write("app2.installed()\n")
+Out.write("\n")
+for line in eventSimulator:
+ Out.write("\t"+line)
Out.close()