dxw/whippet

whippet.lock needs to be cleared before running whippet deps update

mallorydxw opened this issue · 5 comments

% cat whippet.json 
{
    "src": {
        "plugins": "git@git.dxw.net:wordpress-plugins/"
    },
    "plugins": [
        {"name": "advanced-custom-fields"},
    ]
}
% cat whippet.lock 
{
    "hash": "5fd32d33dbb1ac21d471bb7b4fbf2a120f439ba3",
    "plugins": [
        {
            "name": "advanced-custom-fields",
            "src": "git@git.dxw.net:wordpress-plugins/advanced-custom-fields",
            "revision": "df26f74c9b10cae9f773c861218ced9cca03c63c"
        }
}
% vim whippet.json
[...]
% cat whippet.json
{
    "src": {
        "plugins": "git@git.dxw.net:wordpress-plugins/"
    },
    "plugins": [
        {"name": "advanced-custom-fields-pro"},
    ]
}
% whippet deps update
[Updating plugins/advanced-custom-fields-pro]
% cat whippet.lock
{
    "hash": "5fd32d33dbb1ac21d471bb7b4fbf2a120f439ba3",
    "plugins": [
        {
            "name": "advanced-custom-fields",
            "src": "git@git.dxw.net:wordpress-plugins/advanced-custom-fields",
            "revision": "df26f74c9b10cae9f773c861218ced9cca03c63c"
        },
        {
            "name": "advanced-custom-fields-pro",
            "src": "git@git.dxw.net:wordpress-plugins/advanced-custom-fields-pro",
            "revision": "4c61ecd39e80eb295897b5cd7b3a05aa3ce15c70"
        }
}

The problem here is that plugins missing from whippet.json are not being removed from whippet.lock.

👍
OK here's what my understanding of the desired functionality is:

  • whippet deps update
    • always trash the old lockfile and rebuild it from scratch based on whatever is in whippet.json
    • (note that the equivalent bundle update accepts an optional list of gem names and only updates those. Presumably we're not proposing to implement this at this time)
  • whippet deps install
    • when nothing has been added or removed, do nothing
    • when a plugin is found in whippet.json which isn't in whippet.lock, add it
    • when a plugin is found in whippet.lock which isn't in whippet.json, remove it. Don't change the locked versions of any other plugins.
    • when a plugin version restriction in whippet.json is incompatible with the version locked inwhippet.lock`, update just that plugin - don't change the locked versions of any other plugins.

That's not quite what I'm going for here.

install never modifies whippet.lock, and it always goes by the contents of whippet.lock. I think it looks at whippet.json once, but only to check that the checksum is correct (and provide a warning that somebody may have forgotten to run update).

update reads the contents of whippet.json and builds a new whippet.lock (and updates .gitignore) based on that. And then it runs install.

Huh. OK, so it's super different to bundler then (a lot simpler). Sorry to add to the noise.

If we want to lock specific versions that the project works on I guess we add those to the whippet.json and we can't rely on the whippet.lock like we can (on the equivalent in ruby).

Huh. OK, so it's super different to bundler then (a lot simpler). Sorry to add to the noise.

Simplicity is the goal :)

If we want to lock specific versions that the project works on I guess we add those to the whippet.json and we can't rely on the whippet.lock like we can (on the equivalent in ruby).

Yep.