-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
patch(persist): Persistence with type [Object] and [Array] #3248
base: develop
Are you sure you want to change the base?
Conversation
I don't like that array syntax. It's mess and not much readable, manifests should be straightforward and easy to maintain. For shortcuts it's OK, but here it's not much something you realy need and want to maintain (Mainly there has to be duplication in folder definition (if you want to keep same name), which i generaly really try to avoid in manifests). So i am unsubscribing from this PR and somone else might review it. I will strict only to #3212. #3212 will make persists more than suitable. |
You can just use new |
Yes. I know I can. But i just don't like it and for me it's waste of time to review this when I can review just code, which i like and which i believe is better for maintaining. When collaborators decide, this will be merged instead of #3212 (I hope this never happen), then why not, but i will still don't see a reason to invest my time into reviewing this PR. I just wanted to clarify 2 things:
|
Okay, if after discussion, Anyone else could review and test any parts of this PR, this two implementations use the same core function and wrapper function, with different |
34fcba6
to
667e773
Compare
d633752
to
7e5da35
Compare
7e5da35
to
8af504c
Compare
Error code 16 of
|
Totally rewrite using PowerShell's
Verb-Noun
.Reference: #2897 (comment) #3209 #3212
Refactor persistence implementation, by which maintainers could use
[Object]
or[Array]
(for backward compatible) type ofpersist
items to persist directories or files.persist
Demos(can also be found in
test\fixtures\persist
)[Object]
type persistence[Array]
type persistenceProperties Defination
[Object]
(forked from [WIP] Persistence rework with backward compatibility (persist) #3212)file
ordirectory
(alias:folder
,dir
) (optional)file
by default,directory
ifname
ends with\\
or/
(see demos)$persist_dir
(optional)$persist_dir
, link it; otherwise, copy to$persist_dir
and link it$persist_dir
, copy origin to$persist_dir
and link itASCII
, not used for directories)ASCII
,UTF8
,OEM
, etc.$persist_dir
,$architecture
, etc.)\r\n
, not used for directories)[Array]
(forked from fix(persist): Using [Array] to persist file #3209)[Array].Count
is used to determine if it is file or directory""
, not$null
)""
or$null
if not changed), and the remaining elements is file contents which will be joined with\r\n
Implementation
persist_data
into three part:PersistentHelper($Source, $Target, $Content, $Method, $Encoding)
Get-PersistentDefination($Persist)
$Persist
, use different mothods according to$Persist
's type ([PSCustomObject]
,[Object[]]
or[String]
)Add-PersistentLink($Persist, $InstalledPath, $PersistentPath)
Test Cases and Examples
Scoop-Install.Tests.ps1
: testing parsing$persist
, with item type[Object]
and[Array]
nvm-object.json
andnvm-array.json
attachedPlease test and review, thanks.
@r15ch13 @rasa @h404bi @Ash258