Exemple #1
0
    def testGenerateUpdateGuess(self):
        properties = Properties()
        properties.setProperty("noora.dir", NOORA_DIR)
        properties.setProperty("plugin.dir",
                               Path.path(NOORA_DIR, "org", "noora", "plugin"))
        properties.setProperty("current.dir",
                               Path.path(os.path.abspath('.'), 'example'))
        properties.setProperty(
            "alter.dir",
            Path.path(properties.getPropertyValue("current.dir"), "alter"))
        properties.setProperty(
            "create.dir",
            Path.path(properties.getPropertyValue("current.dir"), "create"))
        properties.setProperty("project.file", "myproject.conf")

        #connectable=MysqlConnector()
        generatePlugin = GeneratePlugin()
        print(generatePlugin.getRevision())
        options = generatePlugin.getOptions(properties)

        arguments = []
        parser = Parser()
        commandLine = parser.parse(options, arguments)
        parser.checkRequiredOptions()
        parser.checkRequiredArguments()
        generatePlugin.execute(commandLine, properties)
Exemple #2
0
  def testVersionLoader(self):
    
    properties = Properties()        
    propertyLoader = PropertyLoader(properties)        

    file = File("myproject.conf")
    fileReader = FileReader(file) 
    propertyLoader.load(fileReader)
    
    properties.setProperty("current.dir", os.path.abspath('.'))
    properties.setProperty("project.file", "myproject.conf")
    properties.setProperty("alter.dir",Path.path(properties.getPropertyValue("current.dir"),"alter"))
    properties.setProperty("create.dir",Path.path(properties.getPropertyValue("current.dir"),"create"))
    print "current.dir",properties.getPropertyValue("current.dir")
    #print "alter.dir",properties.getPropertyValue("alter.dir")
    #print "default_version :" + properties.getPropertyValues("DEFAULT_VERSION")
    
    
    # a File object is not a Version object
    # 
    versions = Versions()
    versionLoader = VersionLoader(versions)
    versionLoader.load(properties)
    versions.sort()
    #versions.sort()
    #print "versions",versions.getVersions()
    v = Version('1.0.1')
    print versions.previous(v).getValue()
    
    print versions.last().toString()
    print versions.next().toString()
    
    versionGuesser=VersionGuesser(properties, versions)
    nextVersion = versionGuesser.guess(None).toString()
    print versionGuesser.toFolder(nextVersion)
    def testUpdatePass(self):

        properties = Properties()
        propertyLoader = PropertyLoader(properties)
        file = File("myproject.conf")
        fileReader = FileReader(file)
        propertyLoader.load(fileReader)

        properties.setProperty("noora.dir", NOORA_DIR)
        properties.setProperty(
            "plugin.dir",
            NOORA_DIR + os.sep + "org" + os.sep + "noora" + os.sep + "plugin")
        properties.setProperty("current.dir", os.path.abspath('.'))
        properties.setProperty(
            "alter.dir",
            properties.getPropertyValue("current.dir") + os.sep + "alter")
        properties.setProperty(
            "create.dir",
            properties.getPropertyValue("current.dir") + os.sep + "create")

        #connectable=MysqlConnector()
        updatePlugin = UpdatePlugin()
        print(updatePlugin.getRevision())
        options = updatePlugin.getOptions(properties)

        arguments = ['-h=localhost', '-e=dev', '-v=1.0.1']
        parser = Parser()
        commandLine = parser.parse(options, arguments)
        parser.checkRequiredOptions()
        parser.checkRequiredArguments()
        updatePlugin.execute(commandLine, properties)
Exemple #4
0
    ).split(":")[1].rstrip("$").strip() + ")"


if __name__ == "__main__":

    properties = Properties()
    propertyLoader = PropertyLoader(properties)
    properties.setProperty("noora.dir", NOORA_DIR)
    properties.setProperty("current.dir", CURRENT_DIR)
    properties.setProperty(
        "plugin.dir",
        NOORA_DIR + os.sep + 'org' + os.sep + 'noora' + os.sep + 'plugin')
    properties.setProperty("project.file", "pgproject.conf")
    properties.setProperty(
        "alter.dir",
        properties.getPropertyValue("current.dir") + os.sep + "alter")
    properties.setProperty(
        "create.dir",
        properties.getPropertyValue("current.dir") + os.sep + "create")

    app = NoOraApp()
    file = app.getConfigFile(properties)
    fileReader = FileReader(file)
    propertyLoader.load(fileReader)

    classLoader = ClassLoader()
    options = Options()
    pluginManager = PluginManager(classLoader, options)
    pluginsProperty = properties.getProperty('PLUGINS')
    pluginManager.load(pluginsProperty)
    options = pluginManager.getOptions()
Exemple #5
0
    def testZipPass(self):

        properties = Properties()
        propertyLoader = PropertyLoader(properties)
        file = File("myproject.conf")
        fileReader = FileReader(file)
        propertyLoader.load(fileReader)

        properties.setProperty("current.dir", os.path.abspath('.'))
        properties.setProperty(
            "alter.dir",
            properties.getPropertyValue("current.dir") + os.sep + "alter")
        properties.setProperty(
            "create.dir",
            properties.getPropertyValue("current.dir") + os.sep + "create")

        versions = Versions()
        versionLoader = VersionLoader(versions)
        versionLoader.load(properties)
        versions.sort()
        #print versions.list()
        versionGuesser = VersionGuesser(properties, versions)
        version = versionGuesser.toFolder('1.0.0')

        currentFile = File(os.path.abspath('.'))
        current = Path.path(currentFile.getPath(), currentFile.getName())

        targetPath = Path.path(current, 'target')
        targetFile = File(targetPath)
        if not targetFile.exists():
            os.makedirs(targetPath)

        zipHandle = ZipFile(
            targetPath + os.sep + 'example_' + version + '.zip', 'w')

        excludedFolders = properties.getPropertyValues('EXCLUDED_FOLDERS')

        files = Files.list(currentFile, True)

        filters = Filters()

        excludedFolders = properties.getPropertyValues('EXCLUDED_FOLDERS')
        for excludedFolder in excludedFolders:
            ef = File(excludedFolder)
            ff = FileFolderFilter(ef)
            filters.add(ff)

        for file in files:

            result = False
            for excludedFolder in excludedFolders:
                if excludedFolder in file.getPath() + file.getName():
                    result = True
                    break

            #if filters.accept(file)==False:
            if not result:
                source = Path.path(file.getPath(), file.getName())
                target = source.replace(current, '')
                print file.getPath(), file.getName()

                zipHandle.write(source, target, zipfile.ZIP_DEFLATED)