mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
More intermittent improvements and cleanup
This commit is contained in:
parent
c366945d89
commit
5687fae1cc
3 changed files with 12 additions and 13 deletions
|
@ -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,14 +30,16 @@ class DirectoryController(object):
|
|||
os.mkdir(full_path)
|
||||
|
||||
def create_base_directories(self):
|
||||
shutil.rmtree(self.root_dir + os.sep + "coco" + os.sep + "node_modules",ignore_errors=True) #just in case
|
||||
try:
|
||||
if os.path.exists(self.tmp_directory):
|
||||
shutil.rmtree(self.tmp_directory)
|
||||
self.remove_directories()
|
||||
os.mkdir(self.tmp_directory)
|
||||
except:
|
||||
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)
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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":
|
||||
|
|
Loading…
Reference in a new issue