Skip to content

Commit

Permalink
Merge branch 'Elttob:main' into docs-fix-2
Browse files Browse the repository at this point in the history
  • Loading branch information
krypt102 authored Feb 6, 2023
2 parents eaf02ea + f214a91 commit 57526bc
Show file tree
Hide file tree
Showing 91 changed files with 977 additions and 1,466 deletions.
95 changes: 3 additions & 92 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
name: CI

on:
pull_request:
push:

env:
ROBLOSECURITY: ${{ secrets.ROBLOSECURITY || '_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_F197F1B95A448B8B2DEA5DC398DB75C2ED1D73C44EF0380BEB5F1752D8C002027BFF436577C6D57F4137242491CD603999DB702C5FFC7E029FB39125158EA3571116A36B94D8EC1C4CA4E17BC2FA7D284DECA5441CA3327565B2261EF20DA0CBBA5DE000320BF1FF01166003B8EC6831BAD3AFF07D81D3350BA16DC5474C85A31F3E78FBDE8DAF1285922CD0306DA3C55A37E122CB83029AC933B3C997C27F3B1CAD7A593D9153EA1F0A65DCF4DD5E5EA7F0C485E4465F9F69282EAA3D223AB75E2304F6E08AFB74482C4F6FC5DFA680D8C6F7E96C4177612B6F763C4DB869FD8870700493F50006494253E2EE16424C1104FEE364856165B33E3CECEE9096C8266E5BCD575E4E7BAC282A3B0BA3772125A4B2027262E826BE2E05FA0F34E6F9568FC85E69ECFFDCBBF74852A38D43468CEC6FE45BACB6892A857298E66438AE7A6C2BFA8B9BC84B0B4DB94DC14C051C6AA199ACF783409E978C17E6DD3E5D622548FA3CED793C9C78F6235DF09A689D272B1B71CB98AC589F9C03B0950A9C9A9E8C6F35' }}
branches:
main

jobs:
lint:
Expand All @@ -23,91 +21,4 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run Selene
run: selene src test benchmark
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Run StyLua check
uses: JohnnyMorganz/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --check src test benchmark
unit-tests:
name: Unit Tests
runs-on: windows-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Install Foreman
uses: rojo-rbx/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build test place
run: rojo build test-runner.project.json -o test.rbxl

- name: Download OpenVPN
run: choco install openvpn

- name: Run OpenVPN
run: Start-Process -FilePath "C:\\Program Files\\OpenVPN\\bin\\openvpn.exe" -ArgumentList "--config $((Resolve-Path .\\fusion.ovpn).Path)"

- name: Poll for IP Change
run: |
$elapsed = 0
while ($true) {
try {
$response = Invoke-WebRequest -Uri 'https://httpbin.org/ip' -Method GET -UseBasicParsing
$content = ConvertFrom-Json $response.Content
if ($content.origin -eq "104.238.130.74") {
break
}
} catch {}
if ($elapsed -ge 25) {
Write-Error "Timeout reached!"
exit 1
}
Write-Output "Polling.. Elasped: $elapsed, IP: $($content.origin)"
Start-Sleep 5
$elapsed += 5
}
Write-Output "Success!"
- name: Validate Cookie
run: |
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$cookie = New-Object System.Net.Cookie
$cookie.Name = ".ROBLOSECURITY"
$cookie.Value = "${{ env.ROBLOSECURITY }}"
$cookie.Domain = ".roblox.com"
$session.Cookies.Add($cookie);
Invoke-WebRequest "https://avatar.roblox.com/v1/avatar" -WebSession $session -UseBasicParsing
- name: Install Roblox Studio
uses: OrbitalOwen/[email protected]
with:
# This cookie is intentionally public, because secrets are not available in pull request CI runs
# It is from an empty account and not a security vulnerability
cookie: ${{ env.ROBLOSECURITY }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
shell: bash
run: run-in-roblox --place test.rbxl --script test-runner/Run.client.lua > test-out.txt
continue-on-error: true

- name: Screenshot
if: failure()
uses: OrbitalOwen/[email protected]
with:
file-name: 'desktop.jpg'

- name: Check test status
shell: bash
run: cat test-out.txt | grep "0 failed, 0 skipped" || (cat test-out.txt && exit 1)
run: selene src test benchmark
23 changes: 0 additions & 23 deletions benchmark/Dependencies/captureDependencies.bench.lua

This file was deleted.

26 changes: 2 additions & 24 deletions docs/api-reference/animation/spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ just snap to the goal value.

```Lua
(
goal: StateObject<T>,
speed: CanBeState<number>?,
goal: StateObject<T>,
speed: CanBeState<number>?,
damping: CanBeState<number>?
) -> Spring<T>
```
Expand All @@ -40,28 +40,6 @@ without overshooting or oscillating. Defaults to `1`.

## Methods

<p class="fusiondoc-api-pills">
<span class="fusiondoc-api-pill-since">since v0.1</span>
</p>

### :octicons-code-24: Spring:get()

Returns the current value stored in the state object.

If dependencies are being captured (e.g. inside a computed callback), this state
object will also be added as a dependency.

```Lua
(asDependency: boolean?) -> T
```

#### Parameters

- `asDependency` - If this is explicitly set to false, no dependencies will be
captured.

-----

<p class="fusiondoc-api-pills">
<span class="fusiondoc-api-pill-since">since v0.2</span>
</p>
Expand Down
31 changes: 3 additions & 28 deletions docs/api-reference/animation/tween.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ just snap to the goal value.

```Lua
(
goal: StateObject<T>,
goal: StateObject<T>,
tweenInfo: CanBeState<TweenInfo>?
) -> Tween<T>
```
Expand All @@ -34,35 +34,11 @@ to `TweenInfo.new()`.

-----

## Methods

<p class="fusiondoc-api-pills">
<span class="fusiondoc-api-pill-since">since v0.1</span>
</p>

### :octicons-code-24: Tween:get()

Returns the current value stored in the state object.

If dependencies are being captured (e.g. inside a computed callback), this state
object will also be added as a dependency.

```Lua
(asDependency: boolean?) -> T
```

#### Parameters

- `asDependency` - If this is explicitly set to false, no dependencies will be
captured.

-----

## Example Usage

```Lua
local position = Value(UDim2.fromOffset(25, 50))
local smoothPosition = Spring(position, 25, 0.6)
local smoothPosition = Tween(position, TweenInfo.new(2))

local ui = New "Frame" {
Parent = PlayerGui.ScreenGui,
Expand All @@ -71,7 +47,6 @@ local ui = New "Frame" {

while true do
task.wait(5)
-- apply an impulse
smoothPosition:addVelocity(UDim2.fromOffset(-10, 10))
position:set(peek(position) + UDim2.fromOffset(100, 100))
end
```
26 changes: 26 additions & 0 deletions docs/api-reference/errors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,32 @@ colourSpring:addVelocity(Vector2.new(2, 3))

-----

<div class="fusiondoc-error-api-section" markdown>
<p class="fusiondoc-api-pills">
<span class="fusiondoc-api-pill-since">since v0.3</span>
</p>

## stateGetWasRemoved

```
`StateObject:get()` has been replaced by `use()` and `peek()` - see discussion #217 on GitHub.
```

This message means you attempted to call the now-removed `:get()` method on a
[state object](../state/stateobject.md). Starting with Fusion 0.3, this method
has been removed in favour of the [peek function](../state/peek.md) and
[use callbacks](../state/use.md).

[Learn more by visiting this discussion on GitHub.](https://github.com/Elttob/Fusion/discussions/217)

```Lua
local value = Value(5)
print(value:get()) -- should be print(peek(value))
```
</div>

-----

<div class="fusiondoc-error-api-section" markdown>
<p class="fusiondoc-api-pills">
<span class="fusiondoc-api-pill-since">since v0.1</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/instances/attributeout.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ New "Configuration" {
}

Observer(ammo):onChange(function()
print("Current ammo:", ammo:get())
print("Current ammo:", peek(ammo))
end)
```
5 changes: 1 addition & 4 deletions docs/api-reference/instances/children.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ local child2 = New "Folder" {
Name = "Child two"
}

local childState = State(child1)
local childState = Value(child1)

local parent = New "Folder" {
[Children] = childState
Expand All @@ -117,9 +117,6 @@ print(parent:GetChildren()) -- { Child two }
When using state objects, note that old children *won't* be destroyed, only
unparented - it's up to you to decide if/when children need to be destroyed.

If you're using a helper like [ForValues](../../state/forvalues), instance
cleanup is handled for you by default (though this is configurable).

-----

## Technical Details
Expand Down
8 changes: 4 additions & 4 deletions docs/api-reference/instances/hydrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ value of the object changes, the property will update to match on the next
resumption step:

```Lua
local myName = State("Bob")
local myName = Value("Bob")

local example = Hydrate(workspace.Part) {
-- initially, the Name will be set to Bob
Expand All @@ -93,6 +93,6 @@ local example = Hydrate(workspace.Part) {
myName:set("John")
```

Special keys, such as [Children](../children) or [OnEvent](../onevent), may also
be used as keys in the property table. For more information about how special
keys work, [see the SpecialKey page.](../../types/specialkey)
Special keys, such as [Children](./children.md) or [OnEvent](./onevent.md), may
also be used as keys in the property table. For more information about how
special keys work, [see the SpecialKey page.](./specialkey.md)
6 changes: 3 additions & 3 deletions docs/api-reference/instances/new.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ local example = New "Part" {
myName:set("John")
```

Special keys, such as [Children](../children) or [OnEvent](../onevent), may also
be used as keys in the property table. For more information about how special
keys work, [see the SpecialKey page.](../../types/specialkey)
Special keys, such as [Children](./children.md) or [OnEvent](./onevent.md), may
also be used as keys in the property table. For more information about how
special keys work, [see the SpecialKey page.](./specialkey.md)

-----

Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/instances/out.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ New "TextBox" {
}

Observer(userText):onChange(function()
print("The user typed:", userText:get())
print("The user typed:", peek(userText))
end)
```
2 changes: 1 addition & 1 deletion docs/api-reference/instances/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ New "Part" {
[Ref] = myRef
}

print(myRef:get()) --> Part
print(peek(ref)) --> Part
```

-----
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/state/canbestate.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ local function printItem(item: CanBeState<string>)
print("Got constant: ", item)
else
-- state object
print("Got state object: ", item:get())
print("Got state object: ", peek(item))
end
end

Expand Down
Loading

0 comments on commit 57526bc

Please sign in to comment.