forked from enlightenment/edi
templtaes: refactor to use template name rather than path
This makes our command line interface easier to use. We lose the search paths for templates, but we did not use it
This commit is contained in:
parent
305c7c4b43
commit
a99382bed8
|
@ -9,7 +9,7 @@ foreach skeleton_name : skeleton_names
|
|||
command : [tar, 'zcf', '@OUTPUT@', '-C', '../data/extra/templates/skeletons', skeleton_name],
|
||||
input : 'skeletons' + '/' + skeleton_name,
|
||||
output : skeleton_name + '.tar.gz',
|
||||
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'templates', 'skeletons'),
|
||||
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'templates'),
|
||||
install : true,
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ collections {
|
|||
|
||||
data {
|
||||
item: "title" "C EFL Project";
|
||||
item: "path" "skeletons/eflproject.tar.gz";
|
||||
item: "path" "eflproject";
|
||||
item: "description"
|
||||
"Begin your C programming EFL project. All content is freely modifiable and distributable and licensed in the public-domain.<br><br>Happy hacking!";
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ collections {
|
|||
|
||||
data {
|
||||
item: "title" "Python EFL Project";
|
||||
item: "path" "skeletons/eflproject_python.tar.gz";
|
||||
item: "path" "eflproject_python";
|
||||
item: "description"
|
||||
"Start your new EFL Python programming project. All code is in the public-domain, you are free to modify and distribute as you wish.";
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ static void
|
|||
_edi_build_create_start(int argc, int arg0, char **argv)
|
||||
{
|
||||
elm_init(argc, argv);
|
||||
edi_create_efl_project(argv[arg0 + 1], argv[arg0 + 2], argv[arg0 + 3],
|
||||
edi_create_project(argv[arg0 + 1], argv[arg0 + 2], argv[arg0 + 3],
|
||||
argv[arg0 + 4], argv[arg0 + 5], argv[arg0 + 6],
|
||||
_edi_build_create_done_cb);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ main(int argc, char **argv)
|
|||
if (argc - args != 7)
|
||||
{
|
||||
fprintf(stderr, _("create requires 6 additional parameters:\n"));
|
||||
fprintf(stderr, " skeleton, parent_path, project_name, "
|
||||
fprintf(stderr, " template_name, parent_path, project_name, "
|
||||
"project_url, creator_name, creator_email\n");
|
||||
goto end;
|
||||
}
|
||||
|
|
|
@ -339,14 +339,14 @@ _edi_welcome_project_new_create_cb(void *data EINA_UNUSED, Evas_Object *obj EINA
|
|||
|
||||
if (template && path && path[0] && name && name[0])
|
||||
{
|
||||
edi_create_efl_project(template->skeleton_path, path, name, url, user, email,
|
||||
edi_create_example(template->path, path, name,
|
||||
_edi_welcome_project_new_create_done_cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (path && !path[0])
|
||||
if (!path || !path[0])
|
||||
elm_object_focus_set(_create_inputs[0], EINA_TRUE);
|
||||
else if (name && !name[0])
|
||||
else if (!name || !name[0])
|
||||
elm_object_focus_set(_create_inputs[1], EINA_TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -508,13 +508,8 @@ _edi_welcome_project_new_cb(void *data, Evas_Object *obj EINA_UNUSED, void *even
|
|||
EINA_LIST_FREE(_available_templates, template)
|
||||
_edi_template_free(template);
|
||||
|
||||
snprintf(path, sizeof(path), "%s/templates", _edi_config_dir_get());
|
||||
_edi_templates_discover(PACKAGE_DATA_DIR "/templates");
|
||||
_edi_templates_discover(path);
|
||||
|
||||
snprintf(path, sizeof(path), "%s/examples", _edi_config_dir_get());
|
||||
_edi_examples_discover(PACKAGE_DATA_DIR "/examples");
|
||||
_edi_examples_discover(path);
|
||||
|
||||
content = elm_box_add(naviframe);
|
||||
evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
|
|
|
@ -298,12 +298,12 @@ _edi_create_extract_done(void *data, int type EINA_UNUSED, void *event EINA_UNUS
|
|||
}
|
||||
|
||||
EAPI void
|
||||
edi_create_efl_project(const char *skelpath, const char *parentdir,
|
||||
edi_create_project(const char *template_name, const char *parentdir,
|
||||
const char *name, const char *url, const char *user,
|
||||
const char *email, Edi_Create_Cb func)
|
||||
{
|
||||
char *cmd, *extract;
|
||||
char tmp[PATH_MAX], dest[PATH_MAX];
|
||||
char tmp[PATH_MAX], dest[PATH_MAX], skelpath[PATH_MAX];
|
||||
Edi_Create *data;
|
||||
Ecore_Event_Handler *handler;
|
||||
|
||||
|
@ -311,6 +311,8 @@ edi_create_efl_project(const char *skelpath, const char *parentdir,
|
|||
snprintf(tmp, sizeof(tmp), "%s/edi_%s", eina_environment_tmp_get(), name);
|
||||
snprintf(dest, sizeof(dest), "%s/%s", parentdir, name);
|
||||
|
||||
snprintf(skelpath, sizeof(skelpath), PACKAGE_DATA_DIR "/templates/%s.tar.gz", template_name);
|
||||
|
||||
INF("Creating project \"%s\" at path %s for %s<%s>\n", name, dest, user, email);
|
||||
DBG("Extracting project files from %s\n", skelpath);
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ typedef void (*Edi_Create_Cb)(const char *path, Eina_Bool success);
|
|||
*/
|
||||
|
||||
/**
|
||||
* Create a new standard EFL project.
|
||||
* Create a new project from an Edi template.
|
||||
*
|
||||
* @ingroup Creation
|
||||
*/
|
||||
EAPI void
|
||||
edi_create_efl_project(const char *skelpath, const char *parentdir,
|
||||
edi_create_project(const char *template_name, const char *parentdir,
|
||||
const char *name, const char *url, const char *user,
|
||||
const char *email, Edi_Create_Cb func);
|
||||
|
||||
|
|
Loading…
Reference in New Issue