39 Commits

Author SHA1 Message Date
abgox ca0506cf3e refactor(output): Replace raw prints with functions for standardized output (#6449)
Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
2025-09-29 15:12:10 +08:00
Hsiao-nan Cheung 83f25a4673 fix(install): Expand env_set items (#6050) 2024-07-09 00:24:42 +08:00
Hsiao-nan Cheung 5819b5a1ef feat(path): Isolate Scoop apps' PATH (#5840) 2024-04-18 19:14:53 +08:00
Hsiao-nan Cheung 6772e61b3d refactor(core): Rewrite and separate path-related functions to system.ps1 (#5836) 2024-03-27 17:32:39 +08:00
Bill ZHANG 7e81e49152 fix(scoop-reset): Don't abort when multiple apps are passed and an app is running (#5687)
* fix(scoop-reset): change #2952 fix to be the same with scoop-install

* update changelog

* Update CHANGELOG.md

Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>

---------

Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
2023-10-26 12:58:10 +05:30
Hsiao-nan Cheung 1985a05b59 refactor(path): Use 'Convert-Path()' instead of 'Resolve-Path()' (#5109) 2022-08-22 15:12:46 +08:00
Rashil Gandhi 9811a5f853 feat(chore): Add missing -a/--all param to all commands (#5004)
* feat(scoop-reset): Add -a/--all switch to reset all apps

* feat(scoop-cache): Add -a/--all switch to delete whole cache

* feat(scoop-virustotal): Add -e/--every switch to check every installed app

* Update CHANGELOG.md

* use 'all' instead of 'every'
2022-06-22 15:47:31 +05:30
Hsiao-nan Cheung 6296822f1f perf(scoop): Load libs only once (#4839) 2022-04-21 21:34:26 +08:00
Hsiao-nan Cheung 5a795caca5 refactor(reset_aliases): Move core function of reset_aliases to scoop (#4794) 2022-03-11 18:10:04 +08:00
HUMORCE 63b858c41f style: Use correct casing for $PSScriptRoot (#4775) 2022-03-04 22:55:45 +08:00
Xavier Young 4047d6962c perf(install): Avoid checking all files for unlink persisted data (#4681) 2022-02-25 10:08:07 +08:00
CrendKing 14854c3548 feat(config): Allow Scoop to ignore running processes during reset/uninstall/update (#4713)
Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
2022-02-11 13:55:42 +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
Rashil Gandhi 6c340cb7e3 Merge pull request #4013 from sinloss/patch-1
Fix #4000, handle arch-specific env_add_path
2021-11-01 10:55:27 +05:30
FriendlyNeighborhoodShane 0920050464 reset: skip when app instance is running (#4359)
The issue is the same as for #2952, workaround until the proper
solution is implemented. The code is also directly copied from there.

Fixes #4310
2021-05-20 17:50:06 +02:00
liuxy 91ea657923 Apply the suggestions from @Ash258 2020-06-09 09:38:22 +08:00
lxy 3188115369 Fix #4000, handle arch-specific env_add_path 2020-06-08 10:16:47 +08:00
Richard Kuhnt 4ec576a859 refactor(bin/libexec): remove config.ps1 imports 2019-05-10 12:16:36 +02: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
Jakub Čábera 4da8e3df5f Persist data on reset (#2773)
- Closs #2765
2018-11-29 00:10:35 -08:00
Richard Kuhnt 70f64c8f4b Refactor app() to parse_app() for better "bucket/app@version" handling (#2234)
It now parses these app names:
- php-bucket/php71-amqp@1.8.0
- php-bucket/php71-amqp
- php71-amqp@1.8.0
- php71-amqp@1.9.0-rc2

Removed:
- is_app_with_specific_version()
- get_app_with_version()
2018-05-04 21:51:43 +02:00
Steve Baker 31075f6200 Clean up some error messages (#2032)
Removes extra 'ERROR' in text where the `error` method is used.
Converts some `write-host "error message"` to use the `error` method
Converts some `write-host "error message"; exit 1` to use the `abort`
method.
2018-03-12 18:32:57 +01:00
Chawye Hsu e1bb1e91d0 Lint: PSAvoidUsingCmdletAliases (#2075) 2018-03-03 18:41:19 +01:00
Richard Kuhnt 7176719501 Improve reset command
Allow resetting:
* global apps
* multiple apps
* all apps by using * parameter (skips global apps if not admin)
2018-02-16 14:34:52 +01:00
Richard Kuhnt 5f8577dda7 Add missing exit codes to various scoop commands 2017-12-15 00:31:37 +01:00
Simon Hartcher e799eb1717 Allow resetting of specific version installs 2017-03-31 20:03:13 +11:00
Luke Sampson 6e5b7e57bb Reset: Re-create shortcuts (fixes #1406) 2017-03-27 17:22:56 +11:00
Luke Sampson d2a8f6798f Update UI messages for consistency. 2017-02-13 20:25:56 +11:00
Luke Sampson 1c173bc56d Use sentence case for UI messages. 2017-02-13 20:20:41 +11:00
mrkishi c5f95975c6 Fix scoop-reset's undefined get_config error 2017-01-30 09:00:02 -02:00
Luke Sampson abd6d0e6c5 Use a 'current' directory junction for the current version of apps, so that path is maintained across app updates (see #1179) 2016-12-31 22:12:53 +11:00
Luke Sampson 0bcb44a281 implement architecture-specific shims 2016-06-24 07:22:04 +10:00
Roy Ivy III 6d9bca805f whitespace cleanup
* makes changes to almost all main repo files to be in accordance with .editorconfig
* some files in "test\fixtures\..." were left alone to avoid breaking tests
* NOTE: whitespace changes *only* (`git diff -b` shows no changes)
2015-08-17 22:54:43 -05:00
Luke Sampson bc1a8e4945 brute force fix for powershell alias problems 2015-05-11 20:17:59 +10:00
Simon Hartcher 24347c2afb Revert "Add ability to reset scoop (also adds Git Bash support)" 2015-05-10 12:05:11 +10:00
Simon Hartcher 3538788132 Add support for resetting scoop 2015-05-09 21:52:21 +10:00
Luke Sampson 7041a3a576 fix for #122: 'scoop reset' incorrectly used ~ rooted paths for environment variables 2014-06-25 13:11:21 +10:00
Luke Sampson 555e189d33 beginning refactoring for global installs 2013-08-30 16:58:20 +10:00
Luke Sampson 2982dc5fea add scoop reset command 2013-08-27 16:14:20 +10:00