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

[Meta] Refactor lib\install.ps1 #3149

Closed
1 of 14 tasks
Ash258 opened this issue Feb 21, 2019 · 0 comments
Closed
1 of 14 tasks

[Meta] Refactor lib\install.ps1 #3149

Ash258 opened this issue Feb 21, 2019 · 0 comments

Comments

@Ash258
Copy link
Contributor

Ash258 commented Feb 21, 2019

This should be done when https://github.com/scoopinstaller/install is ready, so we do not have to care about moving something needed for scoop installation

  1. Slim whole script
    1. Functions moving
      • There is no need to have every download / check function inside install module.
      • Install module should contain only install related functions
      1. nightly_version -> lib\versions.ps1
      2. Download related functions -> lib\download.ps1
        • dl_with_cache
        • do_dl
        • dl
        • dl_progress_output
        • dl_progress
        • dl_urls
      3. Aria2 related functions -> lib\aria2.ps1
        • aria_exit_code
        • get_filename_from_metalink
        • dl_with_cache_aria2
      4. Environment related functions -> lib\environment.ps1
        • env_add_path
        • add_first_in_path
        • env_rm_path
        • env_set
        • env_rm
      5. Persist related functions -> lib\persist.ps1
        • persist_def
        • persist_data
        • unlink_persist_data
        • persist_permission
      6. Extraction related functions -> lib\decompress.ps1 (decompress.ps1: Refactored (w/ install.ps1, core.ps1) (edited) #3169)
        • unpack_inno
        • extract_msi
        • extract_lessmsi
    2. Adopt Verb-Noun naming of functions
  2. Downloading refactor / unify
    1. Download URl should strip scoop renames #/whaterever as it could potentially cause problems
    2. All dl_with_cache functions should have same parameter list
    3. There is incosistency between dl_with_cache normal and aria2 version
      • Aria2 version is capable of checking hashes
      • Aria2 version is removing cached file with $use_cache set to $false
      1. Create new function Initialize-Download ([String[]] $Url, [Switch] $UseCache, [Switch] $CheckHash)
        • This function will be only wraper, which will look like this:

          $paramsSplat = @{usecache, ...}
          if (aria2-enabled) { dl_witch_cache_aria2 @paramsSplat }
          elseif (curl-enabled) { dl_witch_cache_curl @paramsSplat } # Easier to maintain new download managers
          else { dl_witch_cache @paramsSplat }
        • This will save some lines, where you check for aria2 enabled in updates, install etc, ...

        • This wrapper will be called for dowloading instead of dl

        • Also it will allow binaries to use prefered manager without touching binary for each new download manager with some if

  3. install_app function refactor
  4. Adopt new download function in whole codebase (binaries, etc..)
r15ch13 pushed a commit that referenced this issue Mar 7, 2019
This is temporary solution for #2220 until whole install.ps1 refactor is done to make this tweak easily, in the best way one-liner.

- One step closer to #3149
- Closes #2220
- Closes #2343
- Closes #1605
@Ash258 Ash258 closed this as completed Jul 8, 2020
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