Beispiel #1
0
    def get_plugin_client_settings(self):
        user_path = self.get_plugin_settings_path("User")
        def_path = self.get_plugin_settings_path("MavensMate")
        settings = {}

        workspace = self.params.get('workspace', None)
        if self.project_name != None and workspace != None:
            try:
                settings['project'] = util.parse_json_from_file(
                    os.path.join(workspace, self.project_name,
                                 self.project_name + '.sublime-settings'))
            except:
                debug('Project settings could not be loaded')
        if not user_path == None:
            try:
                settings['user'] = util.parse_json_from_file(user_path)
            except:
                debug('User settings could not be loaded')
        if not def_path == None:
            try:
                settings['default'] = util.parse_json_from_file(def_path)
            except:
                raise MMException(
                    'Could not load default MavensMate settings.')
        if settings == {}:
            raise MMException(
                'Could not load MavensMate settings. Please ensure they contain valid JSON'
            )
        return settings
Beispiel #2
0
 def get_plugin_client_settings(self):
     user_path = self.get_plugin_settings_path("User")
     def_path = self.get_plugin_settings_path("MavensMate")
     settings = {}
     if not user_path == None:
         try:
             settings['user'] = util.parse_json_from_file(user_path)
         except:
             debug('User settings could not be loaded')
     if not def_path == None:
         try:
             settings['default'] = util.parse_json_from_file(def_path)
         except:
             raise MMException('Could not load default MavensMate settings.')
     return settings
Beispiel #3
0
    def get_plugin_client_settings(self):
        settings = {}
        user_path = self.get_plugin_settings_path("User")
        def_path = self.get_plugin_settings_path("MavensMate")
        '''
            if the default path for settings is none, we're either dealing with a bad client setup or
            a new client like Atom.io. Let's load the settings from the default cache and optionally allow 
            them to pipe settings in via STDIN
        '''
        if def_path == None:
            if 'ATOM' in self.plugin_client:
                file_name = 'atom'
            elif 'SUBLIME_TEXT' in self.plugin_client:
                file_name = 'st3'
            elif 'BRACKETS' in self.plugin_client:
                file_name = 'brackets'
            settings['default'] = util.parse_json_from_file(config.base_path +
                                                            "/lib/config/" +
                                                            file_name +
                                                            ".json")

            if config.plugin_client_settings != None:
                settings['user'] = config.plugin_client_settings
        else:
            workspace = self.params.get('workspace', None)
            if self.project_name != None and workspace != None:
                try:
                    settings['project'] = util.parse_json_from_file(
                        os.path.join(workspace, self.project_name,
                                     self.project_name + '.sublime-settings'))
                except:
                    debug('Project settings could not be loaded')
            if not user_path == None:
                try:
                    settings['user'] = util.parse_json_from_file(user_path)
                except:
                    debug('User settings could not be loaded')
            if not def_path == None:
                try:
                    settings['default'] = util.parse_json_from_file(def_path)
                except:
                    raise MMException(
                        'Could not load default MavensMate settings.')
        if settings == {}:
            raise MMException(
                'Could not load MavensMate settings. Please ensure they contain valid JSON'
            )
        return settings
Beispiel #4
0
 def get_plugin_client_settings(self):
     user_path = self.get_plugin_settings_path("User")
     def_path = self.get_plugin_settings_path("MavensMate")
     settings = {}
     if not user_path == None:
         try:
             settings['user'] = util.parse_json_from_file(user_path)
         except:
             debug('User settings could not be loaded')
     if not def_path == None:
         try:
             settings['default'] = util.parse_json_from_file(def_path)
         except:
             raise MMException(
                 'Could not load default MavensMate settings.')
     return settings
Beispiel #5
0
 def get_local_store(self):
     local_store = None
     try:
         local_store = util.parse_json_from_file(self.local_store_path)
     except:
         pass
     if local_store == None:
         local_store = {}
     return local_store
Beispiel #6
0
 def get_local_store(self):
     local_store = None
     try:
         local_store = util.parse_json_from_file(self.local_store_path)
     except:
         pass
     if local_store == None:
         local_store = {}
     return local_store
Beispiel #7
0
    def get_plugin_client_settings(self):
        settings = {}
        user_path = self.get_plugin_settings_path("User")
        def_path = self.get_plugin_settings_path("MavensMate")

        '''
            if the default path for settings is none, we're either dealing with a bad client setup or
            a new client like Atom.io. Let's load the settings from the default cache and optionally allow 
            them to pipe settings in via STDIN
        '''
        if def_path == None:
            if 'ATOM' in self.plugin_client:
                file_name = 'atom'
            elif 'SUBLIME_TEXT' in self.plugin_client:
                file_name = 'st3'
            elif 'BRACKETS' in self.plugin_client:
                file_name = 'brackets'
            settings['default'] = util.parse_json_from_file(config.base_path + "/lib/config/"+file_name+".json")

            if config.plugin_client_settings != None:
                settings['user'] = config.plugin_client_settings
        else:
            workspace = self.params.get('workspace', None)
            if self.project_name != None and workspace != None:
                try:
                    settings['project'] = util.parse_json_from_file(os.path.join(workspace,self.project_name,self.project_name+'.sublime-settings'))
                except:
                    debug('Project settings could not be loaded')
            if not user_path == None:
                try:
                    settings['user'] = util.parse_json_from_file(user_path)
                except:
                    debug('User settings could not be loaded')
            if not def_path == None:
                try:
                    settings['default'] = util.parse_json_from_file(def_path)
                except:
                    raise MMException('Could not load default MavensMate settings.')
        if settings == {}:
            raise MMException('Could not load MavensMate settings. Please ensure they contain valid JSON')
        return settings
Beispiel #8
0
    def get_plugin_client_settings(self):
        user_path = self.get_plugin_settings_path("User")
        def_path = self.get_plugin_settings_path("MavensMate")
        settings = {}

        workspace = self.params.get('workspace', None)
        if self.project_name != None and workspace != None:
            try:
                settings['project'] = util.parse_json_from_file(os.path.join(workspace,self.project_name,self.project_name+'.sublime-settings'))
            except:
                debug('Project settings could not be loaded')
        if not user_path == None:
            try:
                settings['user'] = util.parse_json_from_file(user_path)
            except:
                debug('User settings could not be loaded')
        if not def_path == None:
            try:
                settings['default'] = util.parse_json_from_file(def_path)
            except:
                raise MMException('Could not load default MavensMate settings.')
        if settings == {}:
            raise MMException('Could not load MavensMate settings. Please ensure they contain valid JSON')
        return settings
Beispiel #9
0
#this scripts freezes mm.py and places it in the dist directory
import sys
import argparse
import shutil
import os
import subprocess
import pipes
sys.path.append('../')
import util

mavensmate_path         = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
pyinstaller_path        = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))+"/tools/pyinstaller-dev"
mmserver_path           = os.path.dirname(os.path.dirname(__file__))
mmserver_build_path     = os.path.dirname(__file__)
build_settings          = util.parse_json_from_file('build_settings.json')

def main():
    #remove dist directory
    if os.path.exists("{0}/dist".format(mmserver_path)):
        shutil.rmtree("{0}/dist".format(mmserver_path))
    
    #remove mm directory from pyinstaller
    if os.path.exists("{0}/mmserver".format(pyinstaller_path)):
        shutil.rmtree("{0}/mmserver".format(pyinstaller_path))

    #run pyinstaller on mm.py
    os.chdir(pyinstaller_path)
    pyinstaller_command = "'{0}' pyinstaller.py '{1}/mmserver.py' --onedir '{2}/mmserver.spec'".format(
        build_settings['python_location'], 
        mmserver_path, 
        mmserver_path)