def create(config): """Create a new project""" context = api_config.read(config.name) console.show_config(context) default = dict(context['default_project']) project_path = os.path.join(default['basedir'], default['project_slug']) if os.path.isdir(project_path): console.error("Project already exist") return api_project.create(default) system.store(context, project_path)
def create(context={}): """Create a new project""" if not is_valid(context): console.error('No template defined') sys.exit(1) template = context["template"] cookiecutter.cookiecutter(template=template, extra_context=context, output_dir=context['basedir'], checkout="master", no_input=True)
def remove(project, config): console.info("Your projects:") context = api_config.read(config.name) default = dict(context['default_project']) basedir = default['basedir'] if not os.path.isdir(basedir): console.error("Configuration basedir not defined") console.error( "rogue-config add default_project.basedir <yourdir> --global") return choice = os.path.join(basedir, project) console.info("remove {}".format(choice)) shutil.rmtree(choice)
def open(project, config): console.info("Your projects:") context = api_config.read(config.name) default = dict(context['default_project']) basedir = default['basedir'] if not os.path.isdir(basedir): console.error("Configuration basedir not defined") console.error( "rogue-config add default_project.basedir <yourdir> --global") return choice = os.path.join(basedir, project) console.info("open {}".format(choice)) os.chdir(choice) print(os.getcwd())
def list(config, realtime, timer): console.info("Your projects:") context = api_config.read(config.name) default = dict(context['default_project']) basedir = default['basedir'] if not os.path.isdir(basedir): console.error("Configuration basedir not defined") console.error( "rogue-config add default_project.basedir <yourdir> --global") return if realtime: while True: click.clear() display_list(basedir) console.info("refresh every {}s".format(timer)) time.sleep(timer) display_list(basedir)