-
Notifications
You must be signed in to change notification settings - Fork 11
Make Archive->clear_directory dynamic or hookable #14
Comments
I would just wipe it, honestly. I was thinking of checking whether the directory lives at least inside the root of the project, but that might even be too restrictive. For instance, when deploying with Capistrano there's often a shared folder outside the releases folder. If you would want to put the static files over there, the check would be too restrictive. I dunno. We could also use the configured folder as the target location where we programmatically put the |
Well, my point being that I could see someone test driving this thing without properly filling in all Simply Static setting properly. There are no real warning that this plugin deletes 'that' directory, and I don't thing we will have those (like implicitly deleting I could see the 'is this part of the project' check working though, since we're (as in 'us') always building inside the project itself. And in theory you might be able to 'unfollow' a symbolic link, given that it's linked. If it's not part of the project and not linked, then you'd have a problem indeed. Not ideal, but a possible solution.
Hmm, interesting approach. Although it would be a bit weird that we're not generating the files in the specific folder you specify. It could also be a temp directory which is moved to the 'specified directory', but then you would have a temp directory (by the real plugin) and a temp directory (by us), and then a final directory which isn't necessarily the same as the temp one since it only adds what's been built, and not deleting the 'final destination directory'. I still think maybe explicitly the task makes sure people are (more) aware of the fact that it will delete that folder. define('SIMPLY_STATIC_DEPLOY_CONFIG', [
'aws' => [
'...' => '...',
],
'url' => env('AWS_SITE_WEBSITE_URL'),
'cleanup' => true,
]); Although looking at how we've done stuff previously, that should be:
I'm still not convinced. It's pretty huge thing to do, especially since it's so implicit. We know it happens, but someone else will not. So explicitly choosing to do so just feels saver. Maybe @HammenWS can be the final judge? |
I agree, it's definitely a huge thing. But that's why I think the plugin should only ever delete things it creates itself. That would be totally safe. Actually, that makes me wonder: why do we delete stuff? Since the generation is part of Simply_Static's responsibility, why do we take it upon ourselves to delete the static site? (or am I misremembering what gets deleted?) |
I think that everything we do that differs from the simply static plugin (like deleting files generated by that plugin) should be explicitly asked for. And to ask your question @harmenjanssen, the comment of the
|
And I wonder... When you use the cleanup. Does that mean you cannot use the different tasks ('generate', 'deploy', 'clear cloudfront')? |
Not sure what you mean? It's invoked before the 'generate' task, so that task starts with a clean slate. |
@schoenkaft Ah! My bad. I thought it was done after the deploy task. Before generating makes more sense. |
Saw the
clear_directory
method in theArchive
still checks is if the name of the directory isstatic
. Which only works when you call it like that. So that whole check should go if we want this function to work with any name.The issue is that it will remove any directory inputted as the
Local Directory
in the configuration. If you make a stupid mistake, this could wipe your whole system.So:
static
(which is a bit lame, but until now that was kind of fine).@harmenjanssen @HammenWS any thoughts?
The text was updated successfully, but these errors were encountered: