Skip to content

Commit

Permalink
Modernize the repository (#3)
Browse files Browse the repository at this point in the history
* lib -> src

* Foreman

* Wally

* Remove roblox.toml

* Remove use of submodules

* Update LICENSE

* Setup unit test runner again

* Add workflows

* Add TestEZ globals

* Remove old test runner

* Filter out mocks

* Fix Selene errors

* StyLua pass

* Update README

* Mount the example

* Tidy up the example

* Rename example
  • Loading branch information
vocksel authored Dec 18, 2021
1 parent 027356f commit 7877864
Show file tree
Hide file tree
Showing 28 changed files with 518 additions and 9,228 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
branches:
- main
pull_request:
schedule:
# Every day at 8pm UTC (12am PST)
- cron: "0 20 * * *"

jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Foreman dependencies
uses: Roblox/setup-foreman@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Lint
run: |
selene generate-roblox-std
selene src/
- name: Format
run: stylua --check src/

tests:
runs-on: windows-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install toolchain
uses: Roblox/setup-foreman@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: wally install

- name: Build place file
run: rojo build dev.project.json -o studio-tests.rbxlx

- name: Install Roblox Studio
uses: OrbitalOwen/[email protected]
with:
cookie: ${{ secrets.ROBLOSECURITY }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: run-in-roblox --place studio-tests.rbxlx --script tests/spec.lua
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
release:
types: [published]

env:
OUTPUT_NAME: "ContextControls.rbxm"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install toolchain
uses: Roblox/setup-foreman@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Remove spec files
run: rm -rf **/*.spec.lua

- name: Build
run: rojo build -o ${{ env.OUTPUT_NAME }}

- name: Add model file to release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.OUTPUT_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/*.rbxlx
/*.rbxmx
# Rojo
/*.rbxl*
/*.rbxm*

# This is where you can store custom configuration settings for the game.
src/shared/configLocal.lua
# Selene
roblox.toml

# Wally
/Packages
/DevPackages
wally.lock
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2019 David Minnerly
Copyright 2021 David Minnerly

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@
Wrapper around ContextActionService that provides a clean API for creating and
binding actions, along with flexible mobile button support.

## Getting Started
## Installation

### Wally

Add the following to your `wally.toml`:

```
[dependencies]
ContextControls = "vocksel/[email protected]
```

### Model File

* Download a copy of the rbxm from the [releases page](https://github.com/vocksel/context-controls/releases/latest) under the Assets section.
* Drag and drop the file into Roblox Studio to add it to your experience.

## Usage

```lua
local ContextControls = require(game.ReplicatedStorage.ContextControls)
Expand Down Expand Up @@ -251,3 +267,7 @@ take control of binding and unbinding it.

If you use this method, it is recommended that you do not manually bind and
unbind the action, as this could lead to unexpected results.

## License

[MIT License](LICENSE)
48 changes: 5 additions & 43 deletions default.project.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,6 @@
{
"name": "ContextControls",
"tree": {
"$className": "DataModel",

"HttpService": {
"$className": "HttpService",
"$properties": {
"HttpEnabled": true
}
},

"Players": {
"$className": "Players",
"$properties": {
"CharacterAutoLoads": false
}
},

"ReplicatedStorage": {
"$className": "ReplicatedStorage",
"ContextControls": {
"$path": "lib/"
}
},

"StarterPlayer": {
"$className": "StarterPlayer",
"StarterPlayerScripts": {
"$className": "StarterPlayerScripts",
"TestEz": {
"$path": "modules/TestEz/lib"
},
"TestRunner": {
"$path": "tests.client.lua"
},

"Examples": {
"$path": "examples"
}
}
}
}
}
"name": "context-controls",
"tree": {
"$path": "src"
}
}
27 changes: 27 additions & 0 deletions dev.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "context-controls (dev)",
"tree": {
"$className": "DataModel",
"ReplicatedStorage": {
"DevPackages": {
"$path": "DevPackages"
},
"ContextControls": {
"$path": "src"
}
},
"ServerScriptService": {
"Tests": {
"$path": "tests"
}
},
"StarterPlayer": {
"StarterPlayerScripts": {
"$className": "StarterPlayerScripts",
"Example": {
"$path": "example"
}
}
}
}
}
8 changes: 4 additions & 4 deletions examples/main.client.lua → example/init.client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ local interact = ContextControls.createAction({
name = "interact",
inputTypes = {
Enum.KeyCode.E,
Enum.KeyCode.ButtonX
Enum.KeyCode.ButtonX,
},
inputState = Enum.UserInputState.Begin,
callback = function(input)
callback = function(_input: InputObject)
print("attempting to interact...")
end,
})
Expand All @@ -18,10 +18,10 @@ while true do
print("bound")
interact:bind()

wait(2)
task.wait(2)

print("unbound")
interact:unbind()

wait(2)
task.wait(2)
end
6 changes: 6 additions & 0 deletions foreman.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[tools]
rojo = { source = "rojo-rbx/rojo", version = "7.0.0" }
selene = { source = "kampfkarren/selene", version = "0.15.0" }
stylua = { source = "JohnnyMorganz/StyLua", version = "0.11.2" }
wally = { source = "UpliftGames/wally", version = "0.3.1" }
run-in-roblox = { source = "rojo-rbx/run-in-roblox", version = "0.3.0" }
1 change: 0 additions & 1 deletion modules/TestEz
Submodule TestEz deleted from 17e140
Loading

0 comments on commit 7877864

Please sign in to comment.