diff --git a/scripts/devSetup/directoryController.py b/scripts/devSetup/directoryController.py index b6cd7fd8d..03bec6705 100644 --- a/scripts/devSetup/directoryController.py +++ b/scripts/devSetup/directoryController.py @@ -12,7 +12,6 @@ class DirectoryController(object): @property def root_install_directory(self): - #return self.root_dir + os.sep + u"codecombat" return self.root_dir + os.sep + "coco" + os.sep + "bin" @property def tmp_directory(self): @@ -31,20 +30,16 @@ class DirectoryController(object): os.mkdir(full_path) def create_base_directories(self): - #first create the directory for the development environment to be installed in + shutil.rmtree(self.root_dir + os.sep + "coco" + os.sep + "node_modules",ignore_errors=True) #just in case try: - #os.mkdir(self.root_install_directory) - #then the tmp directory for file downloads and the like - os.mkdir(self.tmp_directory) - #then the bin directory for binaries(also includes binaries for dependencies? - #os.mkdir(self.bin_directory) + if os.path.exists(self.tmp_directory): + self.remove_directories() + os.mkdir(self.tmp_directory) except: - #cleanup whatever we created - #self.remove_directories() - raise errors.CoCoError(u"There was an error creating the directory structure, do you have correct permissions? Please remove all and start over.") - + raise errors.CoCoError(u"There was an error creating the directory structure, do you have correct permissions? Please remove all and start over.") def remove_directories(self): - print u"Removed directories created!" shutil.rmtree(self.tmp_directory) - #shutil.rmtree(self.root_install_directory) + shutil.rmtree(self.bin_directory + os.sep + "node",ignore_errors=True) + shutil.rmtree(self.bin_directory + os.sep + "mongo",ignore_errors=True) + diff --git a/scripts/devSetup/factories.py b/scripts/devSetup/factories.py index 2d71f2860..1edbec108 100644 --- a/scripts/devSetup/factories.py +++ b/scripts/devSetup/factories.py @@ -10,17 +10,19 @@ import shutil import os import glob import subprocess +def print_computer_information(os_name,address_width): + print(os_name + " detected, architecture: " + str(address_width) + " bit") def constructSetup(): config = configuration.Configuration() + address_width = config.system.get_virtual_memory_address_width() if config.system.operating_system == u"mac": - print("Mac detected, architecture: " + str(config.system.get_virtual_memory_address_width()) + " bit") + print_computer_information("Mac",address_width) return MacSetup(config) elif config.system.operating_system == u"win": - print("Windows detected, architecture: " + str(config.system.get_virtual_memory_address_width())+ " bit") + print_computer_information("Windows",address_width) raise NotImplementedError("Windows is not supported at this time.") - #return WinSetup(config) elif config.system.operating_system == u"linux": - print("Linux detected, architecture: " + str(config.system.get_virtual_memory_address_width())+ " bit") + print_computer_information("Linux",address_width) return LinuxSetup(config) class SetupFactory(object): @@ -60,13 +62,9 @@ class SetupFactory(object): print("2. ./coco-brunch") print("3. ./coco-dev-server") print("Once brunch is done, visit http://localhost:3000!") - #print self.mongo.bashrc_string() - #print self.node.bashrc_string() - #print "COCO_DIR="+ self.config.directory.root_dir + os.sep + "coco" def cleanup(self): self.config.directory.remove_directories() - class MacSetup(SetupFactory): def setup(self): super(self.__class__, self).setup() diff --git a/scripts/devSetup/mongo.py b/scripts/devSetup/mongo.py index b6917967f..b706c2ae8 100644 --- a/scripts/devSetup/mongo.py +++ b/scripts/devSetup/mongo.py @@ -12,7 +12,7 @@ class MongoDB(Dependency): super(self.__class__, self).__init__(configuration) operating_system = configuration.system.operating_system self.config.directory.create_directory_in_tmp(u"mongo") - #self.config.directory.create_directory_in_bin("mongo") + if operating_system == u"mac": self.downloader = MacMongoDBDownloader(self) elif operating_system == u"win":