def exec(self, os_lib=os):
        '''This method is executed to activate the given extension name.'''

        comp_name = self._arguments.name
        contrib_path = instantiator.get_package_abslocation(contrib)
        comp_path = "%s%s" % (contrib_path, comp_name)

        if not os_lib.path.exists(comp_path):
            raise FantasticoSdkCommandNotFoundError(
                "Extension %s does not exist." % comp_name)

        file_matcher = lambda abspath, filename: True
        root_folder = instantiator.get_component_path_data(
            SettingsFacade().get_config().__class__)[1]
        comp_root_folder = "%s%s/%s" % (root_folder, self._arguments.comp_root,
                                        comp_name)

        if not os_lib.path.exists(comp_root_folder):
            os_lib.mkdir(comp_root_folder)

        instantiator.scan_folder_by_criteria(
                            comp_path, file_matcher,
                            action=lambda abspath, filename: \
                                self._link_files(abspath, filename, contrib_path, root_folder, os_lib),
                            os_lib=os_lib)
    def exec(self, os_lib=os, call_cmd=call):
        '''This method executes module_setup.sql and create_data.sql scripts.

        :raises fantastico.sdk.sdk_exceptions.FantasticoSdkCommandError: When scripts execution fails unexpectedly.
        '''

        comp_folder = self._arguments.comp_root

        files = {"module_setup.sql": [],
                 "create_data.sql": []}

        scan_folder = lambda folder: instantiator.scan_folder_by_criteria(folder,
                                             file_matcher=lambda abspath, filename: self._is_file_supported(),
                                             action=store_file,
                                             os_lib=os_lib)

        def store_file(location, filename):
            '''This method stores all module_setup.sql and create_data.sql into a dictionary for future execution.'''

            if os_lib.path.isdir(location):
                return scan_folder(location)

            if filename not in ["module_setup.sql", "create_data.sql"]:
                return

            files[filename].append(location)

        scan_folder(comp_folder)

        self._execute_scripts(files, call_cmd)
    def exec(self, os_lib=os, call_cmd=call):
        '''This method executes module_setup.sql and create_data.sql scripts.

        :raises fantastico.sdk.sdk_exceptions.FantasticoSdkCommandError: When scripts execution fails unexpectedly.
        '''

        comp_folder = self._arguments.comp_root

        files = {"module_setup.sql": [], "create_data.sql": []}

        scan_folder = lambda folder: instantiator.scan_folder_by_criteria(
            folder,
            file_matcher=lambda abspath, filename: self._is_file_supported(),
            action=store_file,
            os_lib=os_lib)

        def store_file(location, filename):
            '''This method stores all module_setup.sql and create_data.sql into a dictionary for future execution.'''

            if os_lib.path.isdir(location):
                return scan_folder(location)

            if filename not in ["module_setup.sql", "create_data.sql"]:
                return

            files[filename].append(location)

        scan_folder(comp_folder)

        self._execute_scripts(files, call_cmd)
    def exec(self, os_lib=os):
        """This method is executed to activate the given extension name."""

        comp_name = self._arguments.name
        contrib_path = instantiator.get_package_abslocation(contrib)
        comp_path = "%s%s" % (contrib_path, comp_name)

        if not os_lib.path.exists(comp_path):
            raise FantasticoSdkCommandNotFoundError("Extension %s does not exist." % comp_name)

        file_matcher = lambda abspath, filename: True
        root_folder = instantiator.get_component_path_data(SettingsFacade().get_config().__class__)[1]
        comp_root_folder = "%s%s/%s" % (root_folder, self._arguments.comp_root, comp_name)

        if not os_lib.path.exists(comp_root_folder):
            os_lib.mkdir(comp_root_folder)

        instantiator.scan_folder_by_criteria(
            comp_path,
            file_matcher,
            action=lambda abspath, filename: self._link_files(abspath, filename, contrib_path, root_folder, os_lib),
            os_lib=os_lib,
        )