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

Allow creating a TempProject in any arbitrary path #22

Open
DaniPopes opened this issue Nov 13, 2023 · 0 comments
Open

Allow creating a TempProject in any arbitrary path #22

DaniPopes opened this issue Nov 13, 2023 · 0 comments
Milestone

Comments

@DaniPopes
Copy link
Member

DaniPopes commented Nov 13, 2023

Needed this to initialize a project in an already-initialized template at a fixed path in Foundry tests, basically:

/// Initializes a new project in the given directory.
pub fn initialize(at: &Path) {
    let global_path = Path::new("/tmp/my_template/");
    let project = MyProject::new_with_root(global_path); // Wraps TempProject
    if project.is_empty() { // std::fs::read_dir or whatever
        project.initialize().unwrap();
    }
    project.copy_to(at).unwrap();
    // can also return a new project here
    // Project::new_with_root(at)
}
@zerosnacks zerosnacks added this to the v1.0.0 milestone Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants