Commit Graph

144 Commits

Author SHA1 Message Date
Hsiao-nan Cheung d5cb86078b fix(decompress): Fix nested Zstd archive extraction (#4608) 2021-12-31 01:04:47 +08:00
Hsiao-nan Cheung 271d41b949 style(test): Format scripts by VSCode's PowerShell extension (#4609) 2021-12-30 09:37:40 +08:00
Hsiao-nan Cheung 5602083868 fix(schema): Add 'license' definition (#4596)
* fix(schema): Add 'license' definition

Fix AppVeyor error

* Fix 'Manifest.Tests'
2021-12-26 23:01:44 +08:00
Hsiao-nan Cheung 1dbab1fee8 Merge branch 'develop' into 'master' (#4594)
Related PRs:
- #4531 @filmor 
  - ac71fcc @niheaven 
- #4535 @rashil2000 
- #4522 @pratikpc 
- #4550 @niheaven 
- #4528 @niheaven 
- #4532 @MrNuggelz
- #4155 @MrNuggelz Co-authored-by: @rashil2000 
  - #4581 @niheaven 
  - fb496c4 @rashil2000 
- #4543 @rashil2000 Co-authored-by: @niheaven 
  - #4555 @rashil2000 
  - 3c90d1a @rashil2000 
  - 2ec00d5 @rashil2000 
- #4567 @rashil2000 
  - cbe29ed @rashil2000 
- #4570 @niheaven 
  - #4582 @niheaven 
- #4571 @niheaven 
- #3244 @nickbudi 
- #3821 @jfastnacht Co-authored-by: @rasa 
- #4578 @tukanos
- #4579 @rashil2000 

Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
Co-authored-by: Jakub Čábera <cabera.jakub@gmail.com>
Co-authored-by: Ross Smith II <ross@smithii.com>
Co-authored-by: Benedikt Reinartz <filmor@gmail.com>
Co-authored-by: Joris <MrNuggelz@users.noreply.github.com>
Co-authored-by: Pratik Chowdhury <pratikc@live.co.uk>
Co-authored-by: Rashil Gandhi <rashil2000@gmail.com>
Co-authored-by: nickbudi <nickbudi@users.noreply.github.com>
Co-authored-by: Julian <github@fastnacht.consulting>
Co-authored-by: tukanos <patrik.svestka@gmail.com>
2021-12-25 23:09:49 +08:00
Hsiao-nan Cheung e663027299 fix(test): Add more test cases for versions 2021-11-15 13:32:25 +08:00
Hsiao-nan Cheung ae89213842 fix(versions): Fix situation that contains '_' 2021-11-15 13:22:04 +08:00
Hsiao-nan Cheung 77d00d1771 refactor(versions): Refactor 'versions.ps1' (#3721)
Co-authored-by: Jakub Čábera <cabera.jakub@gmail.com>
Co-authored-by: David Duque <david.f.s.duque@tecnico.ulisboa.pt>
2021-11-14 00:44:58 +08:00
Hsiao-nan Cheung 47ebc6f176 fix(test): Use 32bit version of zstd 2021-11-10 16:42:57 +08:00
worldyun af7a6f6d0e feat(decompress): Support Zstandard archive (#4372)
Co-authored-by: WorldYun <worldyun@qq.com>
Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
2021-11-10 09:40:11 +08:00
Jakub Čábera 6df80c1aee fix(tests): Force pester v4 (#4040) 2020-07-01 10:23:44 +02:00
Hsiao-nan Cheung 5643818e1b Revert 'Compare-Version' (#3333, #3578) (#3648) 2019-10-18 13:32:06 +02:00
Jakub Čábera f52b339523 feat(tests): Do not force maintainers to have SCOOP_HELPERS (#3604) 2019-08-21 17:17:26 +02:00
Hsiao-nan Cheung 3ca08a5ae8 fix(versions): Hotfix for #3333 (#3578)
* fix(versions): Hotfix for #3333
2019-08-02 11:52:14 +02:00
Hsiao-nan Cheung 1508d2ab00 fix(versions): Refactor compare_versions -> Compare-Version (#3333)
fix #3329 
fix #2981 
fix #2720 
fix lukesampson/scoop-extras#2106
close #3469
2019-07-31 15:36:19 +02:00
Richard Kuhnt 7699beafc0 fix(config): Remove config.ps1 imports 2019-05-10 12:16:36 +02:00
Richard Kuhnt 630ba04ecd fix(config): More tests for set_config 2019-05-10 12:16:36 +02:00
Richard Kuhnt d17b4e5a85 fix(config): Test for DateTime object instead for actual Time 2019-05-10 12:16:36 +02:00
Richard Kuhnt 8dd68f61b0 fix(config): fix datetime tests for PowerShell 6 2019-05-10 12:16:36 +02:00
Richard Kuhnt 40d83d924a refactor(config): Add more tests for load_config and get_config 2019-05-10 12:16:36 +02:00
Richard Kuhnt f7a9cd9ceb refactor(config): Move configuration handling to core.ps1
- Migrate ~\.scoop to ~\.config\scoop\config.json
- Remove hashtable and hashtable_val functions because ConvertFrom-Json is enough
- Add PowerShell 6 time conversion to tests
2019-05-10 12:16:36 +02:00
Richard Kuhnt 8beffc4329 Sync renaming changes to develop 2019-05-06 18:19:57 +02:00
Richard Kuhnt 618824e46d Sync missing hotfix #3427 to develop 2019-05-01 21:45:46 +02:00
Dave Neeley abcb59ca35 Expand-ZipArchive: Compatible with Pscx (was missing tests) (#3427)
Extension to https://github.com/lukesampson/scoop/pull/3425
2019-05-01 21:45:03 +02:00
Richard Kuhnt f58fdaa7f2 refactor(tests): Check checksum of TestCases.zip before extracting 2019-05-01 14:17:49 +02:00
Richard Kuhnt 010546cf26 refactor(core): Combine helpers to Get-HelperPath and Test-HelperInstalled 2019-05-01 14:17:49 +02:00
Richard Kuhnt 501d4b4d35 refactor(decompress): Change function name casing
7zip_path -> Get-7zipPath
7zip_installed -> Test-7zipInstalled
Expand-7ZipArchive -> Expand-7zipArchive
Test-7ZipRequirement -> Test-7zipRequirement
Expand-MSIArchive -> Expand-MsiArchive
Test-LessMSIRequirement -> Test-LessmsiRequirement
2019-05-01 14:17:49 +02:00
Richard Kuhnt f63219fd1d decompress(tests): Improve installation of lessmsi and innounp (#3409) 2019-04-28 19:00:02 +02:00
Hsiao-nan Cheung a757dea15e refactor(cmd_available/Get-Command): Add Test-CommandAvailable function (#3314) 2019-04-28 18:53:00 +02:00
Richard Kuhnt ff15d1d69f decompress(tests): Use BeforeAll to setup variables and install dependencies 2019-04-26 20:36:19 +02:00
Richard Kuhnt f919a3c7c1 decompress(tests): Skip already installed app 2019-04-26 20:35:26 +02:00
Hsiao-nan Cheung 72730e0d73 decompress.ps1: Refactor extraction handling functions (#3204)
* Refactored functions:
  * requires_7zip > Test-7ZipRequirement
  * requires_lessmsi > Test-LessMSIRequirement
  * extract_7zip > Expand-7ZipArchive
  * extract_msi/extract_lessmsi > Expand-MSIArchive
  * unpack_inno > Expand-InnoArchive
  * extract_zip/unzip_old > Expand-ZipArchive
* Fix 7zip failed when .tar and .tgz have diff names
* Add tools to CI
* Add test cases for Expand-7ZipArchive
* Add test cases for Expand-InnoArchive
* Add test cases for Expand-MSIArchive
* Add config `7ZIPEXTRACT_USE_EXTERNAL`
* Change '$recurse' to '$removal'
2019-04-26 18:35:59 +02:00
Hsiao-nan Cheung 5f91682a79 decompress.ps1: Refactored (w/ install.ps1, core.ps1) (edited) (#3169)
* decompress.ps1: Refactored (w/ install.ps1, core.ps1)

* fix install.ps1
2019-03-07 22:14:06 +01:00
Richard Kuhnt 7bedd449b5 validator: Improve error reporting, add support for multiple files
- Display clickable links to directly jump to error line
- Display invalid JSON path
- Dynamic error nesting
- Support for validation multiple files 
  e.g. `validator.exe .\schema.json .\bucket\*.json`
  or `validator.exe .\schema.json .\manifest1.json .\manifest2.json`
2019-02-24 13:20:44 +01:00
Vladimir Chebotarev da64301b8b [core] Allowed underscores in package names. (#2930)
* Allowed underscores in package names.

* Added tests for underscores in package names.
2019-02-22 19:12:48 +01:00
Chawye Hsu d23552a5a5 Rewritten data persisting feature (#2897)
**Data matters, please review**

This is a rework of #2891 #2890 and #2882 . This will also fix #2724 and fix #2900 , close #2779 

**Introduction**

I add a function called `unlink_persist_data($dir)`, which recursively unlink all junction/hard link in the given directory. This affects some sub-commands which have interaction with junction/hard link:

- `scoop-install`: the persisting logic has been improved as follow:
  1. if there are data in the `persist` folder, also in app(`source`) folder, rename that one located in app folder (e.g. app's default setting files) with a `original` suffix, then create link from `persist` to  app
  2. if there are data in the `persist` folder, but no in app(`source`) folder, just create link from `persist` to  app
  3. if there is no data in the `persist` folder (e.g. fresh install), but there are data in app(`source`) folder (e.g. app's default setting files), we will just use that default setting files as the first-time persisting. So move that files from app folder to `persist` folder, then create link from `persist` to  app
  4. But what if if there is neither data in the `persist` folder (e.g. fresh install), nor in the app(`source`) folder (e.g. setting files will be created after first startup, like `Everthing.db`). We need to create empty persisting target in the `persist` folder. But by default we can't know if a persisting target is a file or a directory (e.g. `conf.d`). So we create a directory by default, and to avoid this, manifest maintainers should use `pre_install` to manually create the source file before persisting.
- `scoop-reset`: `reset` command uses the logic of `install`, but there is a problem: before re-persisting data, there have been `junction/hard link` in the app(`source`) folder. It will throw an exception of file exists #2724 . To fix this, we should unlink all old link before re-persisting, using `unlink_persist_data`.
- `scoop-uninstall`: `Remove-Item` can not remove `NTFS junction`, we need to unlink all persistting data, before uninstalling/deleting an app, but keeping persisting data.
- `scoop-cleanup`: like `uninstall`, `Remove-Item` can not remove `NTFS junction`, we need to unlink all persistting data, before deleting old versions of an app. Before PR #2882 , it use `fsutil.exe` to unlink junction, which is not friendly to restricted users (#2832 and #2881 ).

Beyond the logic improvement, there is a new feature now: it supports sub-folder data persisting, like:

```json
{
    "homepage": "https://scoop.sh",
    "description": "A dummy manifest for scoop tests.",
    "license": "Freeware",
    "version": "1.1.0",
    "url": "https://get.scoop.sh",
    "pre_install": [
        "if (!(test-path \"$dir\\dummy.txt\")) { new-item -force \"$dir\\dummy.txt\" -itemtype file | out-null }",
        "if (!(test-path \"$dir\\dummydir\")) { new-item \"$dir\\dummydir\" -itemtype directory | out-null }",
        "if (!(test-path \"$dir\\subdir\")) { new-item \"$dir\\subdir\" -itemtype directory | out-null }",
        "if (!(test-path \"$dir\\subdir\\subdummydir\")) { new-item \"$dir\\subdir\\subdummydir\" -itemtype directory | out-null }",
        "if (!(test-path \"$dir\\subdir\\subdummy.txt\")) { new-item -force \"$dir\\subdir\\subdummy.txt\" -itemtype file | out-null }",
    ],
    "persist": [
        "dummy.txt",
        "dummydir",
        "subdir\\subdummydir",
        "subdir\\subdummy.txt"
    ]
}
```
So no need to strip directories of source for target anymore.

To participate in the code review and tests, go visit https://github.com/h404bi/scoop-persist-test for test cases.
2019-01-17 18:00:29 +01:00
Richard Kuhnt 589303facc tests: Fix manifest tests for buckets
- Fixes a bug introduced with 478f52c421 that broke manifest tests on other buckets
- Allows testing "bucket" subdirectory for buckets
2018-12-22 15:05:08 +01:00
Richard Kuhnt 478f52c421 tests: Add importable tests for Buckets 2018-12-16 15:55:32 +01:00
Richard Kuhnt 7b7113fc3b tests: Move style constraints tests to separate test file
- This allows importing these tests in other buckets
- Simpler UTF-8 BOM reading function
2018-12-16 15:53:05 +01:00
Richard Kuhnt 53e73f5211 appveyor: Remove trailing comma from params
Regression from f857dce9f5
2018-12-16 14:51:52 +01:00
Richard Kuhnt f857dce9f5 appveyor: Add -TestPath param to test.ps1 2018-12-16 14:49:53 +01:00
Richard Kuhnt 7a1b5a1840 appveyor: Force install PSScriptAnalyzer and BuildHelpers 2018-12-16 14:13:16 +01:00
Richard Kuhnt dde4d0f93f appveyor: Update BuildHelpers to version 2.0.1 2018-12-16 14:11:36 +01:00
Jakub Čábera 3e1649553d formatjson.ps1: Format single value Arrays into String (#2642)
- Automatically convert single value arrays and recursively normalize PSObjects values
- Add tests
- Add .yml .editorconfig settings
2018-11-13 20:49:20 +01:00
Kevin Marquette c0dce0e8cd Use Pester 4.0 syntax to multiple files (#2714) 2018-10-29 14:59:03 +01:00
Kevin Marquette b37349a531 Use pester 4.0 syntax to the install tests (#2713)
This PR updates the `should` Pester calls with the 4.0 syntax in the `Scoop-Install.Tests.ps1` file
2018-10-29 14:58:51 +01:00
Kevin Marquette 9d6c02ac68 Use pester 4.0 syntax in core tests (#2712) 2018-10-29 14:58:29 +01:00
Richard Kuhnt ac3ee76672 appveyor: require BuildHelpers version 2.0.0 2018-09-18 18:47:42 +02:00
Richard Kuhnt c0295f0ae0 appveyor: Run tests for PowerShell 5 and 6 (#2603)
- Adds `!linter` commit flag to skip PSScriptAnalyzer
- Adds `!manifests` commit flag to skip manifest validation
- Skips manifest validation if no JSON has changed
- Skips tests and linting if no PowerShell script has changed
- Validates only manifests that changed
- Validates all manifests if `schema.json` changed
2018-09-18 18:37:43 +02:00
Leon Yu 9bc7d5f8b3 Fix .ps1 shim parsing logic due to prior PR (#2564)
Due to my prior PR #2562 which changed the content of .ps1 shims, the code that attempts to warn about shims being overwritten no longer detects app name correctly. This is to correct that.
2018-09-07 16:25:37 +02:00
Richard Kuhnt 4ed6265ed7 Add some tests for scoop config 2018-08-07 20:11:38 +02:00