def test_clean_project_type_node(self): os.makedirs('node_modules') os.makedirs('vendor') compileman = CompileMan() compileman.clean_project_type('node') files_in_directory = os.listdir() cleaned = not 'node_modules' in files_in_directory self.assertTrue(cleaned)
def test_clean_project_type_node_vendor_kept(self): self.empty_folder() os.makedirs('node_modules') os.makedirs('vendor') compileman = CompileMan() compileman.clean_project_type('node') files_in_directory = os.listdir() kept = 'vendor' in files_in_directory self.assertTrue(kept)
def test_clean_project_type_php(self): self.empty_folder() os.makedirs('node_modules') os.makedirs('vendor') compileman = CompileMan() compileman.clean_project_type('php') files_in_directory = os.listdir() cleaned = not 'vendor' in files_in_directory self.assertTrue(cleaned)
def cman(): compileman = CompileMan() commands = Commands(sys.argv) if not commands.is_command_given(): command = compileman.guess_action() else: command = commands.get_command_given() if command == '': print('You have not provided any command and it was not possible to guess. Tell if you want to compile or clean the compiled assets typing \'compile\' or \'clean\'.') exit() project_types = compileman.get_project_types() if command == 'compile': can_compile = compileman.cancompile(project_types) if not can_compile: for reasons in compileman.get_cannot_compile_reasons(): print(reasons) else: for project_type in project_types: print("Compiling to project type of " + project_type) compileman.compile(project_type) if command == 'clean': for compilling_type in project_types: print("Removing project of type " + compilling_type) results = compileman.clean_project_type(compilling_type) if results.getResult(): resultMessage = "The project " + compilling_type + " has been removed." else: resultMessage = results.getErrorMessage() print(resultMessage)
def test_clean_project_type_return(self): compileman = CompileMan() clean_compile_result = compileman.clean_project_type('php') self.assertTrue(isinstance(clean_compile_result, Compile_Result))