{"id":16115236,"url":"https://github.com/pvande/foodchain","last_synced_at":"2025-03-18T10:30:29.997Z","repository":{"id":234022952,"uuid":"788142754","full_name":"pvande/foodchain","owner":"pvande","description":"Manage your DragonRuby game's dependencies","archived":false,"fork":false,"pushed_at":"2024-10-21T17:09:14.000Z","size":32,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T08:45:59.946Z","etag":null,"topics":["dragonruby","dragonruby-gtk","dragonrubygtk"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pvande.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["pvande"],"ko_fi":"pvande"}},"created_at":"2024-04-17T21:20:38.000Z","updated_at":"2024-12-26T18:15:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"aeaeddef-f51b-436a-9ce8-d006a997e61e","html_url":"https://github.com/pvande/foodchain","commit_stats":null,"previous_names":["pvande/foodchain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvande%2Ffoodchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvande%2Ffoodchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvande%2Ffoodchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvande%2Ffoodchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pvande","download_url":"https://codeload.github.com/pvande/foodchain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918612,"owners_count":20368745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dragonruby","dragonruby-gtk","dragonrubygtk"],"created_at":"2024-10-09T20:18:09.487Z","updated_at":"2025-03-18T10:30:29.684Z","avatar_url":"https://github.com/pvande.png","language":"Ruby","funding_links":["https://github.com/sponsors/pvande","https://ko-fi.com/pvande"],"categories":[],"sub_categories":[],"readme":"# Foodchain\n\nFoodchain is a single-file library to help you document and install your\nDragonRuby game's dependencies.\n\n## Rationale\n\nInstalling dependencies in DragonRuby isn't particularly hard — the majority of\nlibrary code available for the framework is available as single-file libraries\nthat can be downloaded, required, and forgotten. DragonRuby GTK even includes\nthe `download_stb_rb` function to facilitate downloading these libraries, which\nis great … for as far as it goes.\n\nOn the other extreme you have tools like RubyGems, which are a publishing\nplatform for code that's production ready, a tool for putting that code (and any\ncode that it depends on) into a centralized location, and a runtime library for\nensuring that code in that centralized location can be loaded. Built on top of\nthat are tools like Bundler, which manage the specific versions of dependencies\nrequired by your application (in a way that's repeatable across machines), and\nwhich isolate your appilication from the *other* centrally installed libraries.\nThe caveat for DragonRuby developers is that these tools do not (and cannot)\nwork with the DragonRuby runtime, and most of the libraries that are published\nas RubyGems won't work anyway.\n\nFoodchain intends to sit in the gap between those two extremes.\n\n* Fully Decentralized\n  * Pull what you want from wherever it lives.\n* Git-Aware\n  * Pin your dependencies to a particular branch, tag, or commit.\n* Documentation\n  * Borrow code with the confidence that you'll remember it came from.\n* No External Dependencies\n  * Everything runs inside the DragonRuby runtime you already have.\n\n## Usage\n\nStart by saving [foodchain.rb] into your game's source tree. DragonRuby even\nprovides [a built-in tool][download_stb] for doing this, which you can run from\nyour game's console:\n\n```ruby\n# Downloads to pvande/foodchain/foodchain.rb\n$gtk.download_stb_rb \"pvande\", \"foodchain\", \"foodchain.rb\"\n\n# OR\n\n# Downloads to wherever/you/want.rb\nurl = \"https://raw.githubusercontent.com/pvande/foodchain/main/foodchain.rb\"\n$gtk.download_stb_rb_raw url, \"wherever/you/want.rb\"\n```\n\nNext, you'll create a dependency manifest — a file that lists the dependencies\nyou want Foodchain to install. Conventionally, we recommend using a file named\n`dependencies.rb`, living in the root directory of your game.\n\nRequire Foodchain inside your dependency manifest file.\n\n```ruby\n# mygame/dependencies.rb\nrequire \"pvande/foodchain/foodchain\"\n```\n\nIn this file, you'll [document your game's dependencies](#configuration).\n\nWhen you're ready to install, just run that dependency manifest.\n\n```shell\n./dragonruby mygame --eval dependencies.rb\n```\n\n### What's `__END__`?\n\nAfter successfully installing your dependencies, Foodchain will record a few\ndetails about the process at the end of your dependency manifest. This isn't\ncause for alarm: Foodchain will use this to detect when there's an update\navailable for one of your dependencies, and notify you.\n\nFoodchain will never automatically overwrite any of your installed dependencies,\nso you can run it and rerun it as often as you like. When you're ready to test\nan update, you can rerun your dependency manifest with the `--update` flag, and\nthe file(s) will be downloaded fresh.\n\n## Configuration\n\nFoodchain dependencies currently come in the following flavors:\n\n### github [owner], [repo], [path], ref: [ref?], destination: [destination?]\n\nGitHub dependencies are fetched based on the `path` within the `owner`'s fork of\nthe named `repo`.\n\nA specific `ref` may be specified to follow a particular Git branch, or pin to a\nparticular Git tag or commit. When omitted, this will fetch from the\nrepositories default branch (usually `main` or `master`).\n\nDownloaded dependencies will then be saved into the specified `destination`.\nWhen omitted, this will default to `vendor/$owner/$repo/$path`.\n\nThe `path` indicated can specify either a path to a regular file within the\nrepository, or the path to a *directory*. In the latter case, all files from\nthat directory in the repository will be downloaded recursively and stored in a\ndirectory named `destination`.\n\n### url [url], destination: [destination]\n\nURL dependencies are handled as a simple HTTP fetch — the contents of the remote\n`url` are saved into the file named by `destination`. This is a useful option\nwhen a more specific dependency type is not available.\n\n## Example Manifest\n\n``` ruby\n# mygame/dependencies.rb\n\nrequire \"lib/foodchain\"\n\n# Download the version of `pvande/dragonborn/dragonborn.rb` from `main`.\n# Creates `vendor/pvande/dragonborn/dragonborn.rb`.\ngithub :pvande, :dragonborn, \"dragonborn.rb\"\n\n# Download the version of `xenobrain/rubycolors/color.rb` from `bab319b65`.\n# Creates `vendor/xenobrain/rubycolors/color.rb`.\ngithub :xenobrain, :rubycolors, \"color.rb\", ref: \"bab319b65\"\n\n# Download the version of `mruby/mruby/mrbgems/mruby-set/mrblib/set.rb` from `main`.\n# Creates `vendor/set.rb`.\ngithub :mruby, :mruby, \"mrbgems/mruby-set/mrblib/set.rb\", destination: \"vendor/set.rb\"\n\n# Download the version of `danhealy/dragonruby-zif/lib` from `main`.\n# Creates `vendor/zif`.\ngithub :danhealy, \"dragonruby-zif\", \"lib\", destination: \"vendor/zif\"\n\n# Downloads the URL into `vendor/fang/from_now.rb`.\nurl \"https://gitlab.com/dragon-ruby/fang/-/raw/main/from_now.rb\", destination: \"vendor/fang/from_now.rb\"\n```\n\n[foodchain.rb]: https://raw.githubusercontent.com/pvande/foodchain/main/foodchain.rb\n[download_stb]: https://docs.dragonruby.org/#/api/runtime?id=download_stb_rb_raw\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvande%2Ffoodchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpvande%2Ffoodchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvande%2Ffoodchain/lists"}