def create_plugin_config(root_dir, project_name, content): dkit_home = datakit_home(root_dir) plugin_dir = os.path.join(dkit_home, 'plugins', project_name) mkdir_p(plugin_dir) config_file = os.path.join(plugin_dir, 'config.json') write_json(config_file, content) return content
def create_plugin_config(root_dir, content={}): dkit_home = datakit_home(root_dir) plugin_dir = os.path.join(dkit_home, 'plugins/datakit-project') mkdir_p(plugin_dir) config_file = os.path.join(plugin_dir, 'config.json') config = {'default_template': ''} config.update(content) write_json(config_file, config) return config
def bootstrap_temp_env(dkit_home, fake_project, monkeypatch, tmpdir): mkdir_p(dkit_home) mkdir_p(fake_project) monkeypatch.setenv('DATAKIT_HOME', dkit_home) monkeypatch.chdir(fake_project) create_readme(fake_project) create_plugin_config( dkit_home, 'datakit-gitlab', { "gitlab_url": 'https://gitlab.inside.ap.org', "api_key": "afdafsa", "default_namespace": "data" })
def create_project_config(project_root, contents={}): config_dir = os.path.join(project_root, 'config') mkdir_p(config_dir) project_config = os.path.join(config_dir, 'datakit-data.json') write_json(project_config, contents)
def create_cookiecutter_home(tmpdir): pth = cookiecutter_home(tmpdir) mkdir_p(pth) return pth
def take_action(self, parsed_args): self.log.info("Initializing project for S3 data integration...") dirs_to_create = ['data', 'config'] [mkdir_p(directory) for directory in dirs_to_create] open('data/.gitkeep', 'w').close() self.create_project_config()
def bootstrap_temp_env(dkit_home, fake_project, monkeypatch, tmpdir): mkdir_p(dkit_home) mkdir_p(fake_project) monkeypatch.setenv('DATAKIT_HOME', dkit_home) monkeypatch.chdir(fake_project)
def create_plugin_config(plugin_dir, content): mkdir_p(plugin_dir) config_file = os.path.join(plugin_dir, 'config.json') write_json(config_file, content) return content
def setup(datakit_home, plugin_dir, fake_project, monkeypatch, tmpdir): mkdir_p(datakit_home) mkdir_p(plugin_dir) mkdir_p(fake_project) monkeypatch.setenv('DATAKIT_HOME', datakit_home) monkeypatch.chdir(fake_project)