-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'add' command for installing foodchain
- Loading branch information
1 parent
7611293
commit b6ce38c
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ensureDir } from "@std/fs" | ||
|
||
export default async function add(recipe: string) { | ||
switch (recipe) { | ||
case "foodchain": | ||
return foodchain(); | ||
default: | ||
throw new Error(`Unknown recipe: ${recipe}`); | ||
} | ||
} | ||
|
||
const foodchain = async () => { | ||
console.log("Installing foodchain...") | ||
|
||
const foodchainUrl = "https://raw.githubusercontent.com/pvande/foodchain/refs/heads/main/foodchain.rb" | ||
|
||
const response = await fetch(foodchainUrl) | ||
const foodchainText = await response.text() | ||
|
||
await ensureDir("mygame/vendor/pvande/foodchain") | ||
await Deno.writeTextFile("mygame/vendor/pvande/foodchain/foodchain.rb", foodchainText) | ||
await Deno.writeTextFile("mygame/dependencies.rb", "require \"vendor/pvande/foodchain/foodchain.rb\"\n") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters