Skip to content

Commit

Permalink
docs: screenshot check_for_new_release & container_detection
Browse files Browse the repository at this point in the history
  • Loading branch information
edouard-lopez committed Feb 16, 2024
1 parent 3d39ad3 commit c3bdafd
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 34 deletions.
18 changes: 17 additions & 1 deletion docs/components/features-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,30 @@
set --universal pure_check_for_new_release false
```

=== "Enabled (with update)"

![screenshot pure_check_for_new_release=true,with-update](../assets/screenshots/pure_check_for_new_release=true,with-update.png)

=== "Enabled (no update)"

![screenshot pure_check_for_new_release=true,no-update](../assets/screenshots/pure_check_for_new_release=true,no-update.png)

### Container Detection (Docker)

| Option | Default | Description |
| :------------------------------------ | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`pure_enable_container_detection`** | `true` | `false`: Do not check _pure_ runs inside a container (e.g. `docker`, `podman`, `LXC`/`LXD`, etc.).<br/>:warning: Detection is a bit [tricky across OSes][container-detection]. |
| **`pure_symbol_container_prefix`** | | Prefix when being inside a container ([to customize][to-set]) |

[container-detection]: https://stackoverflow.com/q/23513045/802365
[container-detection]: <https://stackoverflow.com/q/23513045/802365>

=== "Enabled (inside a container)"

![screenshot pure_enable_container_detection=true,inside](../assets/screenshots/pure_enable_container_detection=true,inside.png)

=== "Enabled (outside a container)"

![screenshot pure_enable_container_detection=true,outside](../assets/screenshots/pure_enable_container_detection=true,outside.png)

### Current Working Directory

Expand Down
65 changes: 32 additions & 33 deletions tests/screenshot.test.doc.fish
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
source (status dirname)/fixtures/constants.fish
source (status dirname)/mocks/spectra.fish

@echo (_print_filename (status filename))

function before_each
_purge_configs
source ../conf.d/pure.fish
source (status dirname)/../conf.d/pure.fish
_clean_all_mocks
end

function screenshot \
Expand All @@ -12,7 +15,7 @@ function screenshot \
name \
action

set --query action; or set action fish_prompt
set --query action[1]; or set action fish_prompt


$action \
Expand All @@ -23,45 +26,41 @@ function screenshot \
# --background-color white # some text are invisible with white background
end

function boolean_test \
--description "Take screenshot" \
--argument-names \
name \
setup_context \
value \
action
if set --query CI
before_each
@test "screenshot: pure_check_for_new_release=true,with-update" (
set --universal pure_check_for_new_release true
set --global pure_version 0.0.1
_mock_response curl '"tag_name": "v9.9.9",'

screenshot "pure_check_for_new_release=true,with-update" _pure_check_for_new_release

) $status -eq $SUCCESS

echo $value
echo $action
echo $setup_context
before_each
@test "screenshot `$name $value`" (
$setup_context
set --universal $name $value
screenshot "$name=$value" $action
@test "screenshot: pure_check_for_new_release=true,no-update" (
set --universal pure_check_for_new_release true
set --global pure_version 0.0.1
_mock_response curl '"tag_name": "v0.0.1",'

screenshot "pure_check_for_new_release=true,no-update" _pure_check_for_new_release
) $status -eq $SUCCESS
end


if set --query CI
function setup
set --universal pure_check_for_new_release true
set --universal pure_version 0.0.1
function curl
echo '"tag_name": "v0.0.1",'
end # mock
end
# boolean_test pure_check_for_new_release setup false _pure_check_for_new_release
before_each
@test "screenshot `pure_check_for_new_release true`" (
set --universal pure_check_for_new_release true
set --universal pure_version 0.0.1
function curl
echo '"tag_name": "v0.0.1",'
end # mock
@test "screenshot: pure_enable_container_detection=true,inside" (
set --universal pure_enable_container_detection true
set --universal pure_symbol_container_prefix "🐋"

screenshot "pure_check_for_new_release=true" _pure_check_for_new_release
screenshot "pure_enable_container_detection=true,inside"
) $status -eq $SUCCESS

before_each
@test "screenshot: pure_enable_container_detection=true,outside" (
set --universal pure_enable_container_detection true
_mock_exit_status _pure_is_inside_container $FAILURE

screenshot "pure_enable_container_detection=true,outside"
) $status -eq $SUCCESS


Expand Down

0 comments on commit c3bdafd

Please sign in to comment.