Esempio n. 1
0
 def do_make_db(self, line):
     if self.write_folder is None:
         print(
             "Please enter the directory to write files to : write_folder xxxx"
         )
     elif self.source_file is None:
         print("Please enter the source file : source xxxx")
     else:
         uml_db = Interpreter()
         uml_db.add_file(self.source_file, self.write_folder)
         self.db = uml_db.create_db()
Esempio n. 2
0
 def do_i_shelve(self, line):
     if self.write_folder is None:
         print(
             "Please enter the directory to write files to : write_folder xxxx"
         )
     elif self.source_file is None:
         print("Please enter the source file : source xxxx")
     else:
         uml_shelf = Interpreter()
         uml_shelf.add_file(self.source_file, self.write_folder)
         if self.root_directory:
             uml_shelf.shelve_modules(self.root_directory + "/" + line)
         else:
             uml_shelf.shelve_modules(line)
         print(f"modules shelved to {line}")
Esempio n. 3
0
    def do_interpret(self, line):
        if self.write_folder is None:
            print("""Please enter the directory to write files to :
Syntax : write_folder [folder name]
Example : write_folder out
Result : Folder to write files are /[folder name]""")
        elif self.source_file is None:
            print("Please enter the source file : source [file_name]")
        else:
            uml = Interpreter()
            uml.add_file(self.source_file, self.write_folder)
            uml.write_modules()
            if len(uml.all_my_errors) > 0:
                for an_error in uml.all_my_errors:
                    print(an_error)
            print("Interpreting complete")
Esempio n. 4
0
 def do_convert(self, line):
     arg = self.file_path(line)
     try:
         if not path.isfile(arg[0]):
             print(f"{arg[0]} is not a FILE")
         if path.isdir(arg[1]):
             pass
         else:
             print(f"{arg[1]} is not a DIR")
     except Exception as e:  # pragma: no cover
         print(e)
     if len(arg) == 2:
         converter = Interpreter()
         converter.add_file(arg[0], arg[1])
         converter.write_modules()
         """
         if len(converter.all_my_errors) > 0:
             for an_error in converter.all_my_errors:
                 print(an_error)
         """
         print("process complete")
Esempio n. 5
0
 def do_interpret(self, line):
     """
         ***
         Translates your SOURCE plantUML file to a python file
         in the ROOT directory provided
         Update ROOT directory: root [file_location]
         Update SOURCE file: source [source_file]
         ***
     """
     if self.root is None:
         print("Please enter the directory to write files to : root xxxx")
     elif self.source is None:
         print("Please enter the source file : source xxxx")
     else:
         x = Interpreter()
         x.add_file(self.source, self.root)
         x.write_modules()
         if len(x.all_my_errors) > 0:
             for an_error in x.all_my_errors:
                 print(an_error)
         print("Interpreting complete")
Esempio n. 6
0
 def test_05(self):
     x = Interpreter()
     x.add_file(self.file, "new_module")
     assert x.my_file is self.file
Esempio n. 7
0
 def test_08(self):
     x = Interpreter()
     x.add_file(self.file, "new_module")
     assert len(x.all_my_modules) > 0
Esempio n. 8
0
 def test_10(self):
     x = Interpreter()
     x.add_file(self.file, "new_module")
     assert x.all_my_modules[0]
Esempio n. 9
0
                 ***
            """)
        
    def help_source(self):
        print("""***
                 Update SOURCE file: source [source_file]
                 This file will be interpreted
                 ***
            """)
        
    def help_root(self, line):
        print("""***
                 Update ROOT directory: root [file_location]
                 Files will be created here
                 ***
            """)

    def postloop(self):
        print

if __name__ == '__main__':
    
    if len(sys.argv) > 1:
        root_directory = sys.argv[1]
        source_file = sys.argv[2]
        x = Interpreter()
        x.add_file(source_file, root_directory)
        x.write_modules()
        print(f"Python files created in {root_directory}")
    else:
        Controller().cmdloop()
Esempio n. 10
0
 def test_06(self):
     x = Interpreter()
     x.add_file(self.file, "new_module")
     assert len(x.my_class_content) > 0
Esempio n. 11
0
 def test_07(self):
     x = Interpreter()
     x.add_file(self.file, "new_module")
     assert len(x.my_relationship_content) > 0
Esempio n. 12
0
 def test_09(self):
     x = Interpreter()
     x.add_file(self.file, "new_module")
     x.read_file()
     assert len(x.all_my_errors) is 0
Esempio n. 13
0
 def test_11(self):
     x = Interpreter()
     x.add_file(self.file, "new_module")
     x.shelve_modules('test_shelf')
     assert len(x.my_shelf) > 0
Esempio n. 14
0
 def test_12(self):
     x = Interpreter()
     x.add_file(self.file, "new_module")
     x.create_db()
     assert x.my_db