Merge branch 'dev-env-script-improvement'

This commit is contained in:
Michael Schmatz 2014-01-04 17:58:24 -05:00
commit 46ee134e35
3 changed files with 15 additions and 22 deletions

View file

@ -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
if os.path.exists(self.tmp_directory):
self.remove_directories()
os.mkdir(self.tmp_directory)
#then the bin directory for binaries(also includes binaries for dependencies?
#os.mkdir(self.bin_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.")
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)

View file

@ -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()

View file

@ -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":