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

File existence control #30

Open
Aluriak opened this issue Aug 22, 2016 · 4 comments
Open

File existence control #30

Aluriak opened this issue Aug 22, 2016 · 4 comments

Comments

@Aluriak
Copy link
Contributor

Aluriak commented Aug 22, 2016

Some files could possibly be useless in some cases, like a requirement file when user always choose the options that lead to no requirements.

I can't find anything about that.

@Aluriak
Copy link
Contributor Author

Aluriak commented Aug 22, 2016

Follows some API propositions.

For the template API, the following could be possible:

{{ if not UseThirdPartyLibrary }}
    {{ ignore file }}
{{ end }}

Another way could be to enrich the project.json file itself:

{
    "UseThirdPartyLibrary": [true, false],
    "path/to/requirements": { "KeepIf": "{{UseThirdPartyLibrary}}" }
}

The latter could be a good start to a more modular project.json:

{
    "Variables:" {
        "Name": "License Template",
        "Description": "Template to create licences for projects very easily",
        "Author": "Tamer Tas",
        "Year": "2015",
        "License": [
            "Apache Software License 2.0",
            "MIT", 
            "GNU GPL v3.0",
            "No license please"
        ]
    },
    "Prompt:" {
        "Name": "Project name",
        "Description": "Short description",
        "Author": "Your name",
        "License": "Pick a license"
    },
    "Files": {
        "LICENSE": "ignore if eq License \"No license please\""
    },
    "Hooks": {
        "OnStart": "script_start.sh",
        "OnFinish": "script_end.sh"
    }
}

Which is readable as:

{
    "Variables:" {
        "VariableName1AsUsedInTemplate": "default value",
        "VariableName2AsUsedInTemplate": ["acceptable", "values"]
    },
    "Prompt:" {
        "VariableName1AsUsedInTemplate": "message displayed in prompt before waiting for the variable"
    },
    "Files": {
        "path/to/file": "command allowing keep/ignore file on some variable values"
    },
    "Hooks": {
        "event name": "path/to/script/to/execute",
    }
}

@tmrts
Copy link
Owner

tmrts commented Jan 7, 2017

@Aluriak currently empty files are ignored by default

Thanks for the modular structure suggestion, my plan is to use a similar structure for boilr with multiple files such as project.json, hooks.json, and so on

@Aluriak
Copy link
Contributor Author

Aluriak commented Feb 27, 2017

IMHO you should consider allowing both solutions : single file and multiple files.
Single files are much simpler to share and manage. Multiple files are useful for large projects.

@tmrts
Copy link
Owner

tmrts commented Feb 28, 2017

@Aluriak my main focus is not to bloat the features and increase the learning curve unless its not doable in a sane manner with the current feature set. Anybody familiar with json should be able to create a template in a matter minutes. Adding multiple options to do the same thing would increase maintenance burden and the learning curve

But, like I said, if a use case is not possible without hacks, we need to provide a better solution. Hope it makes a bit more sense now

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