Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ceedling project creation #1006

Open
xXFrank01Xx opened this issue Jan 27, 2025 · 2 comments
Open

Ceedling project creation #1006

xXFrank01Xx opened this issue Jan 27, 2025 · 2 comments

Comments

@xXFrank01Xx
Copy link

Hello,
First of all, thank you for Ceedling in general! It's an amazing tool!

However, I don't know if it's a bug or not, but I've been using version 0.31.1 for a long time with no problem and when I switched to 1.0.0, a thing bugs me...

With 0.31.1, let's say I was starting my development in a module folder, eg: /module/src/module.c
Then at some point I'm ready to work on the unit tests and type: "ceedling new module"
and the module folder would now include a project.yml and other folders and files without erasing my source file.

Now with 1.0.0, if my module folder is not empty, it refuses to generate the files and folders... It says:
EXCEPTION: It appears a project already exists at ./module/. Use --force to destroy it and create a new project.

I tried: "ceedling upgrade module"
EXCEPTION: Could not find an existing project at module/.

And if I use the --force, it erases everything...

Is it done like this on purpose? Do you have a new command I don't know about?

Thank you

@mvandervoord
Copy link
Member

@xXFrank01Xx -- first of all, THANK YOU for sharing an opinion on this topic. We've been trying to figure out how best to handle different situations of "starting out" and "upgrading" and it's a decision we honestly haven't decided on. There are really a number of situations that are all valid (and normal) use-cases:

  • someone wants to start a new ceedling project and no code or structure exists already
  • someone wants to start a new ceedling project for a codebase which is already being developed (or has been developed)
    • the user might want just a project.yml file to be added
    • they might want some other folders to be created too? (test? src? etc)
  • someone wants to upgrade a project from a previous ceedling version to a new ceedling version
    • this might mean they want ceedling to update some details of the project.yml file automatically
    • this might mean they don't want ceedling to touch their project.yml file at all

All these options above have further variations for if they're running ceedling as the gem, or they've installed it locally to that project.

Also, we want to detect when there are issues. Ceedling shouldn't blindly make a bunch of unwanted stuff if...

  • the user issues an upgrade request but not in a folder with a project.yml file
  • the user issues a new request, and we're in a folder with a project.yml file
  • the user issues a new/upgrade request, and they've renamed project.yml to something else?

We've not done a good job of figuring out how all these things SHOULD fit together yet, and we're definitely open to people's ideas on this topic.

In an attempt to backfill some error handling, we have indeed accidentally clobbered a common usecase: Wanting to add a project.yml file to an existing codebase.

Perhaps we should default to adding the project file AND the folders (to keep backward compatibility) but we add options for NOT doing those things?

Create a new project.yml file and subfolders where I am:

ceedling new .

Create a new project.yml file where I am:

ceedling new . --no-folders

Anyone? How should this work?

@xXFrank01Xx
Copy link
Author

Thank you for the reply!

I have no problem with the folders created by Ceedling. My usual module architecture is as follows:

module
 |_ inc
 |    |_ module.h
 |_ src
 |    |_ module.c
 |    |_ module_private_helper.h (optional, of course)
 |_ test
 |    |_ test_module.c
 |_ project.yml

So, most of the time, I start by creating the project like this:

module
 |_ inc
 |    |_ module.h
 |_ src
      |_ module.c

And when I have a few functions ready, I like adding the unit tests and then continue the development.
Using Ceedling 0.31.1, it worked great! I only had to add the inc path to the project.yml and I was good to go.

Regarding the upgrade of older versions of Ceedling to a new one, I must admit that I did use "ceedling new module --force" and I'm glad my module was commited and pushed, because I didn't expect losing my files haha

A suggestion for an easy fix (or temporary fix): When the new or upgrade command cannot work, could the files and folders be moved in a "backup folder", so after creation of the ceedling project, we just drag and drop our backed-up files to the appropriate locations and continue with our tests?

E.g.:
ceedling new module
Warning: Folder was not empty; files have been moved...

and you end up with:

module
 |_ bak
 |    |_ inc
 |    |    |_ module.h
 |    |_ src
 |         |_ module.c
 |_ src
 |_ test
 |_ project.yml

At least, it would save some heart attacks haha

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants