コード例 #1
0
 def install_ruby(self):
     operating_system = self.config.system.operating_system
     #Ruby is on every recent Mac, most Linux distros
     if operating_system == u"windows":
         self.install_ruby_on_windows()
     elif operating_system == u"mac":
         raise errors.CoCoError(u"Ruby should be installed with Mac OSX machines. Please install Ruby.")
     elif operating_system == u"linux":
         raise errors.CoCoError(u"Please install Ruby on your Linux distribution(try 'sudo apt-get install ruby'.")
コード例 #2
0
ファイル: ruby.py プロジェクト: CarnosOS/ArcherCraft
 def install_ruby(self):
     operating_system = self.config.system.operating_system
     #Ruby is on every recent Mac, most Linux distros
     if operating_system == u"windows":
         self.install_ruby_on_windows()
     elif operating_system == u"mac":
         raise errors.CoCoError(
             u"Ruby should be installed with Mac OSX machines. Please install Ruby."
         )
     elif operating_system == u"linux":
         raise errors.CoCoError(
             u"Please install Ruby (try 'sudo apt-get install ruby').\nIf you are not using Ubuntu then please see your Linux Distribution's documentation for help installing ruby."
         )
コード例 #3
0
 def cloneRepository(self):
     print(u"Cloning repository...")
     #TODO: CHANGE THIS BEFORE LAUNCH
     return_code = True
     git_folder = self.config.directory.root_install_directory + os.sep + "coco"
     print("Installing into " + git_folder)
     return_code = subprocess.call(
         "git clone " + self.config.repository_url + " coco",
         cwd=self.config.directory.root_install_directory,
         shell=True)
     #TODO: remove this on windos
     subprocess.call("chown -R " + git_folder + " 0777", shell=True)
     if return_code and self.config.system.operating_system != u"windows":
         #raise errors.CoCoError("Failed to clone git repository")
         import shutil
         #import sys
         #sys.stdout.flush()
         raw_input(u"Copy it now")
         #shutil.copytree(u"/Users/schmatz/coco",self.config.directory.root_install_directory + os.sep + u"coco")
         print(u"Copied tree just for you")
         #print("FAILED TO CLONE GIT REPOSITORY")
         #input("Clone the repository and click any button to continue")
     elif self.config.system.operating_system == u"windows":
         raise errors.CoCoError(
             u"Windows doesn't support automated installations of npm at this point."
         )
     else:
         print(u"Cloned git repository")
コード例 #4
0
 def install_node_packages(self):
     print(u"Installing node packages...")
     #TODO: "Replace npm with more robust package
     #npm_location = self.config.directory.bin_directory + os.sep + "node" + os.sep + "bin" + os.sep + "npm"
     npm_location = u"npm"
     return_code = subprocess.call([npm_location,u"install"],cwd=self.config.directory.root_dir + os.sep + u"coco")
     if return_code:
         raise errors.CoCoError(u"Failed to install node packages")
     else:
         print(u"Installed node packages!")
コード例 #5
0
def check_if_root():
    is_admin = False
    try:
        uid = os.getuid()
        if uid == 0:
            is_admin = True
    except:
        is_admin = True
        #is_admin = ctypes.windll.shell32.IsUserAnAdmin()
    if not is_admin:
        raise errors.CoCoError(u"You need to be root. Run as sudo.")
コード例 #6
0
 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):
             self.remove_tmp_directory()
         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."
         )
コード例 #7
0
 def __init__(self,config):
     self.config = config
     assert isinstance(config,configuration.Configuration)
     is_ruby_installed = self.check_if_ruby_exists()
     is_gem_installed = self.check_if_gem_exists()
     if is_ruby_installed and not is_gem_installed:
         #this means their ruby is so old that RubyGems isn't packaged with it
         raise errors.CoCoError(u"You have an extremely old version of Ruby. Please upgrade it to get RubyGems.")
     elif not is_ruby_installed:
         self.install_ruby()
     elif is_ruby_installed and is_gem_installed:
         print u"Ruby found."
コード例 #8
0
 def install_node_packages(self):
     print(u"Installing node packages...")
     #TODO: "Replace npm with more robust package
     #npm_location = self.config.directory.bin_directory + os.sep + "node" + os.sep + "bin" + os.sep + "npm"
     npm_location = u"npm"
     if sys.version_info[0] == 2:
         py_cmd = "python"
     else:
         py_cmd = subprocess.check_output(['which', 'python2'])
     return_code = subprocess.call(
         [npm_location, u"install", "--python=" + py_cmd],
         cwd=self.config.directory.root_dir + os.sep + u"coco")
     if return_code:
         raise errors.CoCoError(u"Failed to install node packages")
     else:
         print(u"Installed node packages!")
コード例 #9
0
 def __init__(self,config):
     self.config = config
     assert isinstance(self.config,configuration.Configuration)
     if not self.checkIfGitExecutableExists():
         if self.config.system.operating_system == "linux":
             raise errors.CoCoError("Git is missing. Please install it (try 'sudo apt-get install git')\nIf you are not using Ubuntu then please see your Linux Distribution's documentation for help installing git.")
         elif self.config.system.operating_system == "mac":
             raise errors.CoCoError("Git is missing. Please install the Xcode command line tools.")
         raise errors.CoCoError(u"Git is missing. Please install git.")
         #http://stackoverflow.com/questions/9329243/xcode-4-4-and-later-install-command-line-tools
     if not self.checkIfCurlExecutableExists():
         if self.config.system.operating_system == "linux":
             raise errors.CoCoError("Curl is missing. Please install it(try 'sudo apt-get install curl')\nIf you are not using Ubuntu then please see your Linux Distribution's documentation for help installing curl.")
         elif self.config.system.operating_system == "mac":
             raise errors.CoCoError("Curl is missing. Please install the Xcode command line tools.")
         raise errors.CoCoError(u"Git is missing. Please install git.")
コード例 #10
0
 def __init__(self, config):
     self.config = config
     assert isinstance(self.config, configuration.Configuration)
     if not self.checkIfGitExecutableExists():
         if self.config.system.operating_system == "linux":
             raise errors.CoCoError(
                 "Git is missing. Please install it(with apt, type 'sudo apt-get install git'"
             )
         elif self.config.system.operating_system == "mac":
             raise errors.CoCoError(
                 "Git is missing. Please install the Xcode command line tools."
             )
         raise errors.CoCoError(u"Git is missing. Please install git.")
         #http://stackoverflow.com/questions/9329243/xcode-4-4-and-later-install-command-line-tools
     if not self.checkIfCurlExecutableExists():
         if self.config.system.operating_system == "linux":
             raise errors.CoCoError(
                 "Curl is missing. Please install it(with apt, type 'sudo apt-get install curl'"
             )
         elif self.config.system.operating_system == "mac":
             raise errors.CoCoError(
                 "Curl is missing. Please install the Xcode command line tools."
             )
         raise errors.CoCoError(u"Git is missing. Please install git.")