Exemple #1
0
    def after_install(
        self,
        installer: PluginInstallService,
        plugin: ProjectPlugin,
        reason: PluginInstallReason,
    ):
        project = installer.project
        plugins_service = installer.plugins_service

        plugin_settings_service = PluginSettingsService(
            project, plugin, plugins_service=plugins_service)
        update_config = plugin_settings_service.get("_update")
        paths_to_update = [
            path for path, to_update in update_config.items() if to_update
        ]

        if reason is PluginInstallReason.ADD:
            print(f"Adding '{plugin.name}' files to project...")

            for path in self.create_files(project, paths_to_update):
                print(f"Created {path}")
        elif reason is PluginInstallReason.UPGRADE:
            print(f"Updating '{plugin.name}' files in project...")

            updated_paths = self.update_files(project, paths_to_update)
            if not updated_paths:
                print("Nothing to update")
                return

            for path in updated_paths:
                print(f"Updated {path}")
        else:
            print(
                f"Run `meltano upgrade files` to update your project's '{plugin.name}' files."
            )
Exemple #2
0
 def current_select(self):
     plugin_settings_service = PluginSettingsService(
         self.project, self.extractor, plugins_service=self.plugins_service)
     return plugin_settings_service.get("_select")