All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Dealing with Low Variable files in a Git workflow

Stephen 10 Dec 2012 17:57 idea, rejected

Hi Low,

It'd be nice if creating a new Low Variable in the specified Low Variables directory (.../variables/default_site) caused the variable to be automatically created when you visit the Low Variables page.

I'm using a Git workflow with local, staging and live environments, and this method works nicely with template files - creating a new template file locally, then when you visit the Template Manager on the live site (after the new file has been pushed to the live server), you see the new template appear automatically.

I don't think it'd be an issue if the Low Variable didn't work until you visit the Low Variables page in the control panel. And once in the CP, you can edit the variable label (the default would be the variable name as the variable label), the group, and the other settings, etc.

It doesn't feel right having to create a new Low Variable and save it as a file on the live site when using a Git workflow. I'd prefer to stick with the local > staging > live workflow for files (even if the database workflow is the opposite way around).

Thanks,

Ste

Replies

  1. Stephen 26 Feb 2013 04:44

    Hi Low,

    I never heard back from you about this request, but I've just noticed your later comment on another thread about this issue, so that covers your thoughts and reasoning behind it I guess.

    I'm just posting about my workflow in case you can think of any improvements, and so that I have this written down somewhere to come back to later.

    Using Git, my workflow (where my files go from Local > Staging > Production, whilst my database goes the opposite way to avoid syncing issues) for creating a new Low Variable that I want saved as a file is as follows:

    1. Create new file (i.e. lv_my_variable) in the Low Variables folder and leave it blank.
    2. Commit this file and push it to the live site.
    3. Visit the Low Variables page in the control panel of the live site.
    4. When visiting the Low Variables page, I noticed that the blank file I pushed in step 2 gets deleted automatically by Low Variables (not sure if this is intentional or a bug).
    5. Create the new Low Variable with the same short name as the file I created, and choose to save this as a file.
    6. Do a SQL dump of the live database.
    7. Import the SQL dump to my local database.

    Thanks,

    Ste

  2. Low 26 Feb 2013 09:12

    Sorry for not replying here. I guess I was waiting to see how many 'me toos' the topic would get.

    I'm still very hesitant to create variables from files at the moment, for reasons stated in the thread you linked to.

    For example, consider this scenario. You've created a new variable. You've added a label and notes, assigned it to a certain group, selected a type and defined the settings for that specific type. And you also checked the 'save as file' option.

    Now you copy the file over to the second server. What happens when LV creates a variable from it? It would be a var without a label or notes, in the Ungrouped group, of the default type (Textarea), with the default settings.

    Is that what you expected or wanted? In some cases maybe, yes. But I think in most cases -- no.

    If I added it, I'd need to also add a big caveat, explaining the above. In my opinion, a half-baked solution and therefore not one I'm willing to implement into Low Variables.

  3. Stephen 26 Feb 2013 19:46

    Hi Low,

    No worries for ignoring me and making me feel bad. ;-) (just kidding of course!)

    I take your point about this, and understand what you say about it being a half-baked solution. However, if you look at it from the opposite point of view, you could argue that the way it works currently is a half-baked solution with more steps than should be necessary, for those that use version control! :-)

    I'm not bothered about adding variable notes, variable labels, setting early parsing, specifying which group it belongs in, etc. I can live with visiting the control panel to fine tune all those things, just like I'd visit the Template Manager to add template notes (no, I've never added any either! ;-)), enable PHP, etc.

    It'd be an improvement, IMO, if I could upload a file and have it start to work as a 'basic' Low Variable, using default settings (textarea, ungrouped, saved as a file, short name and label based on the filename excluding '.html'), and no early parsing) straight away.

    Without understanding (even though I've read about it) the technical side of this, this seems more useful than the current situation where visiting the Low Variables page deletes the created variable file and you have to create it from scratch, being careful to use the exact same short name as the file that was created so it all syncs in with version control, etc. In fact, it'd be a time saving just having the variable already created based off the file, and just needing to be edited/fine-tuned (of which a live database dump will be needed anyway).

    Of course, none of this is a major issue or show-stopper. We're talking about saving a few minutes per Low Variable for those that use version control (and don't want to get involved with syncing database tables), so I understand why you'd want to avoid it if it was going to be a lot of work to implement, cause support headaches, or be a half-crap (or half-good!) solution. :-)

    Thanks,

    Ste