예제 #1
0
    def testDropPass(self):
        NOORA_DIR = os.path.dirname(noora.__file__)
        CURRENT_DIR = os.path.abspath('.')

        properties = Properties()
        properties.set_property("noora.dir", NOORA_DIR)
        properties.set_property("current.dir", CURRENT_DIR)
        properties.set_property("plugin.dir",
                                os.path.join(NOORA_DIR, 'plugins'))
        properties.set_property("project.file", "myproject.json")

        app = App()
        f = app.get_config_file(properties)
        f = open(f.get_url())

        data = json.load(f)
        for key in data.keys():
            properties.set_property(key, data[key])

        parser = argparse.ArgumentParser(
            description="mynoora, a sql deployment tool", add_help=False)
        parser.add_argument("commands",
                            help="display a square of a given number",
                            type=str,
                            nargs='+')
        parser.add_argument('-r',
                            action='store_true',
                            help='show the revision')
        parser.add_argument('-t', type=str, help='version', required=False)

        arguments = parser.parse_args(['generate', '-t=mssql'])

        plugin = GeneratePlugin()
        plugin.execute(arguments, properties)
예제 #2
0
    def testDropPass(self):
        NOORA_DIR = os.path.dirname(noora.__file__)
        CURRENT_DIR = os.path.abspath('.')

        properties = Properties()
        properties.set_property("noora.dir", NOORA_DIR)
        properties.set_property("current.dir", CURRENT_DIR)
        properties.set_property("plugin.dir", os.path.join(NOORA_DIR, 'plugins'))
        properties.set_property("project.file", "myproject.json")

        app = App()
        f = app.get_config_file(properties)
        f = open(f.get_url())

        data = json.load(f)
        for key in data.keys():
            properties.set_property(key, data[key])

        parser = argparse.ArgumentParser(description="mynoora, a sql deployment tool", add_help=False)
        parser.add_argument("commands", help="display a square of a given number", type=str, nargs='+')
        parser.add_argument('-r', action='store_true', help='show the revision')
        parser.add_argument('-h', type=str, help='host', required=False)
        parser.add_argument('-s', type=str, help='schema', required=False)
        parser.add_argument('-e', type=str, help='environment', required=False)
        parser.add_argument('-a', type=str, help='alias', required=False)

        arguments = parser.parse_args(['drop', '-h=elsevierdb4.c07v9zv3jhxs.eu-west-1.rds.amazonaws.com,1433'])

        plugin = DropPlugin()
        plugin.execute(arguments, properties)
예제 #3
0
    def testGeneratePass(self):
        properties = dict()
        properties["noora.dir"] = noora.__file__
        properties["current.dir"] = os.path.abspath('.')
        properties["plugin.dir"] = os.path.join(properties.get('noora.dir'),
                                                'plugins')
        properties["project.file"] = "myproject.json"

        app = App()
        f = app.get_config_file(properties)
        f = open(f.get_url())

        data = json.load(f)
        for key in data.keys():
            properties[key] = data[key]

        parser = argparse.ArgumentParser(
            description="mynoora, a sql deployment tool", add_help=False)
        parser.add_argument("commands",
                            help="display a square of a given number",
                            type=str,
                            nargs='+')
        parser.add_argument('-r',
                            action='store_true',
                            help='show the revision')
        parser.add_argument('-t', type=str, help='version', required=False)

        arguments = parser.parse_args(['generate', '-t=mysql'])

        plugin = GeneratePlugin()
        plugin.execute(arguments, properties)
예제 #4
0
def main(args=None):
    properties = Properties()
    properties.set_property("noora.dir", NOORA_DIR)
    properties.set_property("current.dir", CURRENT_DIR)
    properties.set_property("plugin.dir", os.path.join(NOORA_DIR, 'plugins'))
    properties.set_property("project.file", "myproject.json")

    # find the project config file myproject.json, in the current folder or in the noora folder
    app = App()
    f = app.get_config_file(properties)
    f = open(f.get_url())

    data = json.load(f)
    for key in data.keys():
        properties.set_property(key, data[key])

    # Instantiate the argument parser
    parser = argparse.ArgumentParser(description="mynoora, a sql deployment tool", add_help=False)
    parser.add_argument("commands", help="display a square of a given number", type=str, nargs='+')
    parser.add_argument('-r', action='store_true', help='show the revision')
    parser.add_argument('-v', type=str, help='version', required=False)
    parser.add_argument('-h', type=str, help='host', required=False)
    parser.add_argument('-d', type=str, help='database', required=False)
    parser.add_argument('-e', type=str, help='environment', required=False)
    parser.add_argument('-a', type=str, help='alias', required=False)
    parser.add_argument('-s', type=str, help='schema', required=False)
    parser.add_argument('-t', type=str, help='technology', required=False)

    args = parser.parse_args(args)

    # show the revision
    if args.r:
        print noora.__title__ + " version " + noora.__version__
        exit(0)

    # execute the given commands
    commands = args.commands
    Fail.fail_on_no_command(commands)

    for command in commands:
        plugin = App.find_plugin(command, properties)
        Fail.fail_on_invalid_plugin(plugin)
        plugin.execute(args, properties)
예제 #5
0
    def testBuildPass(self):
        NOORA_DIR = os.path.dirname(noora.__file__)
        CURRENT_DIR = os.path.abspath('.')

        properties = dict()
        properties["noora.dir"] = NOORA_DIR
        properties["current.dir"] = CURRENT_DIR
        properties["plugin.dir"] = os.path.join(NOORA_DIR, 'plugins')
        properties["project.file"] = "myproject.json"

        app = App()
        f = app.get_config_file(properties)
        f = open(f.get_url())

        data = json.load(f)
        for key in data.keys():
            properties[key] = data[key]

        parser = argparse.ArgumentParser(
            description="mynoora, a mysql deployment tool", add_help=False)
        parser.add_argument("commands",
                            help="display a square of a given number",
                            type=str,
                            nargs='+')
        parser.add_argument('-r',
                            action='store_true',
                            help='show the revision')
        parser.add_argument('-v', type=str, help='version', required=False)
        parser.add_argument('-h', type=str, help='host', required=False)
        parser.add_argument('-d', type=str, help='database', required=False)
        parser.add_argument('-e', type=str, help='environment', required=False)
        parser.add_argument('-a', type=str, help='alias', required=False)

        arguments = parser.parse_args(['build', '-v=1.0.1'])

        plugin = BuildPlugin()
        plugin.execute(arguments, properties)