Compare commits

...

897 Commits

Author SHA1 Message Date
Lucien Greathouse
bd13047b58 Release 0.6.0-alpha.3 2020-03-13 23:50:54 -07:00
Lucien Greathouse
1a83789c01 Update Changelog 2020-03-13 20:50:03 -07:00
Lucien Greathouse
1cbe272e19 Fix malformed meta files causing panics.
Fixes #280.
2020-03-13 20:38:06 -07:00
Lucien Greathouse
6de74b41b3 Update snapshot error type and handle serde_json errors in JSON models 2020-03-13 20:31:31 -07:00
Lucien Greathouse
b0fc9ee507 Rename 'src/common' in default place template to 'src/shared' 2020-03-13 20:25:50 -07:00
Lucien Greathouse
a95ffe1d31 Add snapshot error handling to ChangeProcessor 2020-03-13 20:24:14 -07:00
Lucien Greathouse
4119a510f5 Fix broken error source tracking 2020-03-13 20:12:42 -07:00
Lucien Greathouse
cfa7f03815 Add help link to default model project 2020-03-13 20:11:08 -07:00
Lucien Greathouse
9b4c89820d Fix extra Git output in rojo init and update place template 2020-03-13 20:10:31 -07:00
Lucien Greathouse
fe874720aa Upgrade rojo init to create README.md and create Git repo 2020-03-13 20:00:48 -07:00
Lucien Greathouse
f7c0f33eb5 Add brand new rojo init command 2020-03-13 19:33:43 -07:00
Lucien Greathouse
c1bf9d9dfc Update duplicate env_logger dep 2020-03-12 19:39:27 -07:00
Lucien Greathouse
255bf439d3 Add 'rojo doc' command 2020-03-12 16:02:19 -07:00
Lucien Greathouse
2a31937b81 Use CARGO_PKG_REPOSITORY instead of hard-coded URL 2020-03-12 15:48:30 -07:00
Lucien Greathouse
eb8964e1d1 Improve panic messaging and process behavior.
- Replaced main() to use custom panic hook
- Updated log formatting
- Switched to panic=abort, since we don't need to unwind now.
- Process will now abort if any thread panics.
2020-03-12 15:42:56 -07:00
Lucien Greathouse
fe0ca280a1 Update disabled CSV middleware test 2020-03-10 23:52:55 -07:00
Lucien Greathouse
e8e3b7b985 plugin: Fix dark theme when resized to be wide 2020-03-10 20:34:12 -07:00
Lucien Greathouse
c437507442 Update changelogs 2020-03-10 18:15:06 -07:00
Lucien Greathouse
ca151b434e Update memofs dependency 2020-03-10 18:13:34 -07:00
Lucien Greathouse
10ba74c21e memofs: Add description 2020-03-10 18:11:39 -07:00
Lucien Greathouse
6191b6371d Update using cargo-readme 2020-03-10 18:09:04 -07:00
Lucien Greathouse
5be4175ac3 Rename vfs -> memofs across the codebase 2020-03-10 18:05:31 -07:00
Lucien Greathouse
f61f3671a6 Choose 'memofs' as the vfs name 2020-03-10 17:57:57 -07:00
Lucien Greathouse
477e0ada32 VFS in external crate (#297)
* vroom

* Port dir middleware

* Filter rules

* Directory metadata

* Project support

* Enable Lua support

* StringValue support

* CSV

* rbxm, rbxmx, and rbxlx

* JSON models

* Clean up some warnings

* Strip out PathMap

* Unwatch paths when they're reported as removed

* Fix 'rojo upload' behavior

* Upgrade to Insta 0.13.1

* Update dependencies

* Release 0.6.0-alpha.2

* Fix bad merge

* Replace MemoryBackend with InMemoryFs

* Sledgehammer tests into passing for now

* Txt middleware

* Update easy snapshot tests

* Lua tests

* Project middleware tests

* Try to fix test failures by sorting

* Port first set of serve session tests

* Add InMemoryFs::raise_event

* Finish porting serve session tests

* Remove UI code for introspecting VFS for now

* VFS docs
2020-03-10 17:38:49 -07:00
Lucien Greathouse
a884f693ae Update changelog 2020-03-08 18:34:11 -07:00
Lucien Greathouse
3107b1b21b Dynamic theming. Closes #241.
Upgrades to Roact master and introduces dynamic theme switching.

We branch on the theme name in order to try to use Rojo's brand
colors instead of Studio's. I kind of winged it with these colors
and we might want to choose slightly nicer dark theme colors
in the future.

I also took the opportunity to reorganize the color naming scheme
since it didn't really work for dark theme.
2020-03-08 18:32:42 -07:00
Lucien Greathouse
04529de7b3 Update Changelog 2020-03-08 17:48:50 -07:00
Lucien Greathouse
199a39208c Implement 'rojo build --watch' (#284)
* Refactor build command to reproduce model more easily

* Spawn ServeSession for building
2020-03-08 17:48:14 -07:00
Lucien Greathouse
0187da5f24 Release 0.6.0-alpha.2 2020-03-06 13:56:21 -08:00
Lucien Greathouse
2e1c37ffff Update dependencies 2020-03-06 13:54:04 -08:00
Lucien Greathouse
4b0189dd55 Upgrade to Insta 0.13.1 2020-03-06 13:52:23 -08:00
Lucien Greathouse
d4a39674de Fix 'rojo upload' behavior 2020-03-06 13:23:49 -08:00
Lucien Greathouse
07c6fd3711 Update docs repo link 2020-03-04 15:00:10 -08:00
Lucien Greathouse
cf5b72aa9a Docs have moved to https://github.com/rojo-rbx/rojo.space 2020-02-27 22:57:06 -08:00
Lucien Greathouse
cdfbebd637 Update changelog for 0.5.4 release 2020-02-27 10:29:41 -08:00
Lucien Greathouse
e86e3316a9 Update changelog to include 0.5.x versions 2020-02-26 17:56:33 -08:00
Lucien Greathouse
bb2dcbaea0 vfs: Flesh out MemoryBackend 2020-02-21 23:52:11 -08:00
Lucien Greathouse
fefc7a69cd vfs: Expand documentation 2020-02-21 23:34:56 -08:00
Lucien Greathouse
1b24cd36e0 vfs: Snapshots, roughly 2020-02-19 23:58:09 -08:00
Lucien Greathouse
6322c1f46d vfs: Add stub MemoryBackend 2020-02-19 23:35:45 -08:00
Lucien Greathouse
00a29bb6be Unwatch paths when they're reported as removed 2020-02-19 23:34:57 -08:00
Lucien Greathouse
3a029caf2b Bump MSRV to 1.40.0 2020-02-19 23:22:51 -08:00
Lucien Greathouse
57263905e7 Add IoResultExt, fix mutability and Send-ness 2020-02-19 10:11:43 -08:00
Lucien Greathouse
4f46012c11 Complete an unfinished 2020-02-19 09:49:18 -08:00
Lucien Greathouse
7ea9a1e3e8 Expose metadata, remove_file, and remove_dir_all 2020-02-19 09:43:39 -08:00
Lucien Greathouse
c7510e12c4 Removal API 2020-02-19 09:39:49 -08:00
Lucien Greathouse
89b5d9294c Event receiving/committing infrastructure 2020-02-19 09:36:38 -08:00
Lucien Greathouse
339e1060b7 Clean up Vfs methods that defer to VfsLock 2020-02-19 09:17:21 -08:00
Lucien Greathouse
52e1dbd846 Flesh out crate 2020-02-18 23:16:56 -08:00
Lucien Greathouse
b4963f4ff7 Watching 2020-02-18 22:42:31 -08:00
Lucien Greathouse
838e8f6bde VFS crate 2020-02-18 22:30:12 -08:00
Lucien Greathouse
8f21514855 two-way-sync: Add super special case script syncing 2020-02-18 18:19:08 -08:00
Lucien Greathouse
44041f33e3 Start trying to sync parenting-to-nil (deleting) 2020-02-14 18:29:43 -08:00
Lucien Greathouse
5d9bc4473c two-way-sync: Track Parent property for value objects 2020-02-14 18:25:54 -08:00
Lucien Greathouse
a3e0d42e86 two-way-sync: Handle deleting non-project node files.
This is the tiniest step towards this feature and not even
very useful, but an important proof of concept.
2020-02-14 18:24:03 -08:00
Lucien Greathouse
4a9c1d0d1b two-way sync: allow changedProperties to be null to avoid array/object issues 2020-02-14 18:15:18 -08:00
Lucien Greathouse
ff47f79c62 Fix serverVersion in snapshots failing tests 2020-02-14 17:57:01 -08:00
Lucien Greathouse
f46a391873 Build releases on tag push instead of release creation 2020-01-22 10:20:37 -08:00
Lucien Greathouse
99b8ada42b Release v0.6.0-alpha.1 2020-01-22 10:09:07 -08:00
Lucien Greathouse
f2227aa7cb Use static OpenSSL for macOS binaries, too 2020-01-22 09:58:30 -08:00
Lucien Greathouse
a9f6c20113 Support Linux release binaries 2020-01-22 09:55:21 -08:00
Lucien Greathouse
e261e7a2c7 Implement glob ignores (#272)
* Add Glob wrapper type with better serialization

* Introduce PathIgnoreRule struct

* Implement equality for Glob type

* Add PathIgnoreRule to InstanceContext

* Implement glob ignores in directory middleware

* Fix up filters

* Use Iterator::all instead of loop

* Add project-level configuration for glob ignores

* Add test project for glob ignores

* Wire up project file and snapshots to make glob ignores work

* Better codepaths for adding ignore rules with empty iterators

* Add test for globs inherited from parent projects

* Add test details, support glob ignores in nested projects

* Add feature flag for globs

* Switch to use ExactSizeIterator instead of size_hint

* Remove glob visitor
2020-01-08 17:58:37 -08:00
Lucien Greathouse
ae811aafd0 Make ChangeProcessor abort gracefully on RecvError 2020-01-05 23:46:12 -08:00
Lucien Greathouse
cc593b465d Delete unused plugin place project 2020-01-04 21:31:36 -08:00
Lucien Greathouse
f81e8339e3 Add 'homepage' and 'documentation' links to Cargo.toml 2019-12-20 16:52:56 -08:00
Lucien Greathouse
cdc5513726 Rename dev-live-assets feature to dev_live_assets 2019-12-20 14:26:08 -08:00
Lucien Greathouse
a398338c02 Two way sync V0 (#282)
* Unfinished two-way sync API

* In-memory two-way sync complete

* Move PatchSet application into ChangeProcessor thread, where it can be synchronous

* Stop InstanceMap's signals when a ServeSession terminates

* Apply patch in ChangeProcessor

* Feature flag

* Fix error in ChangeProcessor due to wrong drop order
2019-12-20 14:24:28 -08:00
Lucien Greathouse
26e2e81188 Refactor ChangeProcessor to be easier to follow 2019-12-19 17:41:35 -08:00
Lucien Greathouse
46d7bba87d Add .rbxl.lock and .rbxlx.lock files to gitignore 2019-12-19 14:46:34 -08:00
Lucien Greathouse
57d5610a58 plugin: Improve HTTP error messages by using response body 2019-12-19 14:41:57 -08:00
Lucien Greathouse
1968e1fdb7 Fix bad formatting string in plugin HTTP module 2019-12-19 14:40:29 -08:00
Lucien Greathouse
f2584cf807 Fix live sync.
The refactor to use StructOpt instead of plain Clap had some absolute
vs relative path issues that slipped through. This commit adds getters
to each StructOpt struct that exposes an explicitly absolute version
of each path value.
2019-12-18 17:52:16 -08:00
Lucien Greathouse
dd592d1d6d Break pathing everywhere (fix coming soon), fix verbosity argument 2019-12-18 17:44:47 -08:00
Lucien Greathouse
cfff08cdfd Add plugin half of script-only, existing-instance-only, two way sync 2019-12-18 17:39:04 -08:00
Lucien Greathouse
e83437c193 Add debug formatter for instances 2019-12-18 17:38:31 -08:00
Lucien Greathouse
1d900a6a3c Update benchmarks to use new CLI API 2019-12-18 15:56:24 -08:00
Lucien Greathouse
859c7bea8a Update most dependencies 2019-12-18 15:52:47 -08:00
Lucien Greathouse
1b9e90e786 Port from Failure to Snafu (#281)
* Failure -> Snafu for build command

* Port skeletal remains of init to snafu

* failure -> snafu for serve

* failure -> snafu for upload, remove impl_from macro

* failure -> custom error in vfs

* Bye bye, failure

* Fix Rust 1.36 build regression
2019-12-18 15:44:46 -08:00
Lucien Greathouse
41396367ac Tell Cargo to use Rojo's README.md 2019-12-17 13:59:59 -08:00
Lucien Greathouse
16c9a23d55 Shuffle around Rojo's public API 2019-12-17 13:58:46 -08:00
Lucien Greathouse
ce338a2a72 Remove impl_from macro from public API 2019-12-17 13:40:52 -08:00
Lucien Greathouse
1f7f2b22e7 Rewrite Project, remove SourceProject (#274)
* Rewrite project file to have relative paths and drop SourceProject

* Redo project error types

* Tidy up and document Project type

* Strip out init command
2019-12-12 14:45:15 -08:00
Lucien Greathouse
47c7f63d75 Switch everything to StructOpt (#277)
* Add types for Rojo's subcommands

* Flesh out CLI types

* Port everything to structopt instead of clap
2019-12-12 14:30:47 -08:00
Lucien Greathouse
8b1e85fbb4 Upgrade dependencies 2019-12-11 18:05:44 -08:00
Lucien Greathouse
ff4e9fb027 Stop overriding default-members in CI 2019-12-10 17:13:37 -08:00
Lucien Greathouse
d15ef40988 Upgrade dependencies correctly this time 2019-12-10 17:02:08 -08:00
Lucien Greathouse
eadfb18f74 Update rbx_xml and rbx_reflection 2019-12-10 13:39:55 -08:00
Lucien Greathouse
4b89bb087a Attach context to instances produced by middleware (#273) 2019-12-04 11:38:28 -08:00
Lucien Greathouse
f0a602b48b Revert "Remove some PartialEq derives"
This reverts commit fe10da9a6c.
2019-12-03 16:47:19 -08:00
Lucien Greathouse
fe10da9a6c Remove some PartialEq derives 2019-12-03 16:34:46 -08:00
Lucien Greathouse
948303aac8 Remove InstanceSnapshotContext in favor of InstanceContext (#271)
* Drop plugin context on the floor

* Remove redirect from old context to new context

* Pass InstanceContext via & instead of &mut reference

* Re-use context value in ChangeProcessor from metadata
2019-12-03 16:11:51 -08:00
Lucien Greathouse
12df80da56 Introduce InstanceContext (#270)
* Add instance context with dummy field

* Remove stub field
2019-12-03 15:30:20 -08:00
Lucien Greathouse
a48c238ed7 Add InstanceMetadata builder (#269)
* Add InstanceMetadata builder, with context field for globbing

* Revert snapshot changes

* Port snapshot functions to InstanceMetadata builder-ish pattern

* Remove IgnoreGlob struct

* Elide lifetime
2019-12-03 14:49:40 -08:00
Lucien Greathouse
da6c7b4d7a Fix Insta snapshot files having their line endings truncated when edited 2019-11-25 18:10:39 -08:00
Lucien Greathouse
15cbbacc2f Refcount entries in snapshot context, moving towards sharing 2019-11-25 15:11:58 -08:00
Lucien Greathouse
c3f6a17bae Add builder-ish methods to InstanceSnapshot to make middleware code more readable 2019-11-19 14:02:57 -08:00
Lucien Greathouse
0fbeb70865 Remove erroneous comment in SnapshotJsonModel 2019-11-19 13:53:48 -08:00
Lucien Greathouse
02f98a4053 Remove lifetime from SnapshotInstanceResult 2019-11-19 13:06:31 -08:00
Lucien Greathouse
d2e2a13479 Start stripping out lifetimes in InstanceSnapshot 2019-11-19 13:05:18 -08:00
Lucien Greathouse
f32cb592e2 Remove ownership stuff from InstanceSnapshot 2019-11-19 13:02:35 -08:00
Lucien Greathouse
72342f3118 Trim vestigial middleware method 2019-11-19 12:55:55 -08:00
Lucien Greathouse
246fd5f6c4 Add init scripts as relevant paths to all directories.
This doesn't feel ideal. Though it's true that all directories are influenced by
any init scripts they have, the directory middleware shouldn't need to know
about Lua.

I don't really want to go back into working on the middleware chain since it
mostly feels like busywork when there are other things to build on in Rojo.

also all of this feels really complicated
2019-11-18 18:28:36 -08:00
Lucien Greathouse
715022def5 Make init files copy metadata from folder.
Fixes #267.
2019-11-18 18:16:37 -08:00
Lucien Greathouse
78b2bafde1 Add test for #267. 2019-11-18 18:11:33 -08:00
Lucien Greathouse
2d7ebac8e6 Enable test for removing files 2019-11-18 18:08:18 -08:00
Lucien Greathouse
bcffd2eb99 Add support for removing files, handled in ChangeProcessor 2019-11-18 18:08:12 -08:00
Lucien Greathouse
459bf62fab Add missing contents for disabled remove_file test 2019-11-18 16:52:19 -08:00
Lucien Greathouse
bdaa671823 Plugin: Pipe InstanceMap around, improve debug output, fix session ID bug 2019-11-18 16:30:57 -08:00
Lucien Greathouse
463bf9b116 Make errors scrollable when too long 2019-11-18 15:57:22 -08:00
Lucien Greathouse
0c7a94c062 Update more code to new formatting machinery 2019-11-18 15:18:06 -08:00
Lucien Greathouse
af866f0665 Fix request timeout in long polling causing error to bubble to console 2019-11-15 15:54:58 -08:00
Lucien Greathouse
2493c70241 Fix log special case for empty tables 2019-11-15 15:43:42 -08:00
Lucien Greathouse
3c3359999c Fix hydration patch incorrectly comparing properties 2019-11-15 15:42:11 -08:00
Lucien Greathouse
2467004dc2 Update HTTP logs 2019-11-15 15:40:03 -08:00
Lucien Greathouse
3a9f438390 Integrate fmt into log 2019-11-15 15:39:15 -08:00
Lucien Greathouse
3126de2c37 Build out real formatting machinery 2019-11-15 15:00:54 -08:00
Lucien Greathouse
b7d026b98e Partial implementation of better formatting machinery 2019-11-14 18:43:51 -08:00
Lucien Greathouse
3f8b178f88 Add support for computing property and name changes in hydration patch computation 2019-11-14 18:18:38 -08:00
Lucien Greathouse
6184f4ce4f Improve debug output for initialization of ServeSession 2019-11-14 18:18:24 -08:00
Lucien Greathouse
fa736697a9 Introduce early Lua formatting library inspired by Rust 2019-11-14 18:18:07 -08:00
Lucien Greathouse
2c88c700ca Work around plugins loading too early by searching for DevSettings via ChildAdded 2019-11-14 18:16:48 -08:00
Lucien Greathouse
0b2e9ce1ad Improve InstanceMap tracking of ValueBase instances 2019-11-14 18:16:17 -08:00
Lucien Greathouse
ccafdf250e Add counterpart to setCanonicalProperty for reading 2019-11-14 18:15:53 -08:00
Lucien Greathouse
57b28faa74 Update ApiSubcribeMessage signature 2019-11-14 18:15:33 -08:00
Lucien Greathouse
d0d7c58af1 Start tracking property changes in plugin 2019-11-13 18:34:48 -08:00
Lucien Greathouse
339fc979f5 Add disabled test for removing file that currently hangs 2019-11-11 18:03:31 -08:00
Lucien Greathouse
47614c3102 Update names in subscribe portion of sync protocol 2019-11-11 17:52:09 -08:00
Lucien Greathouse
94e1501329 Stop having clibrojo as a default project, update docs 2019-11-07 18:24:16 -08:00
Lucien Greathouse
dfb015acc2 Add Rojo C API experiment 2019-11-07 18:20:55 -08:00
Lucien Greathouse
f1daafbf9e Fix ordering not being preserved in Vfs 2019-11-03 00:00:50 -07:00
Lucien Greathouse
432e10c205 Scrap old project load tests 2019-11-02 23:47:03 -07:00
Lucien Greathouse
62b626a931 Remove Project::load_from_str in favor of from_slice 2019-11-02 23:43:24 -07:00
Lucien Greathouse
9a2893c6bc Remove warnings for upgrading from 0.4.x 2019-11-02 23:41:32 -07:00
Lucien Greathouse
3a538f98ed Tightened project discovery behavior 2019-11-02 23:36:28 -07:00
Lucien Greathouse
7c71708de7 Drop support for roblox-project.json 2019-11-02 23:16:01 -07:00
Lucien Greathouse
b64d97e808 Force PathMap to have deterministic ordering by using BTreeSet instead of HashSet 2019-10-21 16:25:34 -07:00
Lucien Greathouse
428a19789d Enable 'move folder of stuff' test 2019-10-21 16:00:43 -07:00
Lucien Greathouse
7cc4055d94 Upgrade to Insta master to get bugfix.
Map sorting in Insta was previously not recursive.
As of this PR, it is!
https://github.com/mitsuhiko/insta/pull/80

Since it hasn't made it into a release yet, but is
important for Rojo to have snapshot determinism,
we're moving temporarily to depend on Insta via Git.
2019-10-21 15:29:33 -07:00
Lucien Greathouse
114c93fa46 Fix non-portable path serialization in ProjectNode.
This was failing snapshot tests on the Linux CI machines,
since I committed snapshots with backslashes.

I think the old path serializer was still the wrong approach,
this one is sort of a middleground but I'm still not super
happy with it.
2019-10-18 19:40:47 -07:00
Lucien Greathouse
07801a0283 Add support for updating instances defined in project nodes 2019-10-18 18:06:40 -07:00
Lucien Greathouse
30c8ea583b Remove special path serialization for ProjectNode 2019-10-18 18:06:25 -07:00
Lucien Greathouse
d54a5f647e Improve tree explorer UI 2019-10-18 16:49:03 -07:00
Lucien Greathouse
457ed05174 Fix missed references to IMFS in CSS instead of VFS 2019-10-18 15:37:38 -07:00
Lucien Greathouse
44c94da2d8 Fix clippy warnings 2019-10-17 18:22:53 -07:00
Lucien Greathouse
ec614e1912 Remove last unused warning. Closes #245. 2019-10-17 17:48:30 -07:00
Lucien Greathouse
559b509a03 Upgrade to latest rbx-dom 2019-10-17 17:37:49 -07:00
Lucien Greathouse
e2e9209655 rojo-test: Add disabled test for moving big folder of stuff 2019-10-17 16:03:21 -07:00
Lucien Greathouse
e55b72f73f rojo-test: Move settings closer to where settings are applied 2019-10-17 16:01:03 -07:00
Lucien Greathouse
85e30cc968 Write tests and ensure adding instances works 2019-10-17 13:46:59 -07:00
Lucien Greathouse
51dcfbab75 Fix rustfmt on benches 2019-10-16 19:32:10 -07:00
Lucien Greathouse
7c0aa45057 Add support for adding new instances, very pedantically 2019-10-16 18:28:38 -07:00
Lucien Greathouse
a5fdc2a9cc Add logging, fix flipped condition on child add 2019-10-16 18:28:11 -07:00
Lucien Greathouse
64fd2f9cf8 Add disabled test for adding a folder, currently failing 2019-10-16 17:54:10 -07:00
Lucien Greathouse
a77495c562 Add names to serve test snapshots 2019-10-16 17:41:21 -07:00
Lucien Greathouse
3880708e1d Improve serve snapshot test ergonomics 2019-10-16 17:36:13 -07:00
Lucien Greathouse
cc68d57f11 Remove insta dependency for rojo-insta-ext 2019-10-16 17:03:21 -07:00
Lucien Greathouse
56f5a61362 Add test for folder of scripts being mutated 2019-10-16 16:55:55 -07:00
Lucien Greathouse
40540c3637 Improve serve test, add single txt file test 2019-10-16 16:21:33 -07:00
Lucien Greathouse
82678235ab VFS Improvements (#259)
This PR refactors all of the methods on `Vfs` from accepting `&mut self` to
accepting `&self` and keeping data wrapped in a mutex. This builds on previous
changes to make reference count file contents and cleans up the last places
where we're returning borrowed data out of the VFS interface.

Once this change lands, there are two possible directions we can go that I see:
* Conservative: Refactor all remaining `&mut Vfs` handles to `&Vfs`
* Interesting: Embrace ref counting by changing `Vfs` methods to accept `self:
  Arc<Self>`, which makes the `VfsEntry` API no longer need an explicit `Vfs`
  argument for its operations.

* Change VfsFetcher to be immutable with internal locking
* Refactor Vfs::would_be_resident
* Refactor Vfs::read_if_not_exists
* Refactor Vfs::raise_file_removed
* Refactor Vfs::raise_file_changed
* Add Vfs::get_internal as bits of Vfs::get
* Switch Vfs to use internal locking
* Migrate all Vfs methods from &mut self to &self
* Make VfsEntry access Vfs immutably
* Remove outer VFS locking (#260)
* Refactor all snapshot middleware to accept &Vfs instead of &mut Vfs
* Remove outer VFS Mutex across the board
2019-10-16 15:45:23 -07:00
Lucien Greathouse
5123d21290 Rename Vfs::inner to Vfs::data, use Self more 2019-10-14 16:46:15 -07:00
Lucien Greathouse
b0dcf515f0 Refactor plugins, port message dropping bugfix from 0.5.1 2019-10-14 14:05:25 -07:00
Lucien Greathouse
9aafccc946 Update CHANGELOG 2019-10-14 13:46:02 -07:00
Lucien Greathouse
ccf98d7283 Move and tidy up small place benchmark 2019-10-14 11:38:16 -07:00
Lucien Greathouse
1b35c98be5 Add build tests for init.meta.json 2019-10-12 23:54:39 -07:00
Lucien Greathouse
db23c3d35a Mark init.meta.json as relevant path for directories 2019-10-12 23:46:49 -07:00
Lucien Greathouse
1c6c1298d5 Add init.meta.json support, untested 2019-10-12 23:45:38 -07:00
Lucien Greathouse
b9ebed14a5 Add documentation for AdjacentMetadata 2019-10-12 23:31:33 -07:00
Lucien Greathouse
7077f0f1f3 Load user plugins on startup instead of lazily at snapshot time 2019-10-12 23:27:12 -07:00
Lucien Greathouse
d1887c6cd3 Merge branch 'vfs-arc' 2019-10-12 15:29:54 -07:00
Lucien Greathouse
9278c81611 Merge branch 'master' into vfs-arc 2019-10-12 15:28:33 -07:00
Lucien Greathouse
dec9ec32df Add small place benchmark 2019-10-12 15:24:57 -07:00
Lucien Greathouse
1967f738a8 Make all file contents be Arc<Vec<u8>> instead of &[u8] 2019-10-12 14:17:52 -07:00
Lucien Greathouse
1031600c63 Batch rename: imfs -> vfs 2019-10-12 13:58:00 -07:00
Lucien Greathouse
24c697bea7 Port commands to use common setup code
Initialization logic needed for serve, build, and upload is now
much more clear than it was when these functions were written.

This commit refactors all of them to use a new common_setup
module for all of their initialization that's the same.
2019-10-11 18:35:10 -07:00
Lucien Greathouse
83665018d4 Compute snapshot context from project in build 2019-10-11 18:25:12 -07:00
Lucien Greathouse
b093626a21 User plugin foundations for 0.6.0 (#257)
Starts work on #55.

This is similar to the previous work in #125. It's gated behind a new Cargo
feature, `user-plugins`. This time, the config gate is much smaller. The
`plugins` member of projects is still accessible when plugins aren't enabled,
but is always empty. Additionally, user plugins are only enabled if there's a
Lua state present in the snapshot context when the `SnapshotUserPlugins`
snapshot middleware runs. This not ever the case currently.

This code has very little possibility of rotting while we focus on other work,
since it'll be guaranteed to still compile and can be tested in isolation
without the feature being turned on.
2019-10-11 15:45:02 -07:00
Lucien Greathouse
f3dc78b7cd Make InstanceSnapshotContext mutable through whole middleware pipeline 2019-10-10 14:07:10 -07:00
Lucien Greathouse
f0cd4333c3 Thread InstanceSnapshotContext through all SnapshotMiddleware 2019-10-10 11:44:33 -07:00
Lucien Greathouse
6d38a785ed Make SnapshotMiddleware::from_instance have a default impl 2019-10-10 10:44:46 -07:00
Lucien Greathouse
e46f9fd94f Simplify snapshot code using match_file_name utility 2019-10-09 18:27:52 -07:00
Lucien Greathouse
6b620ddcef Add utility for working with file names, port JSON model to use it 2019-10-09 18:22:58 -07:00
Lucien Greathouse
e5684ad947 Add error for malformed project files 2019-10-09 18:15:07 -07:00
Lucien Greathouse
dfabc07044 More consistent handling of non-Unicode file names (should be rare) 2019-10-09 17:15:34 -07:00
Lucien Greathouse
dca88e8272 Port Project snapshot to use with_not_found 2019-10-09 15:30:03 -07:00
Lucien Greathouse
9f947ae2c5 Improve bad Unicode error handling in txt, CSV, and directory handling 2019-10-09 12:55:24 -07:00
Lucien Greathouse
28156bcaf2 Switch SnapshotMiddleware over to SnapshotError 2019-10-09 12:42:08 -07:00
Lucien Greathouse
a14aacbcf9 Improve SnapshotError in preparation for moving middleware to it 2019-10-09 12:39:36 -07:00
boyned//Kampfkarren
321e026e43 Fix failing snapshot (#256) 2019-10-09 12:29:33 -07:00
Lucien Greathouse
30351f7b9d Add support for .meta.json files associated with .txt files 2019-10-08 17:44:23 -07:00
Lucien Greathouse
2393a1a114 Add support for .meta.json files affecting .csv LocalizationTables 2019-10-08 16:48:49 -07:00
Lucien Greathouse
479476561e Fix errors in 'Sync Details' page 2019-10-08 16:16:06 -07:00
Lucien Greathouse
a02f485040 Add end-to-end build test for Script.Disabled via .meta.json 2019-10-08 16:05:15 -07:00
Lucien Greathouse
2957e8ad73 Make Lua snapshot middleware test sort maps 2019-10-08 16:03:15 -07:00
Lucien Greathouse
f83abe15cb Add test for ensuring that scripts can be disabled with .meta.json files 2019-10-08 15:46:51 -07:00
Lucien Greathouse
709cba45ce Remove className from adjacent meta files, which is not supported in 0.5.x 2019-10-08 15:44:47 -07:00
Lucien Greathouse
8a9a72fd50 Refactor .meta.json into AdjacentMetadata type more strongly 2019-10-08 15:42:44 -07:00
Lucien Greathouse
13cb0a27a0 Make .meta.json changes cause scripts to be updated 2019-10-08 15:30:16 -07:00
Lucien Greathouse
fa817e3cdd Add baseline support for adjacent meta files for scripts 2019-10-08 14:14:44 -07:00
Lucien Greathouse
3bd8549f41 Add ServeSession test for project with folder 2019-10-08 13:57:40 -07:00
Lucien Greathouse
4e47655b17 Refactor MessageQueue API to return a oneshot receiver 2019-10-08 13:49:41 -07:00
Lucien Greathouse
18533d5944 Improve ServeSession test using async and Tokio 2019-10-08 13:26:21 -07:00
Lucien Greathouse
c5839c94ca Add test-only MessageQueue::subscribe_any.
This makes writing tests that do async things easier.
2019-10-08 13:25:34 -07:00
Lucien Greathouse
ffc146ff9b Add ServeSession test for changing text file 2019-10-07 18:23:39 -07:00
Lucien Greathouse
7b82e3d641 Add TestFetcher for mocking more filesystem operations than NoopFetcher 2019-10-07 18:22:29 -07:00
Lucien Greathouse
ab6cedb659 Move some serve code into serve_session.rs, start writing serve session tests 2019-10-07 16:24:36 -07:00
Lucien Greathouse
e60be94be0 Move patch apply test utility into tree_view module 2019-10-07 16:21:25 -07:00
Lucien Greathouse
f830b024d5 Add ImfsSnapshot::empty_dir() for debugging the Imfs 2019-10-07 16:20:04 -07:00
Lucien Greathouse
98519da7d9 Reintroduce instigating paths for snapshot middleware 2019-10-04 18:36:04 -07:00
Lucien Greathouse
cb3211cf46 Mark project node as instigating source for instances from project 2019-10-04 18:10:45 -07:00
Lucien Greathouse
c051153a1f Mark project file as instigating source for top-level instances 2019-10-04 18:05:27 -07:00
Lucien Greathouse
956d7e0918 Fix warning in JSON model snapshot test 2019-10-04 17:52:05 -07:00
Lucien Greathouse
530a7aa834 Rename 'contributing paths' to 'relevant paths' 2019-10-04 17:36:26 -07:00
Lucien Greathouse
052ca52cc3 Move instigating source out of contributing paths (#253)
* Refactor contributing_paths into contributing_sources, deleting project node sources

* Instead of changing contributing_paths, add instigating_source

* Remove InstanceMetadata::project_node

* Stop pushing project path to front of contributing_paths since it doesn't matter now

* Remove accidental UI change for path display
2019-10-04 17:34:05 -07:00
Lucien Greathouse
2025b8a494 Fix patch I missed project_node change 2019-10-04 15:49:12 -07:00
Lucien Greathouse
238233ca81 Stop serializing project_node if it's None 2019-10-04 15:12:34 -07:00
Lucien Greathouse
938c8259c3 Include project node in debug UI 2019-10-04 14:29:02 -07:00
Lucien Greathouse
35df5f25c7 Show metadata in web interface, take one 2019-10-04 14:14:45 -07:00
Lucien Greathouse
cd84fb9fc1 Bring forward 0.5.1 release notes 2019-10-04 13:19:14 -07:00
Lucien Greathouse
8bcf12e317 Update dependencies 2019-10-04 13:18:42 -07:00
Lucien Greathouse
10ed353e0a Add TODO for JSON model metadata 2019-10-03 18:30:10 -07:00
Lucien Greathouse
72d88200e4 Snapshot tests for JSON models 2019-10-03 18:28:58 -07:00
Lucien Greathouse
6ef832b3a9 Improve documentation for SnapshotProject 2019-10-03 18:25:06 -07:00
Lucien Greathouse
17d91563d5 Port project file tests to use insta 2019-10-03 18:22:20 -07:00
Lucien Greathouse
fb65693627 Propagate metadata in project files correctly 2019-10-03 18:12:52 -07:00
Lucien Greathouse
079fc738ad plugin: Properly handle removals in patches 2019-10-03 18:12:36 -07:00
Lucien Greathouse
ae0f3b0b02 Assign contributing paths in simple cases for snapshots 2019-10-03 17:34:33 -07:00
Lucien Greathouse
b2c515f2e6 plugin: Prevent HTTP timeout cascading after session stop 2019-10-03 17:28:34 -07:00
Lucien Greathouse
6f1469a551 plugin: Implement patch application, which makes live sync work 2019-10-03 17:13:29 -07:00
Lucien Greathouse
1d441b86d2 plugin: Fix type bindings for instance Parent 2019-10-03 17:13:17 -07:00
Lucien Greathouse
b72e6e54e6 plugin: Add debugging function for InstanceMap state 2019-10-03 17:12:43 -07:00
Lucien Greathouse
1ee679395d Add 'invariant' function for debugging 2019-10-03 17:12:08 -07:00
Lucien Greathouse
cf62ee5ccb plugin: Add Id and ParentId to ApiInstance type definitions 2019-10-03 15:54:49 -07:00
Lucien Greathouse
995685adfe Expose instance ID and parent ID in web API 2019-10-03 15:54:11 -07:00
Lucien Greathouse
f0eb955628 Expose parent from RojoTree instances 2019-10-03 15:53:50 -07:00
Lucien Greathouse
923f661428 Start rewriting plugin on top of new sync protocol 2019-10-02 18:41:52 -07:00
Lucien Greathouse
b562d11994 plugin: Remove Logging alias and update imports 2019-10-02 11:10:34 -07:00
Lucien Greathouse
3554112f31 plugin: Add test that loads all modules 2019-10-02 11:07:22 -07:00
Lucien Greathouse
7cada2608f plugin: Refactor HTTP and ApiContext foundations 2019-10-02 11:04:40 -07:00
Lucien Greathouse
21d4acebc3 Move .luacheckrc for better editor detection 2019-10-02 10:42:10 -07:00
Lucien Greathouse
73bbaaf0af Add script for installing release plugin 2019-10-01 18:42:25 -07:00
Lucien Greathouse
40105515d2 plugin: Unify test running code 2019-10-01 18:41:33 -07:00
Lucien Greathouse
79f09deecb Add strong type checking to plugin API client 2019-10-01 18:37:35 -07:00
Lucien Greathouse
c4a7f8675f Fix log level in plugin dev mode 2019-10-01 18:37:25 -07:00
Lucien Greathouse
f9a5fee364 Reorganize and clean up plugin 2019-10-01 18:23:29 -07:00
Lucien Greathouse
bdd9c58cae Update all CI scripts and mark as executable 2019-10-01 18:07:32 -07:00
Lucien Greathouse
09368e87cf Further update contributing guide on tools 2019-10-01 17:54:53 -07:00
Lucien Greathouse
46858c45b8 Add note about tools for contributing 2019-10-01 17:52:36 -07:00
Lucien Greathouse
fe1a96f850 Improve plugin test running, reducing project duplication 2019-10-01 17:44:24 -07:00
Lucien Greathouse
581449d992 Port more code over to use strict 2019-10-01 17:13:43 -07:00
Lucien Greathouse
15e848d4bf Add new scripts and machinery to make working on plugin easier 2019-10-01 17:13:28 -07:00
Lucien Greathouse
0dbbf44ab2 plugin: Add API interface for strongly typing responses 2019-10-01 16:55:45 -07:00
Lucien Greathouse
c62a5d15ad Add script to build plugin as changes occur 2019-10-01 16:55:15 -07:00
Lucien Greathouse
53bd02a890 Add script to quickly install plugin into LocalAppData 2019-10-01 16:52:20 -07:00
Lucien Greathouse
099aa26ef8 Rough pass on transforming applied patches into API responses 2019-10-01 14:45:24 -07:00
Lucien Greathouse
2598ea3577 Add contributing paths to SnapshotLua, switch to Insta tests 2019-10-01 14:09:05 -07:00
Lucien Greathouse
7be5b36494 Fix unreachable pattern warning 2019-10-01 14:07:50 -07:00
Lucien Greathouse
3dff4d1061 Generate and apply patches, routing them through message queue 2019-10-01 13:59:10 -07:00
Lucien Greathouse
5b7037550d Start ChangeProcessor pumping work 2019-10-01 13:48:16 -07:00
Lucien Greathouse
b94f21402c Expose RojoTree::get_metadata publicly 2019-10-01 13:47:25 -07:00
Lucien Greathouse
9f5875d4bb imfs: move debugging messages outside of converter thread 2019-10-01 13:47:14 -07:00
Lucien Greathouse
694b6101ca New Imfs event type 2019-10-01 11:29:09 -07:00
Lucien Greathouse
1737da9c1f Move ImfsEvent into its own module 2019-10-01 10:44:35 -07:00
Lucien Greathouse
bcf4fea598 Add RojoTree::get_ids_at_path 2019-10-01 10:37:06 -07:00
Lucien Greathouse
90e41f3ce9 Fix bounds on MultiMap::get 2019-10-01 10:36:20 -07:00
Lucien Greathouse
5f5fb51eae Make up terminology for 'instigating path' in instance metadata 2019-10-01 10:32:05 -07:00
Lucien Greathouse
95f06d56d8 Port SnapshotDir tests to use insta snapshots 2019-09-30 18:33:46 -07:00
Lucien Greathouse
1c6788ea45 Migrate from source_path to contributing_paths 2019-09-30 18:12:19 -07:00
Lucien Greathouse
457a8a5cf8 Fix warning in serve_test 2019-09-30 17:37:16 -07:00
Lucien Greathouse
282caf10a5 Expand patch_apply tests 2019-09-30 17:36:37 -07:00
Lucien Greathouse
b2fc6c165b Improve patch application test 2019-09-30 17:22:54 -07:00
Lucien Greathouse
0a1fa9588f Test for AppliedPatchSet result 2019-09-30 17:13:56 -07:00
Lucien Greathouse
5f5bfadf2b Add compute_patch tests for adding/removing children 2019-09-30 17:04:45 -07:00
Lucien Greathouse
b512e707a5 First round of snapshot tests for patch_compute 2019-09-30 17:00:12 -07:00
Lucien Greathouse
3678ddfa36 Break redaction stuff out into separate crate 2019-09-30 16:27:31 -07:00
Lucien Greathouse
ab8aa89f2a Add real networked message type 2019-09-29 20:16:54 -07:00
Lucien Greathouse
fd22482f06 Goodbye Travis 2019-09-27 15:09:35 -07:00
Lucien Greathouse
e741f7b557 Actually generate AppliedPatchSet objects (#250)
* Start actually computing AppliedPatchSet values

* Improve patch_apply documentation and flesh out applied patch code

* Add file link notes

* Stub out where tests for snapshot subsystem will go

* Create baseline tests

* Fix build failure by silencing Clippy
2019-09-27 15:07:11 -07:00
Lucien Greathouse
a70b7ee150 Add GitHub Actions badge 2019-09-27 15:03:57 -07:00
Lucien Greathouse
87227c96ed Document snapshot pipeline 2019-09-26 14:28:04 -07:00
Lucien Greathouse
91d12aeb4f Break out expandable section into a component thing 2019-09-25 17:29:47 -07:00
Lucien Greathouse
b3f132201b Better expandables for the instance debugger 2019-09-25 14:47:07 -07:00
Lucien Greathouse
24b9f552eb Improve imfs debugging page 2019-09-25 11:05:56 -07:00
Lucien Greathouse
b4a8dec68c Track watched paths in ImfsFetcher, exposed via ImfsDebug interface 2019-09-25 10:45:14 -07:00
Lucien Greathouse
c140823bea Move Imfs snapshotting into ImfsDebug 2019-09-24 18:14:48 -07:00
Lucien Greathouse
f166cc93cd Remove unused MessageQueue method 2019-09-24 18:08:32 -07:00
Lucien Greathouse
125c9767f1 Fix warnings around ChangeProcessor 2019-09-24 18:07:33 -07:00
Lucien Greathouse
7b7c978db6 Fix warning and make 'rojo serve' output to stdout 2019-09-24 18:06:31 -07:00
Lucien Greathouse
26fc097672 Add visualizer for IMFS state 2019-09-24 18:04:25 -07:00
Lucien Greathouse
0f2e2406e8 imfs: Correctly mark children_enumerated when calling get_children 2019-09-24 17:58:46 -07:00
Lucien Greathouse
061a096600 Add PathMap::orphans for traversing the map's roots 2019-09-24 17:55:39 -07:00
Lucien Greathouse
07fe963bed Don't include CSS in live asset mode 2019-09-24 17:53:39 -07:00
Lucien Greathouse
7a1eda98ca Implement instance tree visualization 2019-09-24 16:46:19 -07:00
Lucien Greathouse
e8a5e44319 Add abstraction for files to make iteration on UI easier 2019-09-24 14:00:48 -07:00
Lucien Greathouse
486319407a Refactor web UI to be more readable 2019-09-24 11:29:13 -07:00
Lucien Greathouse
4f3d917c9b Add support for snapshotting rbxlx files 2019-09-23 18:13:38 -07:00
Lucien Greathouse
e2761965d5 Add support for serving non-project files directly 2019-09-23 18:00:54 -07:00
Lucien Greathouse
171ab196c8 Update changelog 2019-09-23 17:54:49 -07:00
Lucien Greathouse
5630cea9a0 Improve command line and web interface 2019-09-23 17:54:04 -07:00
Lucien Greathouse
5a4189a770 Move ChangeReceiver main block into its own function 2019-09-23 16:13:19 -07:00
Lucien Greathouse
2440d9fc48 Create ChangeProcessor for routing events from imfs to tree to message queue 2019-09-23 16:09:58 -07:00
Lucien Greathouse
bd33aebc3d Turn messages into stub SubscribeMessage struct 2019-09-23 10:53:11 -07:00
boyned//Kampfkarren
a46d467b75 Fix broken link to sync details (#248) 2019-09-22 17:37:00 -07:00
Lucien Greathouse
8c6981da0d Fix guide to point to release versions instead of alphas 2019-09-20 11:08:01 -07:00
Lucien Greathouse
500a9f647f Fix snapshot test with new version number 2019-09-19 15:26:31 -07:00
Lucien Greathouse
71968fca0d Fold imfs::new back into imfs 2019-09-19 15:25:07 -07:00
Lucien Greathouse
fc6f84897f Update docs link to rojo.space 2019-09-19 14:02:02 -07:00
Lucien Greathouse
b31ad4b1f8 Update version to 0.6.0-dev 2019-09-19 13:58:53 -07:00
Lucien Greathouse
aababf37a8 Catch more HTTP API errors 2019-09-19 13:50:42 -07:00
Lucien Greathouse
44a42a177a Change API errors to be JSON 2019-09-19 13:20:58 -07:00
Lucien Greathouse
e773a92e53 Connect message queue to frontend API 2019-09-19 13:12:21 -07:00
Lucien Greathouse
196d27b959 Allow IMFS testing features to be unused 2019-09-19 11:13:27 -07:00
Lucien Greathouse
ec8861e983 Apply patch sets by value in preparation for AppliedPatchSet 2019-09-19 11:10:25 -07:00
Lucien Greathouse
9b601eb9fe Tidy up patch structs, add AppliedPatchSet 2019-09-19 10:56:10 -07:00
Lucien Greathouse
c80d9cbf01 Add default-members to make 'cargo t' work better 2019-09-19 10:46:09 -07:00
Lucien Greathouse
717c15256f Update GH workflows, bump minimum Rust to 1.36.0 2019-09-17 18:31:02 -07:00
Lucien Greathouse
13dafc2091 Bump minimum Rust in GitHub actions to 1.36.0 2019-09-17 17:31:00 -07:00
Lucien Greathouse
cfc3bcfa41 Switch to single quotes for GitHub action workflow 2019-09-17 16:51:40 -07:00
Lucien Greathouse
2e052e97c5 Experimental GitHub Action 2019-09-17 16:48:51 -07:00
Lucien Greathouse
5d48d05287 Update Changelog 2019-09-13 17:31:53 -07:00
Lucien Greathouse
e34ba844c5 Improve diagnostics for failed instance creation 2019-09-13 17:16:16 -07:00
Lucien Greathouse
1d84d3e440 Wrap RojoTree in Mutex 2019-09-13 12:57:37 -07:00
Lucien Greathouse
7a7e9087e6 Expose imfs from ServeSession 2019-09-13 12:57:22 -07:00
Lucien Greathouse
8481caa67c Add Imfs to ServeSession, threading through generic ImfsFetcher 2019-09-13 12:52:15 -07:00
Lucien Greathouse
651e63a0fb Tidy up docs links in readme 2019-09-11 11:37:58 -07:00
Lucien Greathouse
88e462c4e5 Add help page to direct people to Discord, GitHub, and Twitter 2019-09-11 11:34:52 -07:00
Lucien Greathouse
8ef797d1a4 Start writing real serve tests 2019-09-10 18:04:05 -07:00
Lucien Greathouse
877fd1af35 Make /api/subscribe hang forever instead of returning no messages 2019-09-10 16:42:14 -07:00
Lucien Greathouse
fc01eecdcb Use real Rojo metadata for live sync 2019-09-10 15:59:36 -07:00
Lucien Greathouse
e6ba6203bb Expose tree in API, with hacks to make initial sync-in work sort of 2019-09-10 15:39:50 -07:00
Lucien Greathouse
6a786f18e6 Update plugin protocl version, fix error in error 2019-09-10 15:37:21 -07:00
Lucien Greathouse
57d46287d7 Glue message queue onto ServeSession, simplify some HTTP 2019-09-09 18:32:44 -07:00
Lucien Greathouse
bb6ab74c19 Clean up warnings, add RojoTree into ServeSession 2019-09-09 15:17:03 -07:00
Lucien Greathouse
3e759b3e8e Finish off bulk of metadata tracking in snapshot system 2019-09-09 15:04:57 -07:00
Lucien Greathouse
47ee8d54a8 Clean up some of the instance wrapper APIs 2019-09-09 13:59:36 -07:00
Lucien Greathouse
824b984a64 First pass converting snapshot code over to RojoTree from RbxTree 2019-09-09 13:50:39 -07:00
Lucien Greathouse
618185a52d Start using multimap correctly for path tracking in RojoTree 2019-09-09 11:50:58 -07:00
Lucien Greathouse
8dbc6ab7d3 Start MapSet work 2019-09-06 17:05:01 -07:00
Lucien Greathouse
5eb6754b7c Implement metadata, replacing source field and laying foundations 2019-09-06 14:21:47 -07:00
Lucien Greathouse
a914a92cea Add SnapshotSource property 2019-09-05 11:27:16 -07:00
Lucien Greathouse
439a1a758e Upgrade all snapshots to insta 0.11.0 format 2019-09-03 18:15:53 -07:00
Lucien Greathouse
9383240627 Move rojo-test snapshots into partitioned folders 2019-09-03 18:11:28 -07:00
Lucien Greathouse
ea765eb929 Add serve snapshot test for empty project 2019-09-03 17:56:23 -07:00
Lucien Greathouse
d5c816f24d Document and expose public members for Rojo API 2019-09-03 14:20:12 -07:00
Lucien Greathouse
cf5f20bbb5 Upgrade depdendencies, removing need for opt-level in debug 2019-09-03 14:09:35 -07:00
Lucien Greathouse
27839dfd21 Shuffle web_interface into web::interface 2019-09-03 14:00:31 -07:00
Lucien Greathouse
27517e1aee Rename web::interface to web::ui 2019-09-03 13:58:44 -07:00
Lucien Greathouse
a31bfbefa7 Start extracting web interface from implementation 2019-09-03 13:57:28 -07:00
Lucien Greathouse
f1729163cf Add foundations for 'rojo serve' tests 2019-09-03 13:48:27 -07:00
Lucien Greathouse
6747d97d60 Factor out test utilities in preparation for serve tests 2019-09-03 10:25:48 -07:00
Lucien Greathouse
2fb2342fd4 Fix Lua snapshot code to work with children.
It's also way easier to read now
2019-08-29 17:13:36 -07:00
Lucien Greathouse
0f530b7e80 Add deep-nesting test for folders in folders 2019-08-29 16:38:41 -07:00
Lucien Greathouse
78e3cf4ffb Fix rojo-test tests not running on CI 2019-08-29 16:38:04 -07:00
Lucien Greathouse
4e512b7023 Revert to using Reqwest, reimplement upload command 2019-08-29 16:31:42 -07:00
Lucien Greathouse
ee3fed97e0 Fix parsing of auth cookie data 2019-08-29 16:31:32 -07:00
Jaguar
b45d4f6401 Correct capitalization/typos (#240)
* Fix typo

* Correct capitalization

* Correct capitalization
2019-08-28 21:29:48 -07:00
Lucien Greathouse
d4c28de2c4 Update changelog 2019-08-28 14:34:14 -07:00
Lucien Greathouse
b7d613ace6 Correct bug report repository link 2019-08-28 13:55:12 -07:00
Lucien Greathouse
68dbb31272 Add verbosity level argument 2019-08-28 13:34:20 -07:00
Lucien Greathouse
8fe1fa48b8 Let Rojo pull auth cookie from registry on Windows 2019-08-28 13:21:30 -07:00
Lucien Greathouse
e5575b782c Hide project module, moving towards Rojo API 2019-08-28 12:20:20 -07:00
Lucien Greathouse
ea112dd93d Mark security cookie as optional 2019-08-28 12:09:12 -07:00
Lucien Greathouse
056fc5e087 Remove old 'scratch project' test script, clean up .gitignore 2019-08-27 18:23:05 -07:00
Lucien Greathouse
cacb02b7c8 Fix incorrect license in Cargo.toml 2019-08-27 18:12:15 -07:00
Lucien Greathouse
c0b6ec8ccb Clean up more old plugin gunk 2019-08-27 18:10:15 -07:00
Lucien Greathouse
f4c8f0a3d8 Mark bin/run-plugin-tests.sh as executable 2019-08-27 18:05:17 -07:00
Lucien Greathouse
81407ffe3c Goodbye Lemur and other cruft, hello run-in-roblox-based testing 2019-08-27 18:04:58 -07:00
Lucien Greathouse
6f7dbe99fe Move Rojo server into root of the repository 2019-08-27 16:56:52 -07:00
Lucien Greathouse
ec9afba029 Remove unfinished plugin scaffolding 2019-08-27 16:44:40 -07:00
Lucien Greathouse
6164c5d78d Update dependencies 2019-08-27 16:30:35 -07:00
Lucien Greathouse
94dbcd5c06 Remove unused dependencies, reqwest and rlua (for now) 2019-08-27 16:30:10 -07:00
Lucien Greathouse
4d0dee7ee8 Fix or_fun clippy lint 2019-08-27 16:23:58 -07:00
Lucien Greathouse
49e10698b1 Mark bin/run-tests.sh as executable 2019-08-27 16:06:30 -07:00
Lucien Greathouse
8e1536b59b Restructure Travis config to fail fast 2019-08-27 15:42:55 -07:00
Lucien Greathouse
aed160994a Fix rustfmt error 2019-08-27 15:42:20 -07:00
Lucien Greathouse
b2b3173420 Fix editorconfig to stop fighting rustfmt 2019-08-27 15:42:07 -07:00
Lucien Greathouse
f465af964a Make Travis test rustfmt and clippy 2019-08-27 15:27:25 -07:00
Lucien Greathouse
5a7d6a673a Fix bug caught by clippy 2019-08-27 15:26:51 -07:00
Lucien Greathouse
7fb9aa2115 rustfmt the codebase 2019-08-27 15:10:34 -07:00
Lucien Greathouse
fea303ac8b Major Subsystem Rewrite (Reconciler Mk5) (#217) 2019-08-27 15:00:37 -07:00
Lucien Greathouse
8e8291a0bd Add more stern warning about docs from master branch 2019-08-27 14:52:40 -07:00
Lucien Greathouse
4dc175fcd2 Update docs home for 0.5.x 2019-08-27 14:38:51 -07:00
Lucien Greathouse
009a99a8eb Fix date on Changelog (oops) 2019-08-27 14:26:00 -07:00
Lucien Greathouse
91caa67e04 Release 0.5.0 stable (#234)
* This should be everything?

* Add contributing guide
2019-08-27 14:14:48 -07:00
Lucien Greathouse
53793f7dd2 Update and improve reference documentation 2019-08-26 17:23:59 -07:00
Lucien Greathouse
32af8783ba Update Changelog 2019-08-26 13:52:16 -07:00
Lucien Greathouse
d6f51f8eba Upgrade rbx_dom_lua 2019-08-26 13:52:06 -07:00
Lucien Greathouse
f40b7361e8 Update Changelog 2019-08-21 16:08:58 -07:00
Lucien Greathouse
0231e114d5 Upgrade rbx_dom_lua. Fixes #201. 2019-08-21 15:59:57 -07:00
Lucien Greathouse
ca61a3e83f Add test case for #201 2019-08-21 15:45:22 -07:00
Lucien Greathouse
6979f5c82d Add build tests for init Lua files 2019-08-16 12:50:11 -07:00
Lucien Greathouse
7d45b45667 Change JSON model naming behavior.
- JSON model names now come from the file name
- The 'Name' field is now optional for the top-level instance
- Snapshot tests run way faster by executing Rojo directly instead of Cargo
2019-08-15 14:09:16 -07:00
Lucien Greathouse
7575504b80 Add build test for JSON model 2019-08-14 18:03:19 -07:00
Lucien Greathouse
36bcb611f1 Port CSV regression tests to insta 2019-08-14 15:50:28 -07:00
Lucien Greathouse
cc34c36794 Add CSV snapshot test 2019-08-14 15:34:25 -07:00
Lucien Greathouse
b84cb93d2c Remove test warning 2019-08-14 15:33:00 -07:00
Lucien Greathouse
08211a7740 Add rbxm build test 2019-08-14 15:07:37 -07:00
Lucien Greathouse
97985dd458 Fix test warning that's been in the codebase forever 2019-08-13 11:00:33 -07:00
Lucien Greathouse
edf157215c docs: Embed RDC 2019 video into 'Why Rojo' page.
Closes #227.
2019-08-12 10:28:50 -07:00
Lucien Greathouse
89671c71fa Add basic rbxmx snapshot test 2019-08-10 00:52:16 -07:00
Lucien Greathouse
eeedcc50ab Update rbx-dom dependency URL 2019-08-08 21:36:21 -07:00
Lucien Greathouse
de0bb069aa Reduce Travis-CI build load
- Remove testing with --all-features, no features are supported
- Remove testing beta, it isn't useful and takes up valuable CI time
2019-08-08 21:08:10 -07:00
Lucien Greathouse
5d53f8bfb3 Add script build tests 2019-08-08 18:30:53 -07:00
Lucien Greathouse
d4a7de8070 Update dependencies 2019-08-08 16:57:01 -07:00
Lucien Greathouse
3fe15641c7 Ignore new insta snaps 2019-08-07 17:54:15 -07:00
Lucien Greathouse
08df71a7e4 Change rojo-test to be macro-based 2019-08-07 17:50:05 -07:00
Lucien Greathouse
77db25b4d9 Add end-to-end build tests 2019-08-07 17:41:17 -07:00
Lucien Greathouse
62bb5a28aa v0.5.0-alpha.13 2019-08-02 15:05:58 -07:00
Lucien Greathouse
f768b200d2 Nudge README, hopefully to fix Travis too 2019-08-01 18:07:38 -07:00
Lucien Greathouse
a5b6db74e5 Bump minimum Rust version to 1.34.0 2019-08-01 17:57:13 -07:00
Lucien Greathouse
cbe4467a22 Upgrade dependencies and add SpawnLocation test case 2019-08-01 17:53:29 -07:00
Lucien Greathouse
8417d18eec Upgrade to latest rbx_dom_lua 2019-08-01 17:53:15 -07:00
Lucien Greathouse
93ae8187cd Update CHANGELOG 2019-08-01 16:11:21 -07:00
nukropina
972338d86a Corrected folder name. (#220)
* Corrected folder name.

* Update docs/guide/new-game.md

Co-Authored-By: Lucien Greathouse <me@lpghatguy.com>
2019-07-31 13:18:24 -07:00
Lucien Greathouse
a4a6e3b8f6 Fix serve help message. Fixes #219. 2019-07-31 12:54:46 -07:00
Gskartwii
d788dd3042 Fix broken link in existing-game.md (#218) 2019-07-17 14:30:15 -07:00
Lucien Greathouse
974760f020 Fix installation link from new game guide 2019-07-15 16:34:42 -07:00
Lucien Greathouse
65569c4a60 Update dependencies 2019-07-12 18:21:48 -07:00
Lucien Greathouse
39da45f0bd Fix broken logo 2019-07-08 18:34:26 -07:00
Lucien Greathouse
dc7c27e619 Remove old crusty docs 2019-07-03 14:39:25 -07:00
Lucien Greathouse
90661b7743 Release 0.5.0-alpha.12 2019-07-02 16:46:11 -07:00
Lucien Greathouse
d07571ea7e Theme adjustments 2019-07-02 16:29:59 -07:00
Lucien Greathouse
fbf29e336f Adjust theme colors with new brand, not very pretty yet 2019-07-02 16:27:19 -07:00
Lucien Greathouse
09a0a803a1 Update image branding in the plugin 2019-07-02 16:22:01 -07:00
Lucien Greathouse
dd0327ba85 Update Changelog in prep for next release 2019-07-02 16:18:04 -07:00
Lucien Greathouse
d900887d97 Add a test for meta files attached to Lua scripts 2019-07-02 16:15:24 -07:00
Lucien Greathouse
2a0efe70a5 Add rough tests to ensure broken projects stay broken 2019-07-02 16:09:49 -07:00
Lucien Greathouse
ce09e57315 Tighten up meta files a bit more 2019-07-02 15:53:44 -07:00
Lucien Greathouse
91023c5239 Update more repository links 2019-07-02 15:37:10 -07:00
Lucien Greathouse
714fb10fac Remove old docs scripts and update links to new repo 2019-07-02 15:35:29 -07:00
Lucien Greathouse
aa3e43207f Update documentation to include meta docs 2019-07-02 15:30:56 -07:00
Lucien Greathouse
e045989d39 Update Changelog 2019-06-27 22:31:05 -07:00
Lucien Greathouse
ad5695210d More strict .meta.json files 2019-06-27 22:24:44 -07:00
Lucien Greathouse
4dab6e5008 Update README 2019-06-24 11:27:40 -07:00
Lucien Greathouse
522f26cf4e Update docs config for new repo 2019-06-22 23:41:16 -07:00
Lucien Greathouse
3eca4bc439 Rework README 2019-06-21 18:02:09 -07:00
Lucien Greathouse
b374f67b52 Merge branch 'onboarding-docs' 2019-06-21 17:54:01 -07:00
Lucien Greathouse
c68277be2c Update docs links 2019-06-21 17:51:38 -07:00
Lucien Greathouse
bb8a3e82e6 New doc site 2019-06-21 17:44:08 -07:00
Lucien Greathouse
b511d4ba53 Update dependencies 2019-06-21 17:20:38 -07:00
Lucien Greathouse
fd997d4bda Update README 2019-06-20 15:34:35 -07:00
Lucien Greathouse
21d04a9f85 Add another bullet point 2019-06-19 10:41:44 -07:00
Lucien Greathouse
dcb5c12197 Fill out some new docs 2019-06-17 16:06:25 -07:00
Lucien Greathouse
125e8766c5 Fix failing snapshot test from previous change 2019-06-16 16:46:38 -07:00
Lucien Greathouse
7bce1f6df4 docs: Fix typos on 'Why Rojo' page 2019-06-16 16:29:08 -07:00
Lucien Greathouse
8f66fb6fef Set source path on rbxm/rbxmx models 2019-06-13 17:40:28 -07:00
Lucien Greathouse
711e009e6d Rename InitMeta to ExtraMetadata 2019-06-12 18:33:59 -07:00
Lucien Greathouse
212fe31cb3 Tweak mechanism that ignores .meta.json files 2019-06-12 18:29:48 -07:00
boyned//Kampfkarren
a3dc4fa001 Support for .meta.json files other than init (#189)
* Support for .meta.json files other than init

* Localize .meta.json application
2019-06-12 18:22:47 -07:00
Lucien Greathouse
ff53113358 Add test project for recent project strictness change 2019-06-12 16:02:27 -07:00
Lucien Greathouse
94cbe15b54 Reserve names starting with a dollar sign, closes #191. 2019-06-12 15:54:28 -07:00
Lucien Greathouse
90516e035d Refactor project to start making a little more sense 2019-06-12 15:11:19 -07:00
Lucien Greathouse
c77c754f6d Give plugin GUI a name 2019-06-11 18:00:12 -07:00
Lucien Greathouse
288c52a2cd Updated changelog 2019-06-11 17:56:06 -07:00
Lucien Greathouse
f0fa7326dd Add an icon to the plugin toolbar button 2019-06-11 17:52:12 -07:00
Lucien Greathouse
f29b0f2f26 New UI, simpler 2019-06-11 17:31:42 -07:00
Lucien Greathouse
5dcac24f99 Add a square Rojo logo with transparent background 2019-06-11 15:00:21 -07:00
Lucien Greathouse
1eb11ac377 Add R logo icons 2019-06-11 15:00:09 -07:00
Lucien Greathouse
2e89cdcfad Fix malformed Enum being emitted when using Project::save 2019-06-10 18:05:10 -07:00
Lucien Greathouse
1b0beccd3d Update Changelog 2019-06-10 17:52:44 -07:00
Lucien Greathouse
abb5a72fc4 Update Changelog 2019-06-10 17:47:04 -07:00
Lucien Greathouse
bf706f7586 plugin: Upgrade Roact and rbx-dom 2019-06-10 17:29:03 -07:00
Lucien Greathouse
4459663510 Upgrade rbx-dom dependencies 2019-06-10 17:26:34 -07:00
Lucien Greathouse
68a34dc28b Add a test project with unions 2019-06-10 16:46:05 -07:00
Lucien Greathouse
ba1826587c docs: Add TypeScript section to 'Why Rojo?' 2019-06-07 20:45:59 -07:00
Lucien Greathouse
2e7a8d50b0 Add a warning when trying to load 0.4.x projects 2019-06-07 18:45:30 -07:00
Lucien Greathouse
2a4ca21050 Substantial documentation improvements 2019-06-07 18:29:09 -07:00
boyned//Kampfkarren
0ed6c57c7f init.meta.json support (#183)
* A minimum viable product for init.meta.json

* Properties support

* Add ignoreUnknownChildren support

* Apply requested changes

* Use reflection guiding

* Add a script to the test

* Change to ignoreUnknownInstances

* Apply requested changes
2019-06-06 16:58:58 -07:00
Lucien Greathouse
983d44947e Upgrade rbx-dom 2019-05-31 13:34:54 -07:00
Lucien Greathouse
5bd88dc82f plugin: Switch to Roact refactored bindings branch, with real joinBindings! 2019-05-31 13:23:17 -07:00
Lucien Greathouse
51bbab803f Update CHANGELOG 2019-05-30 23:59:14 -07:00
Lucien Greathouse
a587ba4558 Add warning for rojo build to rbxl 2019-05-30 23:57:35 -07:00
Lucien Greathouse
075b6cca30 Use new rbx_dom_lua API 2019-05-30 18:37:56 -07:00
Lucien Greathouse
4c263bbb3e plugin: Update to newer rbx-dom with better error handling 2019-05-29 18:40:58 -07:00
Lucien Greathouse
420627d892 0.5.0-alpha.11 2019-05-29 14:07:15 -07:00
Lucien Greathouse
ce3a409997 Undo 0.5.0-alpha.10 release due to regression 2019-05-29 13:38:36 -07:00
Lucien Greathouse
0f9f1782ae 0.5.0-alpha.10 2019-05-29 13:24:06 -07:00
Lucien Greathouse
d4704a02c5 Upgrade dependencies 2019-05-29 13:15:22 -07:00
Lucien Greathouse
9ca2ed2c93 plugin: upgrade Roact 2019-05-16 18:45:35 -07:00
Lucien Greathouse
ae12ffdefb Work around Roact bug 2019-05-16 18:45:00 -07:00
Lucien Greathouse
1e13097126 plugin: update rbx-dom 2019-05-16 18:33:37 -07:00
Lucien Greathouse
9b8a6b1168 Add terrain test project 2019-05-16 18:03:11 -07:00
Lucien Greathouse
8f6dda5cd3 Use rbx_xml 0.9.0's config to read unknown properties 2019-05-16 17:58:32 -07:00
Lucien Greathouse
91780f236e Update dependencies 2019-05-16 17:58:19 -07:00
Lucien Greathouse
f16474815c plugin: update rbx-dom 2019-05-15 11:19:05 -07:00
Lucien Greathouse
a8ff6d7e6e Update dependencies 2019-05-14 18:23:01 -07:00
Lucien Greathouse
8395782a2e Use Display instead of Debug for rbx_xml errors now 2019-05-14 17:55:18 -07:00
Lucien Greathouse
28ea625b01 Plugin: Port reconciler to use rbx_dom_lua 2019-05-14 14:22:55 -07:00
Lucien Greathouse
efc569f6ed Plugin: Update rbx-dom 2019-05-14 14:22:44 -07:00
Lucien Greathouse
d377e10771 Update rbx-dom 2019-05-13 17:35:55 -07:00
Lucien Greathouse
fef85877e6 Add safeguards against accidentally committing model or place files 2019-05-13 17:29:41 -07:00
Lucien Greathouse
19135bfaf4 Add RbxDom library as piece of plugin 2019-05-13 17:29:41 -07:00
Lucien Greathouse
5a147fccc2 Add rbx-dom as Git submodule to plugin 2019-05-13 17:29:41 -07:00
Lucien Greathouse
20976814ba Upgrade a bunch of small dependencies 2019-05-12 12:57:59 -07:00
Lucien Greathouse
27e2612fc9 Upgrade rbx_dom_weak, rbx_reflection, and rbx_xml 2019-05-12 12:57:24 -07:00
Lucien Greathouse
3ea432ef2d Fix up docs on model/place files a little 2019-05-09 13:29:03 -07:00
Lucien Greathouse
fe6acbc1e3 Clean up repo cruft 2019-05-04 21:01:10 -07:00
Lucien Greathouse
379b162e64 Fix dependency paths changing.
Roact 1.0 changed from lib to src!
t changed from lib/t.lua to lib/init.lua, so we just use lib
2019-05-04 19:33:08 -07:00
Lucien Greathouse
84832955dd Upgrade to Roact 1.0 and latest t 2019-05-04 00:05:45 -07:00
Lucien Greathouse
34b99a51c3 Relax debug assert in IMFS, since paths can alias now 2019-04-30 23:06:59 -07:00
Lucien Greathouse
fb5245e2af Update dependencies 2019-04-22 18:26:28 -07:00
Diego Alpízar
ff0a830e0c Minor typo fix (#156)
Fix repeated "available available"
2019-04-06 23:38:29 -07:00
eryn L. K
a365f071a4 Update installation.md (#155) 2019-04-05 17:20:53 -07:00
Lucien Greathouse
f290e7b5b2 Support implicit values in JSON models (#154)
* Support implicit values in JSON models

* Update Changelog
2019-04-05 15:17:58 -07:00
Lucien Greathouse
83a0ae673c 0.5.0-alpha.9 2019-04-04 21:20:00 -07:00
Lucien Greathouse
7de646c290 Upgrade dependencies 2019-04-04 18:35:18 -07:00
Lucien Greathouse
5d681a72ac Rewrite CSV conversion to dodge Serde (#152)
* Rewrite CSV conversion to dodge Serde

* Update CHANGELOG
2019-04-04 18:21:55 -07:00
Lucien Greathouse
d725970e6e Fix handling of CSV files with empty columns and rows (#149)
* Fix #147

* Add localization test project, fix empty rows in general

* Fill out 'normal' CSV in localization test project

* Update Changelog
2019-04-04 13:16:10 -07:00
Lucien Greathouse
54b82760cd Switch 'rojo build' to use BufWriter, magic performance increase 2019-04-01 18:02:46 -07:00
Lucien Greathouse
77f79fa913 0.5.0-alpha.8 2019-03-29 17:36:43 -07:00
Lucien Greathouse
6db714a2b1 Special-case Lighting.Technology in setCanonicalProperty, temporary fix 2019-03-29 17:25:57 -07:00
Lucien Greathouse
913ac7c9f5 Update dependencies 2019-03-28 15:44:56 -07:00
Lucien Greathouse
eecbfd29e7 Update dependencies, adding a bunch of new features 2019-03-27 13:31:12 -07:00
Lucien Greathouse
41025225b2 Rewrite message queue with oneshot futures (#139) 2019-03-27 13:27:50 -07:00
Lucien Greathouse
07c7b28c03 Fix plugin unloading 2019-03-21 22:35:30 -07:00
Lucien Greathouse
3faf3d2a56 Update Changelog for #135 2019-03-20 10:42:18 -07:00
Lucien Greathouse
be094d5b7c Make snapshot application communicative (#135)
* Add children sorting to snapshot_reconciler

* Update snapshot tests to include stable children order

* Bump dependencies, which should make this PR work
2019-03-20 10:39:53 -07:00
Lucien Greathouse
459673bd59 0.5.0-alpha.6 2019-03-19 18:24:30 -07:00
Lucien Greathouse
2968b70e6b Listen to Plugin.Unloading.
Closes #127.
2019-03-19 18:17:03 -07:00
Lucien Greathouse
b6989a18fc Add conditionally-enabled typechecking using t 2019-03-19 17:57:19 -07:00
Lucien Greathouse
4d6a504836 Remove Rodux and Roact-Rodux, add t dependency 2019-03-19 16:34:53 -07:00
Lucien Greathouse
6c3737df68 Update Changelog 2019-03-19 16:31:34 -07:00
Lucien Greathouse
9f382ed9bd Iterate on plugin reconciler
- Renamed setProperty to setCanonicalProperty, which is more usefully
  descriptive. Also added a detailed comment.
- Fixed reconciler behavior with regards to removing known instances
  when $ignoreUnknownInstances is set
2019-03-19 16:30:06 -07:00
Lucien Greathouse
f9e86e58d6 Add InstanceMap:destroyInstance for forgetting and destroying in one step 2019-03-19 16:29:56 -07:00
Lucien Greathouse
469f9c927f Improve plugin place project for testing 2019-03-19 16:29:31 -07:00
Lucien Greathouse
312724189b Remove ignore from old doc generator script 2019-03-14 14:20:38 -07:00
Lucien Greathouse
ec0a1f1ce4 New snapshot tests (#134)
* Changes project-related structures to use `BTreeMap` instead of `HashMap` for children to aid determiniusm
* Changes imfs-related structures to have total ordering and use `BTreeSet` instead of `HashSet`
* Upgrades dependencies to `bx_dom_weak`1.2.0 and rbx_xml 0.5.0 to aid in more determinism stuff
* Re-exposes the `RbxSession`'s root project via `root_project()`
* Implements `Default` for a couple things
* Tweaks visualization code to support visualizing trees not attached to an `RbxSession`
* Adds an ID-invariant comparison method for `rbx_tree` relying on previous determinism changes
* Adds a (disabled) test to start finding issues in the reconciler with regards to communicativity of snapshot application
* Adds a snapshot testing system that operates on `RbxTree` and associated metadata, which are committed in this change
2019-03-14 14:20:03 -07:00
Lucien Greathouse
ad93631ef8 Port to futures channel instead of std one.
Fixes #133.
2019-03-12 11:45:39 -07:00
Lucien Greathouse
3b6238ff93 Add more types to plugin 2019-03-11 16:55:42 -07:00
Lucien Greathouse
5b9facee00 Fix up variable naming in serialize_unresolved_minimal 2019-03-11 16:35:54 -07:00
Lucien Greathouse
376f2a554a Better default project, including minimal property types 2019-03-11 16:28:40 -07:00
Lucien Greathouse
5fd0bd3db9 Update/prune dependencies with help of cargo-outdated 2019-03-11 14:12:49 -07:00
Lucien Greathouse
2deb3bbf23 Add notable feature from dependency upgrade 2019-03-11 13:48:02 -07:00
Lucien Greathouse
01bef0c2b8 Update dependencies 2019-03-11 13:47:33 -07:00
Lucien Greathouse
b65a8ce680 0.5.0-alpha.5 2019-03-01 15:40:30 -08:00
Lucien Greathouse
5fc4f63238 Upgrade dependencies 2019-03-01 15:34:16 -08:00
Lucien Greathouse
9b0e0c175b Add missing CHANGELOG note 2019-02-27 17:32:36 -08:00
Lucien Greathouse
eb97e925e6 Flip LiveSession::session_id private, add getter 2019-02-27 14:54:05 -08:00
Lucien Greathouse
16f8975b18 Flip project field of LiveSession private to prepare for multi-project future 2019-02-27 14:51:53 -08:00
Lucien Greathouse
5073fce2f7 Implement LiveSession::restart_with_new_project as foundation for reloading 2019-02-27 14:42:41 -08:00
Lucien Greathouse
cf5036eec6 Fix warnings compiling server 2019-02-27 00:49:38 -08:00
Lucien Greathouse
20be37dd8b Improve error messages from bad snapshots 2019-02-27 00:47:02 -08:00
Lucien Greathouse
93349ae2dc Use rbx_reflection to allow type inference on projects (#130)
* Start dependency on rbx_reflection

* Alive and working, all tests pass

* Update CHANGELOG
2019-02-26 22:51:21 -08:00
Lucien Greathouse
be81de74cd Disable Lua tests for now, since they need features Lemur doesn't have 2019-02-24 00:58:02 -08:00
Lucien Greathouse
88e739090d WIP: Server plugins via rlua (Lua 5.3) (#125)
* Add 'plugins' field to project and add rlua

* Scaffold out new SnapshotContext type (again) with plugin state

* Almost functional snapshot system with rlua proof-of-concept

* Gate plugin config on 'plugins-enabled' feature, tell Travis to test all features

* Guard remaining plugin setup code behind feature

* Bump minimum version to 1.33, should've caught this before

* Whoops, latest Rust is 1.32, not 1.33
2019-02-24 00:31:58 -08:00
Lucien Greathouse
7f324f1957 Update CHANGELOG 2019-02-22 15:57:46 -08:00
Lucien Greathouse
4f31c9e72f Fix /api/read and /api/subscribe, re-add debug output 2019-02-22 15:56:24 -08:00
Lucien Greathouse
c9a663ed39 Remove Rouille and port everything to Hyper 2019-02-22 15:11:27 -08:00
Lucien Greathouse
105d8aeb6b Start to stub out sub-services 2019-02-22 13:08:07 -08:00
Lucien Greathouse
6ea1211bc5 It's alive! 2019-02-22 10:50:14 -08:00
Lucien Greathouse
c13291a598 Break apart web interface between UI and API 2019-02-19 11:44:24 -08:00
Lucien Greathouse
aaa78c618c Move diagnostics page to use Ritz, show server version 2019-02-19 11:27:22 -08:00
Lucien Greathouse
2890c677d4 Bump dependency from rbx_tree 0.2.0 to rbx_dom_weak 0.3.0 2019-02-14 17:22:44 -08:00
Lucien Greathouse
51a010de00 Update CHANGELOG 2019-02-11 13:48:20 -08:00
Lucien Greathouse
ca0aabd814 Preload plugin assets at start.
Closes #121.
2019-02-11 13:47:49 -08:00
Lucien Greathouse
91d1ba1910 Add test for rojoValueToRobloxValue, fails Lemur because of missing APIs right now 2019-02-11 11:43:17 -08:00
Lucien Greathouse
c7c739dc00 Fix test bootstrap script for testing in Studio 2019-02-11 11:43:06 -08:00
Lucien Greathouse
7a8389bf11 Update CHANGELOG 2019-02-11 11:42:40 -08:00
Lucien Greathouse
5f062b8ea3 Make the plugin support non-primitive types 2019-02-11 10:55:03 -08:00
Lucien Greathouse
b9ee14a0f9 Remove unused Cargo features section 2019-02-11 10:27:09 -08:00
Lucien Greathouse
c3baf73455 Update documentation for alpha 4 2019-02-08 18:29:23 -08:00
Lucien Greathouse
4a597e0ba7 0.5.0-alpha.4 2019-02-08 18:20:48 -08:00
Lucien Greathouse
d5f3e25bea New docs 2019-02-08 18:03:46 -08:00
Lucien Greathouse
5e4c1a8359 Flatten out docs 2019-02-08 15:41:17 -08:00
Lucien Greathouse
d86e655ad2 Update CHANGELOG 2019-02-08 14:07:21 -08:00
Lucien Greathouse
80154bbf9f Build with static CRT on Windows, fixes #89. 2019-02-08 13:52:57 -08:00
Lucien Greathouse
be853ba2a7 Improve docs, add internals guide 2019-02-07 17:11:35 -08:00
Lucien Greathouse
4d3036d030 Add more design documentation into the codebase for high-level concepts 2019-02-07 15:26:01 -08:00
Lucien Greathouse
ecb9b5e28f Support nested partitions and partitions directly targeting services (#122)
* Do the nested partition thing

* Tidy up touched code

* Add nested partition test project, not fully functional

* Clean up variable names, move path_metadata mutation strictly into snapshot_reconciler

* Remove path_metadata, snapshotting is now pure

* Factor out snapshot metadata storage to fix a missing case

* Pull instance_name out of per_path_metadata, closer to what we need

* Refactor to make metadata make more sense, part one

* All appears to be well

* Cull 'metadata_per_path' in favor of 'instances_per_path'

* Remove SnapshotContext

* InstanceMetadata -> PublicInstanceMetadata in web module

* Build in snapshot testing system for testing... snapshots?

* Remove pretty_assertions to see if it fixes a snapshot comparison bug

* Reintroduce pretty assertions, it's not the cause of inequality

* Fix snapshot tests with custom relative path serializer
2019-02-07 14:55:01 -08:00
Lucien Greathouse
38e3c198f2 Update README 2019-02-05 10:30:09 -08:00
Lucien Greathouse
2f64501556 Add Rust 1.31.1 as fixed build target to Travis-CI 2019-02-05 10:17:13 -08:00
Lucien Greathouse
2c2554d73d Update docs to talk about default.project.json 2019-02-01 18:03:41 -08:00
Lucien Greathouse
69d1accf3f 0.5.0-alpha.3 2019-02-01 17:19:00 -08:00
Lucien Greathouse
785bdb8ecb Implement new project file name, default.project.json (#120)
* Implement new project file name, default.project.json

* Rename all test projects to default.project.json

* Update CHANGELOG

* Fix warning message typo
2019-02-01 17:06:03 -08:00
Lucien Greathouse
78a1947cec Update CHANGELOG 2019-02-01 13:07:15 -08:00
Paul Doyle
0ff59ecb4e Fix issue w/ existing files not being updated in imfs (#119)
* Fix issue w/ existing files not being updated in imfs

* Add a test for updating files
2019-01-31 20:24:42 -08:00
Lucien Greathouse
b58fed16b4 Fix uses using failure::Error 2019-01-30 10:29:38 -08:00
Lucien Greathouse
6719be02c3 Fall back to showing GraphViz source when GraphViz is not installed 2019-01-29 18:10:14 -08:00
Lucien Greathouse
8757834e07 Improve error reporting for IO issues 2019-01-29 17:29:47 -08:00
Lucien Greathouse
aa243d1b8a Add sweet new live sync homepage 2019-01-28 18:30:42 -08:00
Lucien Greathouse
aeb18eb124 Refactor web code to make routing more clear 2019-01-28 18:23:57 -08:00
Lucien Greathouse
6c3e118ee3 Sort inputs in LiveSession 2019-01-28 17:50:47 -08:00
Lucien Greathouse
3c0fe4d684 Reduce number of threads needed for FsWatcher 2019-01-28 17:11:01 -08:00
Lucien Greathouse
12fd9aa1ef Tack on Cargo.lock, missing from previous commit 2019-01-28 16:03:12 -08:00
Lucien Greathouse
821122a33d 0.5.0-alpha.2 2019-01-28 15:45:52 -08:00
Lucien Greathouse
0d9406d991 Update docs links in README 2019-01-28 15:40:54 -08:00
Lucien Greathouse
350eec3bc7 Update docs and generator to be even smarter 2019-01-28 15:39:11 -08:00
Lucien Greathouse
e700b3105a New, less-kludgy doc generator 2019-01-28 15:31:20 -08:00
Lucien Greathouse
dd2a730b4a Update documentation 2019-01-28 15:16:42 -08:00
Lucien Greathouse
c6766bbe77 Fix timeout issue for real this time 2019-01-28 14:55:56 -08:00
Lucien Greathouse
e5d3204b6c Implement .model.json files
Closes #97.
2019-01-28 14:37:35 -08:00
Lucien Greathouse
4767cbd12b Fix composing-models XML to only contain stuff implemented so far 2019-01-28 14:36:17 -08:00
Lucien Greathouse
deb4118c5d Fix long-polling mixup
Fixes #110.
2019-01-28 14:00:22 -08:00
Lucien Greathouse
4516df5aac Fix message in rbx_session 2019-01-28 13:58:24 -08:00
Lucien Greathouse
663df7bdc2 Remove redundant debug assertions in imfs 2019-01-28 11:23:19 -08:00
Lucien Greathouse
e81f0a4a95 Improve IMFS robustness with out-of-order events
Fixes #111.
2019-01-28 11:03:52 -08:00
Lucien Greathouse
38cd13dc0c 0.5.0-alpha.1 2019-01-25 18:01:37 -08:00
Lucien Greathouse
14fd470363 Upgrade all dependencies, including new rbx_ crates 2019-01-25 17:54:16 -08:00
Lucien Greathouse
fc8d9dc1fe Wrap main call in a panic handler to show a nice error message on panic 2019-01-25 10:54:54 -08:00
Lucien Greathouse
1659adb419 Refactor entrypoint to be a bit easier to read 2019-01-25 10:32:10 -08:00
Lucien Greathouse
6490b77d4c plugin: Hide placeholder inputs when focused 2019-01-23 18:18:00 -08:00
Lucien Greathouse
23463b620e Rename test-plugin-project to place-project.json 2019-01-23 18:14:05 -08:00
Lucien Greathouse
6bc331be75 Update formatting of test plugin project 2019-01-23 18:10:59 -08:00
Lucien Greathouse
87f6410877 Clean up error handling in plugin 2019-01-23 18:10:53 -08:00
Lucien Greathouse
b1ddfc3a49 Fix adding/removing files in folders that have init scripts 2019-01-23 18:10:29 -08:00
Lucien Greathouse
d01e757d2f UI visual tweaks 2019-01-21 18:34:10 -08:00
Lucien Greathouse
e593ce0420 Redesign UI 2019-01-21 17:50:49 -08:00
Lucien Greathouse
578abfabb3 Partial plugin retheme 2019-01-21 16:02:51 -08:00
Lucien Greathouse
aa7b7e43ff Move CHANGELOG closer to keepachangelog.com format 2019-01-21 13:08:50 -08:00
Lucien Greathouse
af4d4e0246 Revamp CHANGES, rename to CHANGELOG 2019-01-21 13:06:14 -08:00
Lucien Greathouse
fecb11cba4 Adjust logging and error handling in the client
* HTTP responses in the error range (400+) now properly turn into errors
* ROJO_EPIPHANY_DEV_CREATE now creates more verbose configuration
* Default configuration values are now much more explicit
* Errors that cause session termination are labeled more clearly.
2019-01-21 10:57:03 -08:00
Lucien Greathouse
614f886008 Fix misnamed metadata coming from server 2019-01-21 10:56:01 -08:00
Lucien Greathouse
6fcb895d70 Tweak bottom of README, move LICENSE to LICENSE.txt 2019-01-18 20:57:19 -08:00
Lucien Greathouse
5a98ede45e Tweak features section of README 2019-01-18 13:49:47 -08:00
Lucien Greathouse
779d462932 Rename Session to LiveSession, a better name 2019-01-17 18:24:49 -08:00
Lucien Greathouse
e301116e87 Make rbx visualization less noisy, removing paths 2019-01-17 17:45:24 -08:00
Lucien Greathouse
bd3a4a719d Normalize metadata into metadata per instance and metadata per path (#107)
* Begin the metadata merge trek

* Tidy up path metadata, entry API, begin implementing

* Flesh out use of PathMap Entry API

* Metadata per instance is a go

* Tidy up naming for metadata per instance

* SnapshotMetadata -> SnapshotContext
2019-01-17 16:48:49 -08:00
Lucien Greathouse
4cfdc72c00 Fix folders having empty names 2019-01-16 17:28:06 -08:00
Lucien Greathouse
3620a9d256 Thread Cow<'str> through for naming nodes 2019-01-16 16:36:22 -08:00
Lucien Greathouse
f254a51d59 Remove unused config button 2019-01-16 00:01:40 -08:00
Lucien Greathouse
99bbe58255 Fix server to correctly resolve module script names 2019-01-15 23:58:25 -08:00
Lucien Greathouse
a400abff4c Switch assets to use custom rounded rectangle 2019-01-15 23:58:10 -08:00
Lucien Greathouse
585806837e Port over to new snapshot system 2019-01-15 18:04:06 -08:00
Lucien Greathouse
249aa999a3 Refactor mostly complete 2019-01-15 17:26:51 -08:00
Lucien Greathouse
aae1d8b34f Add impl_from! macro to shorten up error code 2019-01-15 13:08:02 -08:00
Lucien Greathouse
9d3638fa46 Remove remaining 'extern crate' declarations 2019-01-15 12:44:49 -08:00
Lucien Greathouse
5b2a830d2d Remove #[macro_use] from log crate 2019-01-15 12:43:02 -08:00
Lucien Greathouse
b87943e39d Clean up and document code throughout the server 2019-01-15 12:38:31 -08:00
Lucien Greathouse
c421fd0b25 Add docs link for 0.5.x to complement 0.4.x 2019-01-14 18:36:04 -08:00
Lucien Greathouse
a1395a382a Support semver metadata in plugin version 2019-01-14 18:23:10 -08:00
Lucien Greathouse
a54364642a Upgrade to rbx_tree and friends 0.1.0 2019-01-14 18:21:01 -08:00
Lucien Greathouse
14ab85adbd Remove instanceMetadataMap from ApiContext 2019-01-14 17:23:43 -08:00
Lucien Greathouse
c284b7de40 Remove instanceMetadataMap from plugin 2019-01-14 17:23:43 -08:00
Lucien Greathouse
e23056ac2f Change API to message metadata inline and add visualization 2019-01-14 17:23:43 -08:00
Lucien Greathouse
8ce2e605a2 Remove site_url 2019-01-12 16:34:02 -08:00
Lucien Greathouse
9408247708 Update CHANGELOG 2019-01-12 15:58:45 -08:00
Lucien Greathouse
3e1c467b65 Upgrade and pin deps so that rbx-tree can break some APIs 2019-01-11 18:19:06 -08:00
Lucien Greathouse
811db2e668 0.5.0-alpha.0 2019-01-11 17:53:47 -08:00
Lucien Greathouse
f833642733 Adjust sizing on connection box 2019-01-11 15:51:25 -08:00
Lucien Greathouse
30ce927621 Refactor Session and ApiContext to allow cancelation 2019-01-11 15:45:32 -08:00
Lucien Greathouse
f21f01be1a Factor out form text input 2019-01-11 15:26:25 -08:00
Lucien Greathouse
d81eaa6c13 Revamp UI using Kenney UI assets 2019-01-11 14:10:02 -08:00
Lucien Greathouse
5ad830a6d7 Set up icons, make UI a little more resiliant 2019-01-11 11:57:15 -08:00
Lucien Greathouse
14e1829164 Upgrade dependencies, which makes some rbxm models now work 2019-01-10 18:31:43 -08:00
Lucien Greathouse
0a2810a98b Scaffold out model file support, still needs working decoders 2019-01-10 17:48:19 -08:00
Lucien Greathouse
7b84fce737 Fix syncing projects that mention properties with elevated permissions.
Permission errors aren't reported since I'm not sure what the user could do about them.
Some properties can be set in the model format but not in live-sync mode, like HttpEnabled.
2019-01-10 16:57:44 -08:00
Lucien Greathouse
1e1b409f8b Add support for StringValue instances
Closes #93.
2019-01-10 16:56:43 -08:00
Lucien Greathouse
5f91a8fdfe Fix bug where HTTP being disabled would cause stickiness 2019-01-10 16:12:52 -08:00
Lucien Greathouse
5bb70c2675 Fix up plugin project naming 2019-01-10 15:32:50 -08:00
Lucien Greathouse
ed6d8415bd Make plugin output less verbose 2019-01-10 15:29:38 -08:00
Lucien Greathouse
d53ffd8da2 Add support for uploading models, rename place_id to asset_id 2019-01-10 14:31:41 -08:00
Lucien Greathouse
d52ecaa050 Stop building documentation root, only version-specific docs 2019-01-10 11:15:11 -08:00
Lucien Greathouse
9ac001bd3e Stupid workaround for Git statting files on branch switch 2019-01-09 23:22:42 -08:00
Lucien Greathouse
4b81166782 Pull after switching branches in generate-docs 2019-01-09 23:19:52 -08:00
Lucien Greathouse
95866d0f2e Multiple versions of the docs 2019-01-09 23:14:59 -08:00
Lucien Greathouse
54b8a1aea5 Upgrade to latest MkDocs 2019-01-09 23:10:15 -08:00
Lucien Greathouse
0822aa9240 Update docs for Epiphany 2019-01-09 22:25:04 -08:00
Lucien Greathouse
c883850142 Support -o for build as an --output alias 2019-01-09 22:04:24 -08:00
Lucien Greathouse
54da826447 Implement rojo init for models 2019-01-09 21:30:00 -08:00
Lucien Greathouse
ce5ea92076 Add maplit, flesh out 'init' place command 2019-01-09 21:27:10 -08:00
Lucien Greathouse
98f8c5c0f2 Working 'init' command for places 2019-01-09 21:16:08 -08:00
Lucien Greathouse
6ced8f32b1 Make rojo-e2e a lib so 'cargo run' works again 2019-01-09 20:52:00 -08:00
Lucien Greathouse
f870107c66 Foundations for actual 'rojo init' implementation 2019-01-09 18:16:58 -08:00
Lucien Greathouse
4e7aa5d0a9 Expand changelog 2019-01-09 16:56:39 -08:00
Lucien Greathouse
779bcaeccb Fix CI build (hopefully), migrate to using Cargo workspace 2019-01-09 16:49:23 -08:00
Lucien Greathouse
f2849357f8 Remove crusty example, add property to single-sync-point 2019-01-09 16:28:44 -08:00
Lucien Greathouse
998fca721a Add support for properties metadata in project files 2019-01-09 16:28:31 -08:00
Lucien Greathouse
a83c68f2fc Update dependencies 2019-01-09 16:28:17 -08:00
Lucien Greathouse
665809e11a Remove accidental place file 2019-01-09 16:18:56 -08:00
Lucien Greathouse
a306fa26e0 Add extra diagnostic trace for path_created_or_updated 2019-01-09 13:47:58 -08:00
Lucien Greathouse
9574f8ebd7 Improve snapshot error robustness
* Unknown files are now ignored
* Errors bubble up a level higher
2019-01-09 13:40:46 -08:00
Lucien Greathouse
b62d946f83 Stub out new 'init' command 2019-01-09 11:23:00 -08:00
Lucien Greathouse
b26b36da5d Update CHANGES 2019-01-09 10:52:18 -08:00
Lucien Greathouse
8d640ab467 Add more alternative projects to README 2019-01-09 10:18:21 -08:00
Lucien Greathouse
eff4301027 Add case in reconciler to handle LocalizationTable Contents 2019-01-08 18:30:09 -08:00
Lucien Greathouse
0be4e6921d Implement CSV-format LocalizationTable serialization 2019-01-08 18:16:04 -08:00
Lucien Greathouse
049875e8fc Update plugin config to work with Git master Rojo 2019-01-08 17:19:26 -08:00
Lucien Greathouse
b9f7d3d889 Smarter reconciliation algorithm 2019-01-08 14:23:48 -08:00
Lucien Greathouse
70ba101fe1 Add more types in rbx_snapshot 2019-01-08 11:28:57 -08:00
Lucien Greathouse
b2753cb268 Tidy and document RbxSession more 2019-01-08 11:18:35 -08:00
Lucien Greathouse
11f398b553 Improve init script support
- init.server.lua and init.client.lua are now supported again
- Updating an init script no longer nukes its parent
2019-01-08 10:53:36 -08:00
Lucien Greathouse
24a4099d82 Add TODOs to upload 2019-01-07 14:13:02 -08:00
Lucien Greathouse
99ea374fc5 Add 'upload' command to publish places to Roblox for you 2019-01-07 14:01:53 -08:00
Lucien Greathouse
1992ce1cfb server: Update dependencies 2019-01-07 14:01:34 -08:00
Lucien Greathouse
2724534156 Factor out reconciliation into separate module 2019-01-04 18:34:48 -08:00
Lucien Greathouse
c57989a790 plugin: Title bar in session window, clean up Config 2019-01-04 18:23:11 -08:00
Lucien Greathouse
1888c83b6e server: Update dependencies 2019-01-04 18:22:53 -08:00
Lucien Greathouse
837fd22254 Update README to indicate that the new year happened 2019-01-04 15:44:59 -08:00
Lucien Greathouse
02a3da111a plugin: Fix test runner for new TestEZ 2019-01-04 14:55:53 -08:00
Lucien Greathouse
5c2bf65eaa protocol/config: ignoreUnknown -> ignoreUnknownInstances 2019-01-04 14:30:00 -08:00
Lucien Greathouse
b5ae6a5785 server: Fix broken test from adding more Project fields 2019-01-04 14:21:16 -08:00
Lucien Greathouse
699e07a0f7 plugin: Add support for expectedPlaceIds in the protocol 2019-01-04 14:11:33 -08:00
Lucien Greathouse
b8025452bf server: Make servePlaceId into a list of IDs, servePlaceIds 2019-01-04 14:11:06 -08:00
Lucien Greathouse
1138c05dff plugin: Remove unused import 2019-01-04 13:49:08 -08:00
Lucien Greathouse
ae36688bf2 server: Add servePlaceId for verifying correct place IDs 2019-01-04 13:48:50 -08:00
Lucien Greathouse
64e2ef3d3b Fix build issue, add servePort project option 2019-01-04 13:40:10 -08:00
Lucien Greathouse
9cfeee0577 server: Make 'rojo serve' respect --port option 2019-01-04 13:26:09 -08:00
Lucien Greathouse
86e0f3fabe plugin: UI pretty much done 2019-01-04 11:54:12 -08:00
Lucien Greathouse
edcb3d8638 plugin: ConnectPanel now accepts button callbacks 2019-01-04 11:02:54 -08:00
Lucien Greathouse
1582d8f504 plugin: Migrate 'merge' utility into Dictionary module 2019-01-04 10:59:47 -08:00
Lucien Greathouse
5816bb64dc Start work on plugin UI, this is pretty painful 2019-01-03 18:06:24 -08:00
Lucien Greathouse
b7a28aa511 Upgrade all plugin dependencies 2019-01-03 18:06:11 -08:00
Lucien Greathouse
37ed80055b Remove unused import 2019-01-03 16:28:25 -08:00
Lucien Greathouse
e6c2f1c15d Cleaned up and polished session flow
- Sessions can now be restarted if they error
- Terminology is much easier to follow in the plugin
- More change cases are handled correctly
2019-01-03 15:23:23 -08:00
Lucien Greathouse
a74c11aef5 Expand visualization to show IDs 2019-01-03 15:22:38 -08:00
Lucien Greathouse
ad3999066d Expand diagnostics and exploratively fix some edge cases 2019-01-02 15:16:23 -08:00
Lucien Greathouse
77c10d14c9 Support changing instance ClassName 2019-01-02 14:19:41 -08:00
Lucien Greathouse
8c2e430a56 Add more diagnostics 2019-01-02 14:19:26 -08:00
Lucien Greathouse
0aaefe9a66 C:/Program Files/Git/api/visualize -> /visualize/rbx, added /visualize/imfs 2019-01-02 14:00:35 -08:00
Lucien Greathouse
14db86e4b7 Fix luacheck errors 2019-01-02 13:11:29 -08:00
Lucien Greathouse
9949a6c9ee Implement more reconciliation 2019-01-02 00:21:19 -08:00
Lucien Greathouse
9bf5bd11e2 Add visualization stuff using GraphViz at /api/visualize 2019-01-02 00:18:28 -08:00
Lucien Greathouse
a3cc39cd92 Attempt to preserve sync point names 2019-01-01 23:46:15 -08:00
Lucien Greathouse
45af35cccd Enable stable Rust again 2019-01-01 17:02:46 -08:00
Lucien Greathouse
20e9688268 Fininsh config -> metadata migration 2019-01-01 15:59:26 -08:00
Lucien Greathouse
3be5988083 config_map -> instance_metadata_map 2019-01-01 14:13:21 -08:00
Lucien Greathouse
474d877290 Plugin half of configMap 2018-12-30 22:58:12 -08:00
Lucien Greathouse
b6a2b7dded Fix naming for InstanceProjectNodeConfig 2018-12-30 22:57:22 -08:00
Lucien Greathouse
2e42c28485 Add execute permission to test-scratch-project 2018-12-30 22:57:08 -08:00
Lucien Greathouse
4453211c0d Server component of config maps 2018-12-30 22:43:23 -08:00
Lucien Greathouse
01dd603bd5 Vertically align output for monospace consoles 2018-12-30 21:25:40 -08:00
Lucien Greathouse
fff71e1de0 Accept connections from all addresses 2018-12-30 21:25:22 -08:00
Lucien Greathouse
c0ffbd360e Fix name assignment for sync points 2018-12-30 20:21:46 -08:00
Lucien Greathouse
2f1aadd497 Tinkering with zero testing 2018-12-29 22:59:41 -08:00
Lucien Greathouse
645ab0ae98 Fix up test scratch project snippet to accept a project as an arg 2018-12-17 18:38:29 -08:00
Lucien Greathouse
9ac7ebc335 Hacky reify/reconcile stuff, mostly works 2018-12-17 18:37:38 -08:00
Lucien Greathouse
d807d22350 Basic reification, works for model-like projects but not place-like ones 2018-12-17 17:52:00 -08:00
Lucien Greathouse
05594ecca0 Update timeout detection 2018-12-17 17:51:25 -08:00
Lucien Greathouse
a511a5b259 Upgrade dependencies 2018-12-17 17:36:03 -08:00
Lucien Greathouse
9125f96302 Get rid of intermediate 'modules' folder in plugin 2018-12-17 17:23:07 -08:00
Lucien Greathouse
1b9ab43b6d Path and change tracking working 2018-12-17 17:06:14 -08:00
Lucien Greathouse
1176c9bbf1 Add little harness to test against a new project without accidentally committing junk 2018-12-17 17:05:58 -08:00
Lucien Greathouse
65e551c5cf Move InstanceChanges into rbx_snapshot 2018-12-17 14:20:19 -08:00
Lucien Greathouse
8fadafcd24 Track instance changes inside rbx_snapshot 2018-12-17 14:18:32 -08:00
Lucien Greathouse
57442a4848 Make MessageQueue generic, collapse Message into a single struct 2018-12-17 13:22:29 -08:00
Lucien Greathouse
7154f2c328 Reorganize and clean up rbx_snapshot a bit 2018-12-17 13:02:40 -08:00
Lucien Greathouse
e3e4809446 Flesh out project loading tests 2018-12-17 12:50:40 -08:00
Lucien Greathouse
5707b8c7e8 Descent-based create/update mechanism 2018-12-14 23:34:31 -08:00
Lucien Greathouse
f125814847 Trim up dead/dying code 2018-12-14 21:42:38 -08:00
Lucien Greathouse
893587040d Permute order of FS change events semi-exhaustively 2018-12-14 21:31:48 -08:00
Lucien Greathouse
308369b14f Implement more tests, fix up removal 2018-12-14 18:37:11 -08:00
Lucien Greathouse
9516a1aeea Rework Imfs and expand tests a bit 2018-12-14 18:03:56 -08:00
Lucien Greathouse
f43dc99f7a Imfs test 2018-12-14 14:33:45 -08:00
Lucien Greathouse
3feb8c3344 Fix midnight naming 2018-12-13 15:39:39 -08:00
Lucien Greathouse
4d0a2b806c Remove RbxSnapshotValue for RbxValue
We can always change RbxValue to use Cow<'a, str> instead of String later if perf needs it
2018-12-13 10:53:32 -08:00
Lucien Greathouse
a89fff1a22 Add missing pieces of commit 2018-12-12 23:37:06 -08:00
Lucien Greathouse
52f01da400 Flesh out reconciler routine 2018-12-12 23:11:59 -08:00
Lucien Greathouse
b732c43274 Trimming of stuff to get into the snapshotting mood 2018-12-12 13:56:11 -08:00
Lucien Greathouse
ee0a5cada3 Snapshot madness 2018-12-11 23:30:53 -08:00
Lucien Greathouse
dbd499701f Snapshot tinkering, this is an idea 2018-12-11 18:23:20 -08:00
Lucien Greathouse
fc3f750efb Tweak logic in RbxSession to distinguish create and update 2018-12-03 18:09:01 -08:00
Lucien Greathouse
457f3c8f54 Break out PathMap from RbxSession 2018-12-03 17:39:55 -08:00
Lucien Greathouse
e4d3c3b045 Field name fix, clean up project paths 2018-12-03 17:19:44 -08:00
Lucien Greathouse
e4379e29af Refactor upgrade messaging and version display 2018-12-03 17:04:08 -08:00
Lucien Greathouse
4542febaaf Remove global logging variable 2018-12-03 16:59:04 -08:00
Lucien Greathouse
f691d8a6a5 Clean up DevSettings 2018-12-03 16:57:28 -08:00
Lucien Greathouse
503d7400f3 Add a dev settings feature, keyed off codename right now 2018-12-03 16:54:21 -08:00
Lucien Greathouse
061ea0e7a3 Unify logging 2018-12-03 16:24:28 -08:00
Lucien Greathouse
dd4d542d7e Clean up and start work on Epiphany plugin 2018-12-03 13:54:54 -08:00
Lucien Greathouse
75359e2b83 Upgrade to latest rbx_tree (underscores! ) 2018-12-03 11:58:09 -08:00
Lucien Greathouse
db7f8ffb1b Update to latest rbx-tree 2018-12-03 11:52:06 -08:00
Lucien Greathouse
f59a9040fc Update plugin project files, remove outdated DESIGN doc 2018-12-03 11:48:30 -08:00
Lucien Greathouse
5114d12daf Start using failure for error management 2018-12-03 10:38:26 -08:00
boyned//Kampfkarren
13a7c1ba81 Fixed clippy warnings (#90)
* Fixed clippy warnings

* Fix as per review
2018-12-03 10:35:40 -08:00
Lucien Greathouse
26a7bb9746 Stub out RbxSession::path_updated a bit 2018-12-01 00:01:31 -08:00
Lucien Greathouse
d427f01224 Add Rojo 0.5.0+ config to plugin 2018-11-30 20:33:41 -08:00
Lucien Greathouse
25c73ed917 Add support for binary (rbxl and rbxm) build output 2018-11-30 18:08:03 -08:00
Lucien Greathouse
ce6a9dc448 Update dependencies 2018-11-30 18:02:30 -08:00
Lucien Greathouse
c50922e90c Add ignoreUnknown to project nodes 2018-11-27 23:21:16 -08:00
Lucien Greathouse
bcd5fab33c Add $properties to project nodes, unsure the full ramifications yet 2018-11-27 23:08:37 -08:00
Lucien Greathouse
49a2bc8ace Fix example test 2018-11-27 21:17:38 -08:00
Lucien Greathouse
f1c5268670 Support init.lua and client/server scripts 2018-11-27 17:44:17 -08:00
Lucien Greathouse
29fe7492cc Generate correct names for Lua scripts 2018-11-27 15:51:25 -08:00
Lucien Greathouse
2340a07408 Use project name for root object name 2018-11-27 15:16:48 -08:00
Lucien Greathouse
797c39347f Upgrade dependencies 2018-11-27 15:15:02 -08:00
Lucien Greathouse
5a9d3959e2 Rework RbxSession to drop top-level garbage node, upgrade test-model 2018-11-27 15:11:10 -08:00
Lucien Greathouse
1e0a7dea73 Add test model, shore up 'build' command more 2018-11-27 14:40:19 -08:00
Lucien Greathouse
c61d6a5804 Build out 'build' command 2018-11-27 14:22:06 -08:00
Lucien Greathouse
8aee5c769f Implement build command, shuffle around some internals to make it easier 2018-11-27 14:07:00 -08:00
Lucien Greathouse
7c585fcbce Clean up bin, print better help text 2018-11-27 13:28:43 -08:00
Lucien Greathouse
f7689f3154 Take advantage of 2018 edition.
- Remove explicit 'extern crate' fields where useful
- Fix mutability of variable (unrelated?)
- Add rbxmx dependency, which needs 2018 edition
2018-11-27 10:50:52 -08:00
Lucien Greathouse
6617b8b6c4 Move server to (temporarily) require Rust Beta or stable 1.31+ 2018-11-27 10:45:02 -08:00
Lucien Greathouse
9db31c9191 Stub out build command for generating rbxmx files 2018-11-27 10:38:44 -08:00
Lucien Greathouse
767a59a481 Handle removing folders and their path-to-ID associations better 2018-11-17 20:17:24 -08:00
Lucien Greathouse
f632444a0e Update design graph 2018-11-17 14:58:07 -08:00
Lucien Greathouse
16c3c1f498 Vfs -> Imfs, clean up and document a bit 2018-11-17 13:51:22 -08:00
Lucien Greathouse
c8bb9bf2e9 Break out file watching into FsWatcher object 2018-11-17 13:46:56 -08:00
Lucien Greathouse
729ab25581 Expose more project stuff via the API 2018-11-17 01:14:07 -08:00
Lucien Greathouse
38e0f82812 Clean up VFS code to make it much more robust 2018-11-17 00:04:44 -08:00
Lucien Greathouse
b4fd2e31b3 Cleanup old modules and create more focused code 2018-11-16 23:27:19 -08:00
Lucien Greathouse
e09d23d6c2 RbxSession refactoring stuff 2018-11-16 23:14:32 -08:00
Lucien Greathouse
9ad0eabb85 Syncing sort of works 2018-11-16 20:32:39 -08:00
Lucien Greathouse
fb950cb007 Update test projects 2018-11-16 15:11:24 -08:00
Lucien Greathouse
60c5c2d344 Iterating on project format to make it friendlier 2018-11-16 14:51:14 -08:00
Lucien Greathouse
a29c4f2b65 Fix test warning 2018-11-08 13:25:50 -08:00
Lucien Greathouse
5a99281e23 Make Rojo build with rbx_tree 2018-11-08 13:22:09 -08:00
Lucien Greathouse
31e1f61548 Start refining RbxTree operations, going to be a new crate 2018-10-31 18:07:02 -07:00
Lucien Greathouse
dbad0a16c4 Comment out roblox_studio mechanisms for now, start using env_logger 2018-09-21 18:00:41 -07:00
Lucien Greathouse
a69cbf45df Remove line break in HTTP debug output that studio messes up anyways 2018-08-26 22:17:30 -07:00
Lucien Greathouse
284f423220 Rename 'integration' to 'rojo-e2e' 2018-08-26 01:13:57 -07:00
Lucien Greathouse
81a18e88ad Cooler sounding README 2018-08-26 01:13:20 -07:00
Lucien Greathouse
72bc77f1d5 WIP: Epiphany Refactor (#85) 2018-08-26 01:03:53 -07:00
Lucien Greathouse
80b9b7594b Fix test failure due to bad test 2018-08-14 00:48:53 -07:00
Lucien Greathouse
7e671ee76a Update to latest Lemur 2018-08-14 00:41:37 -07:00
Lucien Greathouse
5d608cb498 Remove old garbage code 2018-08-14 00:41:09 -07:00
Lucien Greathouse
c6982f70b4 Move test projects out of server folder 2018-08-13 15:35:04 -07:00
Lucien Greathouse
ef0d1e7cec Update to latest Lemur 2018-08-13 15:31:36 -07:00
Lucien Greathouse
1db06194c7 Fix module layout to make more sense 2018-08-13 15:24:35 -07:00
Lucien Greathouse
f3e7e54675 Add useless comment 2018-07-17 20:25:04 -07:00
Lucien Greathouse
2bd64db8d9 Add test for modifying file a partition is pointing at directly 2018-07-03 16:32:45 -07:00
Lucien Greathouse
ae8098b80a Do a bit of tinkering with instance names relative to files and partitions 2018-07-03 16:01:34 -07:00
Lucien Greathouse
bfe8dcd224 Try out some nonsense with services being special-ish cased 2018-07-02 18:34:12 -07:00
Lucien Greathouse
8a26994084 Simplify plugin installation by using Plugins instead of InstalledPlugins 2018-06-25 22:10:03 -07:00
Lucien Greathouse
77d0865d58 Remove redundnant comment and unused variable 2018-06-25 18:22:36 -07:00
Lucien Greathouse
bece337d79 Implement rudimentary reifer against new APIs 2018-06-25 17:58:30 -07:00
Lucien Greathouse
5a5da3240f Add plugin bundling, sourced from target/plugin.rbxm 2018-06-25 00:53:21 -07:00
Lucien Greathouse
4138bb7ee1 install_location -> get_install_location 2018-06-24 23:55:13 -07:00
Lucien Greathouse
4088bb47f0 Add comment about roblox_studio::install_location 2018-06-24 23:54:40 -07:00
Lucien Greathouse
d10b6d324e Add roblox_studio module for locating and interacting with install 2018-06-24 21:06:00 -07:00
Lucien Greathouse
43b27831eb Update Lemur and TestEZ 2018-06-24 20:29:51 -07:00
Lucien Greathouse
20c9c89b27 RbxTree robustness
* delete_instance is no longer O(n)
* renamed get_instance to get_instance_and_descendants, which is more accurate
2018-06-24 20:26:58 -07:00
Lucien Greathouse
e1c420d37d Switch RbxValue to an enum 2018-06-24 19:40:50 -07:00
Lucien Greathouse
be58598a3e Make web tests no longer mutate original files 2018-06-24 19:37:30 -07:00
Lucien Greathouse
5e08093609 Update README and CHANGES from 0.4.12 release 2018-06-24 14:09:57 -07:00
Lucien Greathouse
f5599b95b3 Add TODOs to web tests 2018-06-11 15:37:59 -07:00
Lucien Greathouse
ba930ea584 Add TODO 2018-06-11 00:15:49 -07:00
Lucien Greathouse
ba3fa24f9a Tests for modifying projects and using /subscribe 2018-06-11 00:15:15 -07:00
Lucien Greathouse
ff0f5cd49c Test for children, make child matching more robust 2018-06-10 23:44:03 -07:00
Lucien Greathouse
284f5cfb71 Test /read endpoint for single partition case 2018-06-10 23:36:38 -07:00
Lucien Greathouse
871796f172 Merge branch 'master' of github.com:LPGhatguy/rojo 2018-06-10 23:24:19 -07:00
Lucien Greathouse
9733f059c2 Do something wrong instead of crashing for partitions pointing at files 2018-06-10 23:22:07 -07:00
Lucien Greathouse
db71bdfde7 Protocol v2 (0.5.0) (#56) 2018-06-10 23:11:10 -07:00
Lucien Greathouse
9aa27f4c11 Finish merging impl-v2 2018-06-10 23:10:41 -07:00
Lucien Greathouse
8893d0ddde Update README 2018-06-10 23:07:33 -07:00
Lucien Greathouse
0b46860cdd merge impl-v2: DESIGN.md and design.gv 2018-06-10 23:00:51 -07:00
Lucien Greathouse
ec1f9bd706 merge impl-v2: server 2018-06-10 22:59:04 -07:00
Lucien Greathouse
e30545c132 merge impl-v2: plugin 2018-06-10 22:53:22 -07:00
Lucien Greathouse
7d7f671920 merge impl-v2: .editorconfig 2018-06-10 22:50:37 -07:00
Lucien Greathouse
fb7bfa928a Release 0.4.11 2018-06-10 15:54:57 -07:00
Lucien Greathouse
100d69262c Update CHANGES 2018-06-10 15:52:42 -07:00
Lucien Greathouse
5e01658846 Remove straggling debug message 2018-06-10 15:50:30 -07:00
Lucien Greathouse
ccec93aee8 Untangle route terminology a bit 2018-06-10 15:50:03 -07:00
Lucien Greathouse
a089d82023 Fix incorrect route being assigned to init.lua and init.model.json files 2018-06-10 15:44:56 -07:00
Lucien Greathouse
82ba583fa0 Fix incorrect synchronization for Plugin:_pull that would make polling flaky 2018-06-10 15:13:49 -07:00
Lucien Greathouse
1b82044d7d Defensively insert existing instances into RouteMap 2018-06-10 15:03:36 -07:00
Lucien Greathouse
0d49a2e0af Mention VS Code extension in getting started guide 2018-06-02 01:04:31 -07:00
Lucien Greathouse
1343d3a2a9 Pick up rest of changes for 0.4.10, oops 2018-06-02 00:50:35 -07:00
Lucien Greathouse
a86001b85c Release 0.4.10 2018-06-01 23:51:35 -07:00
Lucien Greathouse
d6dd46c467 Fix JsonModelPlugin marking paths as changed correctly 2018-06-01 23:38:49 -07:00
Lucien Greathouse
320974074c Update docs 2018-06-01 23:33:36 -07:00
Lucien Greathouse
7b824abe52 Update CHANGES 2018-06-01 23:30:59 -07:00
Lucien Greathouse
bfd33f4b8d Support init.model.json
Closes #66.
2018-06-01 23:29:39 -07:00
Lucien Greathouse
d5a21a0513 Update plugin .luacheckrc to be more strict 2018-06-01 23:11:58 -07:00
Lucien Greathouse
c894b38f06 Improve plugin API robustness 2018-06-01 23:11:50 -07:00
Lucien Greathouse
a86347ea32 Add typechecks to reconciler and improve robustness a touch 2018-06-01 22:34:11 -07:00
Lucien Greathouse
b60bfc7495 Make nil checks more robust.
This represents an evolution in how I've been thinking about Lua -- using boolean coercion
is generally a bad idea I think because it obscures the underlying types.

It also makes it so that if a boolean is eronneously passed into a function, and it
happens to be a 'false' value, it will be coerced into the nil case instead of being
reported as an error, no matter how unintuitive the resulting error might be.
2018-06-01 22:21:59 -07:00
Lucien Greathouse
4b2f27b26d Fix error when targeting invalid services 2018-06-01 22:17:54 -07:00
Lucien Greathouse
f4d7dda8e3 Make docs on JSON model versioning more explicit 2018-05-26 17:19:37 -07:00
Lucien Greathouse
0d6e3e66ce Release 0.4.9 2018-05-26 17:02:04 -07:00
Lucien Greathouse
7e4d451765 Update Sync Details docs 2018-05-26 17:00:23 -07:00
Lucien Greathouse
804bbc93b7 Make JSON models less strict 2018-05-26 16:59:09 -07:00
Lucien Greathouse
e7fe4ac3ec Remove vestigial backwards syncing functionality.
This functionality won't be present until the refactor in 0.5.0
2018-05-26 16:44:25 -07:00
Lucien Greathouse
40c41b4400 Update Sync Details docs to mention how JSON models work.
Closes #71.
2018-05-26 16:41:38 -07:00
Lucien Greathouse
0936c7c97d Fix indentation in CHANGES 2018-05-26 16:23:13 -07:00
Lucien Greathouse
9ac537d38f Add entry to CHANGES 2018-05-26 16:23:09 -07:00
Lucien Greathouse
fcfd55ff76 Fix error in RouteMap
Closes #72.
2018-05-26 16:19:58 -07:00
Lucien Greathouse
c2495ed57f Release 0.4.8 (oops) 2018-05-25 23:42:31 -07:00
Lucien Greathouse
6ad763fc01 Fix flip-flopped arguments in RouteMap:_removeInternal 2018-05-25 23:40:34 -07:00
Lucien Greathouse
c856a3e361 Release 0.4.7 2018-05-25 23:31:01 -07:00
Lucien Greathouse
aa5f0cc335 Issue a warning if no partitions are specified during serve.
Closes #40
2018-05-22 11:04:53 -07:00
Lucien Greathouse
b067335bbf Update CHANGES 2018-05-22 10:55:23 -07:00
Jonathan Holmes
7d24a14004 Added plugin icons to Rojo (#70) 2018-05-22 10:52:55 -07:00
Lucien Greathouse
910be640e9 Release 0.4.6 2018-05-21 13:26:25 -07:00
Lucien Greathouse
3137753afa Update CHANGES 2018-05-21 13:09:00 -07:00
Lucien Greathouse
000ff351a5 Improve plugin handling with regards to restarts and UI
Closes #67.
2018-05-21 13:05:52 -07:00
Lucien Greathouse
533c8ddaf7 Update CHANGES 2018-05-21 12:55:41 -07:00
Lucien Greathouse
f777d1b6c6 Update CHANGES 2018-05-21 12:52:46 -07:00
Lucien Greathouse
8b17d3b7d9 Intense robustness pass 2018-05-21 12:48:25 -07:00
Lucien Greathouse
6fbe1daf8e Add folder for testing script duplication bug 2018-05-21 12:47:51 -07:00
Lucien Greathouse
3bd191414b Update CHANGES 2018-05-21 11:45:55 -07:00
Lucien Greathouse
fd2cb3495b Make reconciler more robust with regards to RouteMap 2018-05-21 11:21:31 -07:00
Lucien Greathouse
e9d33bdc02 Skip reparenting if parent is the same 2018-05-21 11:16:56 -07:00
Lucien Greathouse
c0f4b31ab3 Make sure all descendants get removed from the RouteMap 2018-05-21 10:40:06 -07:00
Lucien Greathouse
78de30dcf2 Fix missing colon in plugin stopped polling message 2018-05-01 14:36:25 -07:00
Lucien Greathouse
23c59dcae7 0.4.5 2018-05-01 12:29:48 -07:00
Lucien Greathouse
274ba5810b Update to Rouille 2.1 and latest dependencies 2018-04-22 17:35:21 -07:00
Lucien Greathouse
3661d0daec Show name of project when starting server 2018-04-22 17:19:21 -07:00
Lucien Greathouse
f215df891c Decrease debounce timeout, which will make polling much snappier 2018-04-22 16:43:32 -07:00
Lucien Greathouse
ce5fe00a66 Delete Promise.spec.lua 2018-04-21 01:16:19 -07:00
Lucien Greathouse
2d71e3ebea Switch to library version of Promise 2018-04-20 23:26:50 -07:00
Lucien Greathouse
187194a615 Keep track of actual file name in VfsItem.
This should fix the case of a partition pointed directly at a file
turning the object into a `StringValue`.

Fixes #57.
2018-04-20 23:13:43 -07:00
Lucien Greathouse
9e956e593d Expand test project to have a partition targeting a script directly 2018-04-20 23:13:01 -07:00
Lucien Greathouse
c2cfcc7a2c Prevent syncing while a sync is already in progress.
I'm fairly confident that there will be zero cases where the plugin gets
into a bad state where you can't sync.

This change also prefixes most of Rojo's messages with `Rojo:` to make
them easier to identify.

Fixes #61.
2018-04-20 22:29:58 -07:00
Lucien Greathouse
8c482f75dd Improve error messages for 'serve' command.
Rojo now throws an error if no project file could be found.

Fixes #63.
2018-04-20 21:45:48 -07:00
Lucien Greathouse
29a83cb626 Update LICENSE 2018-04-12 00:18:45 -07:00
Lucien Greathouse
a563e4c381 Update LICENSE 2018-04-12 00:13:09 -07:00
Lucien Greathouse
9cee587f22 Remove documentation from README and point to snazzy new documentation website 2018-04-08 00:16:21 -07:00
Lucien Greathouse
b5cc243466 Flesh out documentation, normalize markdown indentation 2018-04-08 00:09:28 -07:00
461 changed files with 61413 additions and 4526 deletions

2
.cargo/config Normal file
View File

@@ -0,0 +1,2 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"]

View File

@@ -3,8 +3,24 @@ root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
[*.json]
[*.{json,js,css}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
[*.md]
indent_style = space
indent_size = 4
[*.{rs,toml}]
indent_style = space
indent_size = 4
insert_final_newline = true
[*.snap]
insert_final_newline = true
[*.lua]
indent_style = tab

36
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
rust_version: [stable, "1.40.0"]
steps:
- uses: actions/checkout@v1
- name: Setup Rust toolchain
run: rustup default ${{ matrix.rust_version }}
- name: Build
run: cargo build --locked --verbose
- name: Run tests
run: cargo test --locked --verbose
- name: Rustfmt and Clippy
run: |
cargo fmt -- --check
cargo clippy
if: matrix.rust_version == 'stable'
- name: Build (All Features)
run: cargo build --locked --verbose --all-features
- name: Run tests (All Features)
run: cargo test --locked --verbose --all-features

60
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Release
on:
push:
tags: ["*"]
jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Build release binary
run: cargo build --verbose --locked --release
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: rojo-win64
path: target/release/rojo.exe
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Build release binary
run: |
source $HOME/.cargo/env
cargo build --verbose --locked --release
env:
OPENSSL_STATIC: 1
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: rojo-macos
path: target/release/rojo
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build
run: cargo build --locked --verbose --release
env:
OPENSSL_STATIC: 1
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: rojo-linux
path: target/release/rojo

19
.gitignore vendored
View File

@@ -1 +1,18 @@
/site
# Rust output directory
/target
# Headers for clibrojo
/include
# Roblox model and place files in the root, used for debugging
/*.rbxm
/*.rbxmx
/*.rbxl
/*.rbxlx
# Roblox Studio holds 'lock' files on places
*.rbxl.lock
*.rbxlx.lock
# Snapshot files from the 'insta' Rust crate
**/*.snap.new

18
.gitmodules vendored
View File

@@ -1,15 +1,15 @@
[submodule "plugin/modules/roact"]
path = plugin/modules/roact
url = https://github.com/Roblox/roact.git
[submodule "plugin/modules/rodux"]
path = plugin/modules/rodux
url = https://github.com/Roblox/rodux.git
[submodule "plugin/modules/roact-rodux"]
path = plugin/modules/roact-rodux
url = https://github.com/Roblox/roact-rodux.git
[submodule "plugin/modules/testez"]
path = plugin/modules/testez
url = https://github.com/Roblox/testez.git
[submodule "plugin/modules/lemur"]
path = plugin/modules/lemur
url = https://github.com/LPGhatguy/lemur.git
[submodule "plugin/modules/promise"]
path = plugin/modules/promise
url = https://github.com/LPGhatguy/roblox-lua-promise.git
[submodule "plugin/modules/t"]
path = plugin/modules/t
url = https://github.com/osyrisrblx/t.git
[submodule "plugin/modules/rbx-dom"]
path = plugin/modules/rbx-dom
url = http://github.com/rojo-rbx/rbx-dom

View File

@@ -13,12 +13,14 @@ stds.roblox = {
-- Types
"Vector2", "Vector3",
"Vector2int16", "Vector3int16",
"Color3",
"UDim", "UDim2",
"Rect",
"CFrame",
"Enum",
"Instance",
"DockWidgetPluginGuiInfo",
}
}

View File

@@ -1,39 +0,0 @@
matrix:
include:
- language: python
env:
- LUA="lua=5.1"
before_install:
- pip install hererocks
- hererocks lua_install -r^ --$LUA
- export PATH=$PATH:$PWD/lua_install/bin
install:
- luarocks install luafilesystem
- luarocks install busted
- luarocks install luacov
- luarocks install luacov-coveralls
- luarocks install luacheck
script:
- cd plugin
- luacheck src
- lua -lluacov spec.lua
after_success:
- cd plugin
- luacov-coveralls -e $TRAVIS_BUILD_DIR/lua_install
- language: rust
rust: stable
script:
- cd server
- cargo test --verbose
- language: rust
rust: beta
script:
- cd server
- cargo test --verbose

308
CHANGELOG.md Normal file
View File

@@ -0,0 +1,308 @@
# Rojo Changelog
## Unreleased Changes for 0.6.x
## [0.6.0 Alpha 3](https://github.com/rojo-rbx/rojo/releases/tag/v0.6.0-alpha.3) (March 13, 2020)
* Added `--watch` argument to `rojo build`. ([#284](https://github.com/rojo-rbx/rojo/pull/284))
* Added dark theme support to plugin. ([#241](https://github.com/rojo-rbx/rojo/issues/241))
* Added a revamped `rojo init` command, which will now create more complete projects.
* Added the `rojo doc` command, which opens Rojo's documentation in your browser.
* Fixed many crashes from malformed projects and filesystem edge cases in `rojo serve`.
* Simplified filesystem access code dramatically.
* Improved error reporting and logging across the board.
* Log messages have a less noisy prefix.
* Any thread panicking now causes Rojo to abort instead of existing as a zombie.
* Errors now have a list of causes, helping make many errors more clear.
## [0.6.0 Alpha 2](https://github.com/rojo-rbx/rojo/releases/tag/v0.6.0-alpha.2) (March 6, 2020)
* Fixed `rojo upload` command always uploading models.
* Removed `--kind` parameter to `rojo upload`; Rojo now automatically uploads the correct kind of asset based on your project file.
## [0.5.4](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.4) (February 26, 2020)
This is a general maintenance release for the Rojo 0.5.x release series.
* Updated reflection database and other dependencies.
* First stable release with binaries for macOS and Linux.
## [0.6.0 Alpha 1](https://github.com/rojo-rbx/rojo/releases/tag/v0.6.0-alpha.1) (January 22, 2020)
### General
* Added support for nested project files. ([#95](https://github.com/rojo-rbx/rojo/issues/95))
* Added project file hot-reloading. ([#10](https://github.com/rojo-rbx/rojo/issues/10)])
* Fixed Rojo dropping Ref properties ([#142](https://github.com/rojo-rbx/rojo/issues/142))
* This means that properties like `PrimaryPart` now work!
* Improved live sync protocol to reduce round-trips and improve syncing consistency.
* Improved support for binary model files and places.
### Command Line
* Added `--verbose`/`-v` flag, which can be specified multiple times to increase verbosity.
* Added support for automatically finding Roblox Studio's auth cookie for `rojo upload` on Windows.
* Added support for building, serving and uploading sources that aren't Rojo projects.
* Improved feedback from `rojo serve`.
* Removed support for legacy `roblox-project.json` projects, deprecated in an early Rojo 0.5.0 alpha.
* Rojo no longer traverses directories upwards looking for project files.
* Though undocumented, Rojo 0.5.x will search for a project file contained in any ancestor folders. This feature was removed to better support other 0.6.x features.
### Roblox Studio Plugin
* Added "connecting" state to improve experience when live syncing.
* Added "error" state to show errors in a place that isn't the output panel.
* Improved diagnostics for when the Rojo plugin cannot create an instance.
## [0.5.3](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.3) (October 15, 2019)
* Fixed an issue where Rojo would throw an error when encountering recently-added instance classes.
## [0.5.2](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.2) (October 14, 2019)
* Fixed an issue where `LocalizationTable` instances would have their column order randomized. ([#173](https://github.com/rojo-rbx/rojo/issues/173))
## [0.5.1](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.1) (October 4, 2019)
* Fixed an issue where Rojo would drop changes if they happened too quickly ([#252](https://github.com/rojo-rbx/rojo/issues/252))
* Improved diagnostics for when the Rojo plugin cannot create an instance.
* Updated dependencies
* This brings Rojo's reflection database from client release 395 to client release 404.
## [0.5.0](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0) (August 27, 2019)
* Changed `.model.json` naming, which may require projects to migrate ambiguous cases:
* The file name now takes precedence over the `Name` field in the model, like Rojo 0.4.x.
* The `Name` field of the top-level instance is now optional. It's recommended that you remove it from your models.
* Rojo will emit a warning when `Name` is specified and does not match the name from the file.
* Fixed `Rect` values being set to `0, 0, 0, 0` when synced with the Rojo plugin. ([#201](https://github.com/rojo-rbx/rojo/issues/201))
* Fixed live-syncing of `PhysicalProperties`, `NumberSequence`, and `ColorSequence` values
## [0.5.0 Alpha 13](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.13) (August 2, 2019)
* Bumped minimum Rust version to 1.34.0.
* Fixed default port documentation in `rojo serve --help` ([#219](https://github.com/rojo-rbx/rojo/issues/219))
* Fixed BrickColor support by upgrading Roblox-related dependencies
## [0.5.0 Alpha 12](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.12) (July 2, 2019)
* Added `.meta.json` files
* `init.meta.json` files replace `init.model.json` files from Rojo 0.4.x ([#183](https://github.com/rojo-rbx/rojo/pull/183))
* Other `.meta.json` files allow attaching extra data to other files ([#189](https://github.com/rojo-rbx/rojo/pull/189))
* Added support for infinite and NaN values in types like `Vector2` when building models and places.
* These types aren't supported for live-syncing yet due to limitations around JSON encoding.
* Added support for using `SharedString` values when building XML models and places.
* Added support for live-syncing `CollectionService` tags.
* Added a warning when building binary place files, since they're still experimental and have bugs.
* Added a warning when trying to use Rojo 0.5.x with a Rojo 0.4.x-only project.
* Added a warning when a Rojo project contains keys that start with `$`, which are reserved names. ([#191](https://github.com/rojo-rbx/rojo/issues/191))
* Rojo now throws an error if unknown keys are found most files.
* Added an icon to the plugin's toolbar button
* Changed the plugin to use a docking widget for all UI.
* Changed the plugin to ignore unknown properties when live-syncing.
* Rojo's approach to this problem might change later, like with a strict model mode ([#190](https://github.com/rojo-rbx/rojo/issues/190)) or another approach.
* Upgraded to reflection database from client release 388.
* Updated Rojo's branding to shift the color palette to make it work better on dark backgrounds
## [0.5.0 Alpha 11](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.11) (May 29, 2019)
* Added support for implicit property values in JSON model files ([#154](https://github.com/rojo-rbx/rojo/pull/154))
* `Content` propertyes can now be specified in projects and model files as regular string literals.
* Added support for `BrickColor` properties.
* Added support for properties added in client release 384, like `Lighting.Technology` being set to `"ShadowMap"`.
* Improved performance when working with XML models and places
* Fixed serializing empty `Content` properties as XML
* Fixed serializing infinite and NaN floating point properties in XML
* Improved compatibility with XML models
* Plugin should now be able to live-sync more properties, and ignore ones it can't, like `Lighting.Technology`.
## 0.5.0 Alpha 10
* This release was a dud due to [issue #176](https://github.com/rojo-rbx/rojo/issues/176) and was rolled back.
## [0.5.0 Alpha 9](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.9) (April 4, 2019)
* Changed `rojo build` to use buffered I/O, which can make it up to 2x faster in some cases.
* Building [*Road Not Taken*](https://github.com/rojo-rbx/roads) to an `rbxlx` file dropped from 150ms to 70ms on my machine
* Fixed `LocalizationTable` instances being made from `csv` files incorrectly interpreting empty rows and columns. ([#149](https://github.com/rojo-rbx/rojo/pull/149))
* Fixed CSV files with entries that parse as numbers causing Rojo to panic. ([#152](https://github.com/rojo-rbx/rojo/pull/152))
* Improved error messages when malformed CSV files are found in a Rojo project.
## [0.5.0 Alpha 8](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.8) (March 29, 2019)
* Added support for a bunch of new types when dealing with XML model/place files:
* `ColorSequence`
* `Float64`
* `Int64`
* `NumberRange`
* `NumberSequence`
* `PhysicalProperties`
* `Ray`
* `Rect`
* `Ref`
* Improved server instance ordering behavior when files are added during a live session ([#135](https://github.com/rojo-rbx/rojo/pull/135))
* Fixed error being thrown when trying to unload the Rojo plugin.
* Added partial fix for [issue #141](https://github.com/rojo-rbx/rojo/issues/141) for `Lighting.Technology`, which should restore live sync functionality for the default project file.
## [0.5.0 Alpha 6](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.6) (March 19, 2019)
* Fixed `rojo init` giving unexpected results by upgrading to `rbx_dom_weak` 1.1.0
* Fixed live server not responding when the Rojo plugin is connected ([#133](https://github.com/rojo-rbx/rojo/issues/133))
* Updated default place file:
* Improved default properties to be closer to Studio's built-in 'Baseplate' template
* Added a baseplate to the project file (Thanks, [@AmaranthineCodices](https://github.com/AmaranthineCodices/)!)
* Added more type support to Rojo plugin
* Fixed some cases where the Rojo plugin would leave around objects that it knows should be deleted
* Updated plugin to correctly listen to `Plugin.Unloading` when installing or uninstalling new plugins
## [0.5.0 Alpha 5](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.5) (March 1, 2019)
* Upgraded core dependencies, which improves compatibility for lots of instance types
* Upgraded from `rbx_tree` 0.2.0 to `rbx_dom_weak` 1.0.0
* Upgraded from `rbx_xml` 0.2.0 to `rbx_xml` 0.4.0
* Upgraded from `rbx_binary` 0.2.0 to `rbx_binary` 0.4.0
* Added support for non-primitive types in the Rojo plugin.
* Types like `Color3` and `CFrame` can now be updated live!
* Fixed plugin assets flashing in on first load ([#121](https://github.com/rojo-rbx/rojo/issues/121))
* Changed Rojo's HTTP server from Rouille to Hyper, which reduced the release size by around a megabyte.
* Added property type inference to projects, which makes specifying services a lot easier ([#130](https://github.com/rojo-rbx/rojo/pull/130))
* Made error messages from invalid and missing files more user-friendly
## [0.5.0 Alpha 4](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.4) (February 8, 2019)
* Added support for nested partitions ([#102](https://github.com/rojo-rbx/rojo/issues/102))
* Added support for 'transmuting' partitions ([#112](https://github.com/rojo-rbx/rojo/issues/112))
* Added support for aliasing filesystem paths ([#105](https://github.com/rojo-rbx/rojo/issues/105))
* Changed Windows builds to statically link the CRT ([#89](https://github.com/rojo-rbx/rojo/issues/89))
## [0.5.0 Alpha 3](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.3) (February 1, 2019)
* Changed default project file name from `roblox-project.json` to `default.project.json` ([#120](https://github.com/rojo-rbx/rojo/pull/120))
* The old file name will still be supported until 0.5.0 is fully released.
* Added warning when loading project files that don't end in `.project.json`
* This new extension enables Rojo to distinguish project files from random JSON files, which is necessary to support nested projects.
* Added new (empty) diagnostic page served from the server
* Added better error messages for when a file is missing that's referenced by a Rojo project
* Added support for visualization endpoints returning GraphViz source when Dot is not available
* Fixed an in-memory filesystem regression introduced recently ([#119](https://github.com/rojo-rbx/rojo/pull/119))
## [0.5.0 Alpha 2](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.2) (January 28, 2019)
* Added support for `.model.json` files, compatible with 0.4.x
* Fixed in-memory filesystem not handling out-of-order filesystem change events
* Fixed long-polling error caused by a promise mixup ([#110](https://github.com/rojo-rbx/rojo/issues/110))
## [0.5.0 Alpha 1](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.1) (January 25, 2019)
* Changed plugin UI to be way prettier
* Thanks to [Reselim](https://github.com/Reselim) for the design!
* Changed plugin error messages to be a little more useful
* Removed unused 'Config' button in plugin UI
* Fixed bug where bad server responses could cause the plugin to be in a bad state
* Upgraded to rbx\_tree, rbx\_xml, and rbx\_binary 0.2.0, which dramatically expands the kinds of properties that Rojo can handle, especially in XML.
## [0.5.0 Alpha 0](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.0) (January 14, 2019)
* "Epiphany" rewrite, in progress since the beginning of time
* New live sync protocol
* Uses HTTP long polling to reduce request count and improve responsiveness
* New project format
* Hierarchical, preventing overlapping partitions
* Added `rojo build` command
* Generates `rbxm`, `rbxmx`, `rbxl`, or `rbxlx` files out of your project
* Usage: `rojo build <PROJECT> --output <OUTPUT>.rbxm`
* Added `rojo upload` command
* Generates and uploads a place or model to roblox.com out of your project
* Usage: `rojo upload <PROJECT> --cookie "<ROBLOSECURITY>" --asset_id <PLACE_ID>`
* New plugin
* Only one button now, "Connect"
* New UI to pick server address and port
* Better error reporting
* Added support for `.csv` files turning into `LocalizationTable` instances
* Added support for `.txt` files turning into `StringValue` instances
* Added debug visualization code to diagnose problems
* `/visualize/rbx` and `/visualize/imfs` show instance and file state respectively; they require GraphViz to be installed on your machine.
* Added optional place ID restrictions to project files
* This helps prevent syncing in content to the wrong place
* Multiple places can be specified, like when building a multi-place game
* Added support for specifying properties on services in project files
## [0.4.13](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.13) (November 12, 2018)
* When `rojo.json` points to a file or directory that does not exist, Rojo now issues a warning instead of throwing an error and exiting
## [0.4.12](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.12) (June 21, 2018)
* Fixed obscure assertion failure when renaming or deleting files ([#78](https://github.com/rojo-rbx/rojo/issues/78))
* Added a `PluginAction` for the sync in command, which should help with some automation scripts ([#80](https://github.com/rojo-rbx/rojo/pull/80))
## [0.4.11](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.11) (June 10, 2018)
* Defensively insert existing instances into RouteMap; should fix most duplication cases when syncing into existing trees.
* Fixed incorrect synchronization from `Plugin:_pull` that would cause polling to create issues
* Fixed incorrect file routes being assigned to `init.lua` and `init.model.json` files
* Untangled route handling-internals slightly
## [0.4.10](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.10) (June 2, 2018)
* Added support for `init.model.json` files, which enable versioning `Tool` instances (among other things) with Rojo. ([#66](https://github.com/rojo-rbx/rojo/issues/66))
* Fixed obscure error when syncing into an invalid service.
* Fixed multiple sync processes occurring when a server ID mismatch is detected.
## [0.4.9](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.9) (May 26, 2018)
* Fixed warning when renaming or removing files that would sometimes corrupt the instance cache ([#72](https://github.com/rojo-rbx/rojo/pull/72))
* JSON models are no longer as strict -- `Children` and `Properties` are now optional.
## [0.4.8](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.8) (May 26, 2018)
* Hotfix to prevent errors from being thrown when objects managed by Rojo are deleted
## [0.4.7](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.7) (May 25, 2018)
* Added icons to the Rojo plugin, made by [@Vorlias](https://github.com/Vorlias)! ([#70](https://github.com/rojo-rbx/rojo/pull/70))
* Server will now issue a warning if no partitions are specified in `rojo serve` ([#40](https://github.com/rojo-rbx/rojo/issues/40))
## [0.4.6](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.6) (May 21, 2018)
* Rojo handles being restarted by Roblox Studio more gracefully ([#67](https://github.com/rojo-rbx/rojo/issues/67))
* Folders should no longer get collapsed when syncing occurs.
* **Significant** robustness improvements with regards to caching.
* **This should catch all existing script duplication bugs.**
* If there are any bugs with script duplication or caching in the future, restarting the Rojo server process will fix them for that session.
* Fixed message in plugin not being prefixed with `Rojo: `.
## [0.4.5](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.5) (May 1, 2018)
* Rojo messages are now prefixed with `Rojo: ` to make them stand out in the output more.
* Fixed server to notice file changes *much* more quickly. (200ms vs 1000ms)
* Server now lists name of project when starting up.
* Rojo now throws an error if no project file is found. ([#63](https://github.com/rojo-rbx/rojo/issues/63))
* Fixed multiple sync operations occuring at the same time. ([#61](https://github.com/rojo-rbx/rojo/issues/61))
* Partitions targeting files directly now work as expected. ([#57](https://github.com/rojo-rbx/rojo/issues/57))
## [0.4.4](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.4) (April 7, 2018)
* Fix small regression introduced in 0.4.3
## [0.4.3](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.3) (April 7, 2018)
* Plugin now automatically selects `HttpService` if it determines that HTTP isn't enabled ([#58](https://github.com/rojo-rbx/rojo/pull/58))
* Plugin now has much more robust handling and will wipe all state when the server changes.
* This should fix issues that would otherwise be solved by restarting Roblox Studio.
## [0.4.2](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.2) (April 4, 2018)
* Fixed final case of duplicated instance insertion, caused by reconciled instances not being inserted into `RouteMap`.
* The reconciler is still not a perfect solution, especially if script instances get moved around without being destroyed. I don't think this can be fixed before a big refactor.
## [0.4.1](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.1) (April 1, 2018)
* Merged plugin repository into main Rojo repository for easier tracking.
* Improved `RouteMap` object tracking; this should fix some cases of duplicated instances being synced into the tree.
## [0.4.0](https://github.com/rojo-rbx/rojo/releases/tag/v0.4.0) (March 27, 2018)
* Protocol version 1, which shifts more responsibility onto the server
* This is a **major breaking** change!
* The server now has a content of 'filter plugins', which transform data at various stages in the pipeline
* The server now exposes Roblox instance objects instead of file contents, which lines up with how `rojo pack` will work, and paves the way for more robust syncing.
* Added `*.model.json` files, which let you embed small Roblox objects into your Rojo tree.
* Improved error messages in some cases ([#46](https://github.com/rojo-rbx/rojo/issues/46))
## [0.3.2](https://github.com/rojo-rbx/rojo/releases/tag/v0.3.2) (December 20, 2017)
* Fixed `rojo serve` failing to correctly construct an absolute root path when passed as an argument
* Fixed intense CPU usage when running `rojo serve`
## [0.3.1](https://github.com/rojo-rbx/rojo/releases/tag/v0.3.1) (December 14, 2017)
* Improved error reporting when invalid JSON is found in a `rojo.json` project
* These messages are passed on from Serde
## [0.3.0](https://github.com/rojo-rbx/rojo/releases/tag/v0.3.0) (December 12, 2017)
* Factored out the plugin into a separate repository
* Fixed server when using a file as a partition
* Previously, trailing slashes were put on the end of a partition even if the read request was an empty string. This broke file reading on Windows when a partition pointed to a file instead of a directory!
* Started running automatic tests on Travis CI (#9)
## [0.2.3](https://github.com/rojo-rbx/rojo/releases/tag/v0.2.3) (December 4, 2017)
* Plugin only release
* Tightened `init` file rules to only match script files
* Previously, Rojo would sometimes pick up the wrong file when syncing
## [0.2.2](https://github.com/rojo-rbx/rojo/releases/tag/v0.2.2) (December 1, 2017)
* Plugin only release
* Fixed broken reconciliation behavior with `init` files
## [0.2.1](https://github.com/rojo-rbx/rojo/releases/tag/v0.2.1) (December 1, 2017)
* Plugin only release
* Changes default port to 8000
## [0.2.0](https://github.com/rojo-rbx/rojo/releases/tag/v0.2.0) (December 1, 2017)
* Support for `init.lua` like rbxfs and rbxpacker
* More robust syncing with a new reconciler
## [0.1.0](https://github.com/rojo-rbx/rojo/releases/tag/v0.1.0) (November 29, 2017)
* Initial release, functionally very similar to [rbxfs](https://github.com/rojo-rbx/rbxfs)

View File

@@ -1,62 +0,0 @@
# Rojo Change Log
## Current Master
*No changes*
## 0.4.4 (April 7, 2018)
* Fix small regression introduced in 0.4.3
## 0.4.3 (April 7, 2018)
* Plugin now automatically selects `HttpService` if it determines that HTTP isn't enabled ([#58](https://github.com/LPGhatguy/rojo/pull/58))
* Plugin now has much more robust handling and will wipe all state when the server changes.
* This should fix issues that would otherwise be solved by restarting Roblox Studio.
## 0.4.2 (April 4, 2018)
* Fixed final case of duplicated instance insertion, caused by reconciled instances not being inserted into `RouteMap`.
* The reconciler is still not a perfect solution, especially if script instances get moved around without being destroyed. I don't think this can be fixed before a big refactor.
## 0.4.1 (April 1, 2018)
* Merged plugin repository into main Rojo repository for easier tracking.
* Improved `RouteMap` object tracking; this should fix some cases of duplicated instances being synced into the tree.
## 0.4.0 (March 27, 2018)
* Protocol version 1, which shifts more responsibility onto the server
* This is a **major breaking** change!
* The server now has a content of 'filter plugins', which transform data at various stages in the pipeline
* The server now exposes Roblox instance objects instead of file contents, which lines up with how `rojo pack` will work, and paves the way for more robust syncing.
* Added `*.model.json` files, which let you embed small Roblox objects into your Rojo tree.
* Improved error messages in some cases ([#46](https://github.com/LPGhatguy/rojo/issues/46))
## 0.3.2 (December 20, 2017)
* Fixed `rojo serve` failing to correctly construct an absolute root path when passed as an argument
* Fixed intense CPU usage when running `rojo serve`
## 0.3.1 (December 14, 2017)
* Improved error reporting when invalid JSON is found in a `rojo.json` project
* These messages are passed on from Serde
## 0.3.0 (December 12, 2017)
* Factored out the plugin into a separate repository
* Fixed server when using a file as a partition
* Previously, trailing slashes were put on the end of a partition even if the read request was an empty string. This broke file reading on Windows when a partition pointed to a file instead of a directory!
* Started running automatic tests on Travis CI (#9)
## 0.2.3 (December 4, 2017)
* Plugin only release
* Tightened `init` file rules to only match script files
* Previously, Rojo would sometimes pick up the wrong file when syncing
## 0.2.2 (December 1, 2017)
* Plugin only release
* Fixed broken reconciliation behavior with `init` files
## 0.2.1 (December 1, 2017)
* Plugin only release
* Changes default port to 8000
## 0.2.0 (December 1, 2017)
* Support for `init.lua` like rbxfs and rbxpacker
* More robust syncing with a new reconciler
## 0.1.0 (November 29, 2017)
* Initial release, functionally very similar to [rbxfs](https://github.com/LPGhatguy/rbxfs)

55
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,55 @@
# Contributing to the Rojo Project
Rojo is a big project and can always use more help! This guide covers all repositories underneath the [rojo-rbx organization on GitHub](https://github.com/rojo-rbx).
Some of the repositories covered are:
* https://github.com/rojo-rbx/rojo
* https://github.com/rojo-rbx/rbx-dom
* https://github.com/rojo-rbx/vscode-rojo
* https://github.com/rojo-rbx/rbxlx-to-rojo
## Code
Code contributions are welcome for features and bugs that have been reported in the project's bug tracker. We want to make sure that no one wastes their time, so be sure to talk with maintainers about what changes would be accepted before doing any work!
You'll want these tools to work on Rojo:
* Latest stable Rust compiler
* Latest stable [Rojo](https://github.com/rojo-rbx/rojo)
* Latest stable [Remodel](https://github.com/rojo-rbx/remodel)
* Latest stable [run-in-roblox](https://github.com/rojo-rbx/run-in-roblox)
## Documentation
Documentation impacts way more people than the individual lines of code we write.
If you find any problems in documentation, including typos, bad grammar, misleading phrasing, or missing content, feel free to file issues and pull requests to fix them.
## Bug Reports and Feature Requests
Most of the tools around Rojo try to be clear when an issue is a bug. Even if they aren't, sometimes things don't work quite right.
Sometimes there's something that Rojo doesn't do that it probably should.
Please file issues and we'll try to help figure out what the best way forward is.
## Pushing a Rojo Release
The Rojo release process is pretty manual right now. If you need to do it, here's how:
1. Bump server version in [`server/Cargo.toml`](server/Cargo.toml)
2. Bump plugin version in [`plugin/src/Config.lua`](plugin/src/Config.lua)
3. Run `cargo test` to update `Cargo.lock` and double-check tests
4. Update [`CHANGELOG.md`](CHANGELOG.md)
5. Commit!
* `git add . && git commit -m "Release vX.Y.Z"`
6. Tag the commit with the version from `Cargo.toml` prepended with a v, like `v0.4.13`
7. Build Windows release build of CLI
* `cargo build --release`
7. Publish the CLI
* `cargo publish`
8. Build and upload the plugin
* `rojo build plugin -o Rojo.rbxm`
* Upload `Rojo.rbxm` to Roblox.com, keep it for later
9. Push commits and tags
* `git push && git push --tags`
10. Copy GitHub release content from previous release
* Update the leading text with a summary about the release
* Paste the changelog notes (as-is!) from [`CHANGELOG.md`](CHANGELOG.md)
* Write a small summary of each major feature

2796
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

109
Cargo.toml Normal file
View File

@@ -0,0 +1,109 @@
[package]
name = "rojo"
version = "0.6.0-alpha.3"
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
description = "Enables professional-grade development tools for Roblox developers"
license = "MPL-2.0"
homepage = "https://rojo.space"
documentation = "https://rojo.space/docs"
repository = "https://github.com/rojo-rbx/rojo"
readme = "README.md"
edition = "2018"
exclude = [
"/plugin/**",
"/test-projects/**",
]
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"
[features]
default = []
# Turn on support for specifying glob ignore path rules in the project format.
unstable_glob_ignore_paths = []
# Turn on the server half of Rojo's unstable two-way sync feature.
unstable_two_way_sync = []
# Enable this feature to live-reload assets from the web UI.
dev_live_assets = []
[workspace]
members = [
"rojo-test",
"rojo-insta-ext",
"clibrojo",
"memofs",
]
default-members = [
".",
"rojo-test",
"rojo-insta-ext",
"memofs",
]
[lib]
name = "librojo"
path = "src/lib.rs"
[[bin]]
name = "rojo"
path = "src/bin.rs"
[[bench]]
name = "build"
harness = false
[dependencies]
memofs = { version = "0.1.0", path = "memofs" }
backtrace = "0.3"
crossbeam-channel = "0.4.0"
csv = "1.1.1"
env_logger = "0.7.1"
futures = "0.1.29"
globset = "0.4.4"
humantime = "1.3.0"
hyper = "0.12.35"
jod-thread = "0.1.0"
lazy_static = "1.4.0"
log = "0.4.8"
maplit = "1.0.1"
notify = "4.0.14"
opener = "0.4.1"
rbx_binary = "0.5.0"
rbx_dom_weak = "1.10.1"
rbx_reflection = "3.3.408"
rbx_xml = "0.11.3"
regex = "1.3.1"
reqwest = "0.9.20"
ritz = "0.1.0"
rlua = "0.17.0"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
snafu = "0.6.0"
structopt = "0.3.5"
termcolor = "1.0.5"
tokio = "0.1.22"
uuid = { version = "0.8.1", features = ["v4", "serde"] }
[target.'cfg(windows)'.dependencies]
winreg = "0.6.2"
[dev-dependencies]
rojo-insta-ext = { path = "rojo-insta-ext" }
criterion = "0.3"
insta = { version = "0.13.1", features = ["redactions"] }
lazy_static = "1.2"
paste = "0.1"
pretty_assertions = "0.6.1"
serde_yaml = "0.8.9"
tempfile = "3.0"
walkdir = "2.1"

View File

@@ -1,49 +0,0 @@
# Rojo Design - Protocol Version 1
This is a super rough draft that I'm trying to use to lay out some of my thoughts.
## API
### POST `/read`
Accepts a `Vec<Route>` of items to read.
Returns `Vec<Option<RbxInstance>>`, in the same order as the request.
### POST `/write`
Accepts a `Vec<{ Route, RbxInstance }>` of items to write.
I imagine that the `Name` attribute of the top-level `RbxInstance` would be ignored in favor of the route name?
## CLI
The `rojo serve` command uses three major components:
* A Virtual Filesystem (VFS), which exposes the filesystem as `VfsItem` objects
* A VFS watcher, which tracks changes to the filesystem and logs them
* An HTTP API, which exposes an interface to the Roblox Studio plugin
### Transform Plugins
Transform plugins (or filter plugins?) can interject in three places:
* Transform a `VfsItem` that's being read into an `RbxInstance` in the VFS
* Transform an `RbxInstance` that's being written into a `VfsItem` in the VFS
* Transform a file change into paths that need to be updated in the VFS watcher
The plan is to have several built-in plugins that can be rearranged/configured in project settings:
* Base plugin
* Transforms all unhandled files to/from StringValue objects
* Script plugin
* Transforms `*.lua` files to their appropriate file types
* JSON/rbxmx/rbxlx model plugin
* External binary plugin
* User passes a binary name (like `moonc`) that modifies file contents
## Roblox Studio Plugin
With the protocol version 1 change, the Roblox Studio plugin got a lot simpler. Notably, the plugin doesn't need to be aware of anything about the filesystem's semantics, which is super handy.
## Bi-directional syncing
Quenty laid out a good way to handle bi-directional syncing.
When receiving a change from the plugin:
1. Hash the new contents of the file, store it in a map from routes to hashes
2. Write the new file contents to the filesystem
3. Later down the line, receive a change event from the filesystem watcher
4. When receiving a change, if the item is in the hash map, read it and hash those contents
5. If the hash matches the last noted hash, discard the change, else continue as normal

373
LICENSE.txt Normal file
View File

@@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

215
README.md
View File

@@ -1,206 +1,55 @@
<div align="center">
<img src="assets/rojo-logo.png" alt="Rojo" height="217" />
<a href="https://rojo.space">
<img src="assets/logo-512.png" alt="Rojo" height="217" />
</a>
</div>
<div>&nbsp;</div>
<div align="center">
<a href="https://travis-ci.org/LPGhatguy/rojo">
<img src="https://api.travis-ci.org/LPGhatguy/rojo.svg?branch=master" alt="Travis-CI Build Status" />
</a>
<img src="https://img.shields.io/badge/latest_version-0.4.4-brightgreen.svg" alt="Current server version" />
<a href="https://github.com/rojo-rbx/rojo/actions">
<img src="https://github.com/rojo-rbx/rojo/workflows/CI/badge.svg" alt="Actions status" />
</a>
<a href="https://crates.io/crates/rojo">
<img src="https://img.shields.io/crates/v/rojo.svg?label=latest%20release" alt="Latest server version" />
</a>
<a href="https://rojo.space/docs/0.5.x">
<img src="https://img.shields.io/badge/docs-0.5.x-brightgreen.svg" alt="Rojo 0.5.x Documentation" />
</a>
</div>
<hr />
**Rojo** is a flexible multi-tool designed for creating robust Roblox projects.
**Rojo** is a tool designed to enable Roblox developers to use professional-grade software engineering tools.
It's designed for power users who want to use the **best tools available** for building games, libraries, and plugins.
With Rojo, it's possible to use industry-leading tools like **Visual Studio Code** and **Git**.
Rojo is designed for power users who want to use the best tools available for building games, libraries, and plugins.
## Features
Rojo lets you:
Rojo enables:
* Work on scripts from the filesystem, in your favorite editor
* Version your place, library, or plugin using Git or another VCS
* Sync JSON-format models from the filesystem into your game
* Working on scripts and models from the filesystem, in your favorite editor
* Versioning your game, library, or plugin using Git or another VCS
* Streaming `rbxmx` and `rbxm` models into your game in real time
* Packaging and deploying your project to Roblox.com from the command line
Later this year, Rojo will be able to:
Soon, Rojo will be able to:
* Sync `rbxmx` models between the filesystem and Roblox Studio
* Package projects into `rbxmx` files from the command line
* Automatically convert your existing game to work with Rojo
* Sync instances from Roblox Studio to the filesystem
* Automatically manage your assets on Roblox.com, like images and sounds
* Import custom instances like MoonScript code
## Installation
Rojo has two components:
* The server, a binary written in Rust
* The plugin, a Roblox Studio plugin written in Lua
It's important that the plugin and server are compatible. The plugin will show errors in the Roblox Studio Output window if there is a version mismatch.
To install the server, either:
* If you have Rust installed, use `cargo install rojo`
* Or, download a pre-built Windows binary from [the GitHub releases page](https://github.com/LPGhatguy/rojo/releases)
To install the plugin, either:
* Install the plugin from the [Roblox plugin page](https://www.roblox.com/library/1211549683/Rojo).
* This gives you less control over what version you install -- you will always have the latest version.
* Or, download the latest release from [the GitHub releases section](https://github.com/LPGhatguy/rojo/releases) and install it into your Roblox plugins folder
* You can open this folder by clicking the "Plugins Folder" button from the Plugins toolbar in Roblox Studio
## Server Usage
For more help, use `rojo help`.
### New Project
Create a new folder, then use `rojo init` inside that folder to initialize an empty project:
```sh
mkdir my-new-project
cd my-new-project
rojo init
```
Rojo will create an empty project file named `rojo.json` in the directory.
The default project file is:
```json
{
"name": "my-new-project",
"servePort": 8000,
"partitions": {}
}
```
### Start Dev Server
To start the Rojo dev server, use:
```sh
rojo serve
```
The tool will tell you whether it found an existing project. You should then be able to connect and use the project from within Roblox Studio!
### Migrating an Existing Roblox Project
[Bi-directional script syncing](https://github.com/LPGhatguy/rojo/issues/5) is on the roadmap for Rojo this year, but isn't implemented.
In the mean-time, manually migrating scripts is probably the best route forward.
### Syncing into Roblox
In order to sync code into Roblox, you'll need to add one or more *partitions* to your configuration. A partition tells Rojo how to map directories on your filesystem to Roblox objects.
Each entry in the `partitions` map has a unique name, a filesystem path, and the full name of the Roblox object to sync into.
For example, if you want to map your `src` directory to an object named `My Cool Game` in `ReplicatedStorage`, you could use this configuration:
```json
{
"name": "rojo",
"servePort": 8000,
"partitions": {
"game": {
"path": "src",
"target": "ReplicatedStorage.My Cool Game"
}
}
}
```
The `path` parameter is relative to the project file.
The `target` parameter is a path to a Roblox object to link the partition to, starting at `game`. If any objects don't exist along the way, Rojo will try to create them.
**Any objects in a partition may be wiped away by Rojo after syncing! If this is not desired, use multiple, smaller partitions.**
Run `rojo serve` in the directory containing this project, then press the "Sync In" or "Toggle Polling" buttons in the Roblox Studio plugin to sync into your game.
### Sync Details
The structure of files and diectories on the filesystem are preserved when syncing into game.
Creation of Roblox instances follows a simple set of rules. The first rule that matches the file name is chosen:
| File Name | Instance Type | Notes |
| -------------- | -------------- | ----------------------------------------- |
| `*.server.lua` | `Script` | `Source` will contain the file's contents |
| `*.client.lua` | `LocalScript` | `Source` will contain the file's contents |
| `*.lua` | `ModuleScript` | `Source` will contain the file's contents |
| `*.model.json` | *Varies* | See the example below |
| `*` | `StringValue` | `Value` will contain the file's contents |
Any directories on the filesystem will turn into `Folder` objects.
Any directory containing one of these files will instead be a `ModuleScript`, `Script`, `LocalScript` containing the directory's contents:
* `init.lua`
* `init.server.lua`
* `init.client.lua`
For example, this file tree:
* my-game
* init.client.lua
* foo.lua
Will turn into these instances in Roblox:
* `my-game` (`LocalScript` with source from `my-game/init.client.lua`)
* `foo` (`ModuleScript` with source from `my-game/foo.lua`)
`*.model.json` files are a way to represent simple Roblox instances on the filesystem until `rbxmx` and `rbxlx` support is implemented in Rojo.
This feature is intended for small instances, like `RemoteEvent` or `*Value` objects.
JSON Model files are strict, with every property being required. They look like this:
```json
{
"Name": "hello",
"ClassName": "Model",
"Children": [
{
"Name": "Some Part",
"ClassName": "Part",
"Children": [],
"Properties": {}
},
{
"Name": "Some StringValue",
"ClassName": "StringValue",
"Children": [],
"Properties": {
"Value": {
"Type": "String",
"Value": "Hello, world!"
}
}
}
],
"Properties": {}
}
```
## Inspiration
There are lots of other tools that sync scripts into Roblox or provide other tools for working with Roblox places.
Here are a few, if you're looking for alternatives or supplements to Rojo:
* [Studio Bridge by Vocksel](https://github.com/vocksel/studio-bridge)
* [RbxRefresh by Osyris](https://github.com/osyrisrblx/RbxRefresh)
* [RbxSync by evaera](https://github.com/evaera/RbxSync)
* [CodeSync](https://github.com/MemoryPenguin/CodeSync) and [rbx-exteditor](https://github.com/MemoryPenguin/rbx-exteditor) by [MemoryPenguin](https://github.com/MemoryPenguin)
* [rbxmk by Anaminus](https://github.com/anaminus/rbxmk)
I also have a couple tools that Rojo intends to replace:
* [rbxfs](https://github.com/LPGhatguy/rbxfs), which has been deprecated by Rojo
* [rbxpacker](https://github.com/LPGhatguy/rbxpacker), which is still useful
## [Documentation](https://rojo.space/docs)
Documentation is hosted in the [rojo.space repository](https://github.com/rojo-rbx/rojo.space).
## Contributing
Check out our [contribution guide](CONTRIBUTING.md) for detailed instructions for helping work on Rojo!
Pull requests are welcome!
All pull requests are run against a test suite on Travis CI. That test suite should always pass!
Rojo supports Rust 1.40.0 and newer. The minimum supported version of Rust is based on the latest versions of the dependencies that Rojo has.
## License
Rojo is available under the terms of the MIT license. See [LICENSE.md](LICENSE.md) for details.
Rojo is available under the terms of the Mozilla Public License, Version 2.0. See [LICENSE.txt](LICENSE.txt) for details.

View File

@@ -0,0 +1,11 @@
# {project_name}
Generated by [Rojo](https://github.com/rojo-rbx/rojo) {rojo_version}.
## Getting Started
To build this library or plugin, use:
```bash
rojo build -o "{project_name}.rbxmx"
```
For more help, check out [the Rojo documentation](https://rojo.space/docs).

View File

@@ -0,0 +1,6 @@
{
"name": "{project_name}",
"tree": {
"$path": "src"
}
}

View File

@@ -0,0 +1,3 @@
# Roblox Studio lock files
/*.rbxlx.lock
/*.rbxl.lock

View File

@@ -0,0 +1,5 @@
return {
hello = function()
print("Hello world, from {project_name}!")
end,
}

View File

@@ -0,0 +1,17 @@
# {project_name}
Generated by [Rojo](https://github.com/rojo-rbx/rojo) {rojo_version}.
## Getting Started
To build the place from scratch, use:
```bash
rojo build -o "{project_name}.rbxlx"
```
Next, open `{project_name}.rbxlx` in Roblox Studio and start the Rojo server:
```bash
rojo serve
```
For more help, check out [the Rojo documentation](https://rojo.space/docs).

View File

@@ -0,0 +1,89 @@
{
"name": "{project_name}",
"tree": {
"$className": "DataModel",
"ReplicatedStorage": {
"$className": "ReplicatedStorage",
"Common": {
"$path": "src/common"
}
},
"ServerScriptService": {
"$className": "ServerScriptService",
"Server": {
"$path": "src/server"
}
},
"StarterPlayer": {
"$className": "StarterPlayer",
"StarterPlayerScripts": {
"$className": "StarterPlayerScripts",
"Client": {
"$path": "src/client"
}
}
},
"Workspace": {
"$className": "Workspace",
"$properties": {
"FilteringEnabled": true
},
"Baseplate": {
"$className": "Part",
"$properties": {
"Anchored": true,
"Color": [
0.38823,
0.37254,
0.38823
],
"Locked": true,
"Position": [
0,
-10,
0
],
"Size": [
512,
20,
512
]
}
}
},
"Lighting": {
"$className": "Lighting",
"$properties": {
"Ambient": [
0,
0,
0
],
"Brightness": 2,
"GlobalShadows": true,
"Outlines": false,
"Technology": "Voxel"
}
},
"SoundService": {
"$className": "SoundService",
"$properties": {
"RespectFilteringEnabled": true
}
},
"HttpService": {
"$className": "HttpService",
"$properties": {
"HttpEnabled": true
}
}
}
}

View File

@@ -0,0 +1,6 @@
# Project place file
/{project_name}.rbxlx
# Roblox Studio lock files
/*.rbxlx.lock
/*.rbxl.lock

BIN
assets/icon-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

181
assets/index.css Normal file
View File

@@ -0,0 +1,181 @@
* {
margin: 0;
padding: 0;
border: none;
text-decoration: inherit;
color: inherit;
font: inherit;
box-sizing: inherit;
line-height: inherit;
}
html {
box-sizing: border-box;
font-family: sans-serif;
font-size: 18px;
text-decoration: none;
line-height: 1.4;
}
img {
max-width:100%;
max-height:100%;
height: auto;
}
.path-list > li {
margin-left: 1.2em;
font-family: monospace;
}
.root {
display: flex;
flex-direction: column;
margin: 0.5rem auto;
width: 100%;
max-width: 50rem;
background-color: #efefef;
border: 1px solid #666;
border-radius: 4px;
}
.header {
flex: 0 0;
display: flex;
flex-wrap: wrap;
align-items: center;
border-bottom: 1px solid #666;
}
.main {
padding: 1rem;
}
.main-logo {
flex: 0 0 10rem;
margin: 1rem;
}
.stats {
flex: 0 0 20rem;
margin: 1rem;
}
.stat {
display: block;
}
.stat-name {
display: inline;
font-weight: bold;
}
.main-section:not(:last-of-type) {
margin-bottom: 1rem;
}
.section-title {
font-size: 1.8rem;
}
.button-list {
flex: 0 0;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
margin: -1rem;
}
.button {
display: inline-block;
border: 1px solid #666;
padding: 0.3em 1em;
margin: 1rem;
}
.instance {
margin-bottom: 0.5rem;
}
.instance-title {
font-size: 1.2rem;
padding: 0.5rem;
}
.expandable-section {
margin: 0.25rem 0.5rem;
}
.expandable-items {
padding: 0.5rem 1rem;
}
.expandable-input {
display: none;
}
.expandable-label > label {
cursor: pointer;
display: flex;
align-items: center;
align-content: center;
}
.expandable-input ~ .expandable-label .expandable-visualizer {
font-family: monospace;
display: inline-flex;
align-items: center;
align-content: center;
text-align: center;
width: 1rem;
height: 1rem;
font-size: 2rem;
margin: 0 0.5rem;
transition: transform 100ms ease-in-out;
transform-origin: 60% 60%;
}
.expandable-visualizer::before {
content: "";
font-weight: bold;
}
.expandable-input:checked ~ .expandable-label {
border-bottom: 1px solid #bbb;
}
.expandable-input:checked ~ .expandable-label .expandable-visualizer {
transform: rotate(90deg);
}
.expandable-input:not(:checked) ~ .expandable-items {
display: none;
}
.vfs-entry {
}
.vfs-entry-name {
position: relative;
font-family: monospace;
}
.vfs-entry-children .vfs-entry-name::before {
content: "";
width: 0.6em;
height: 1px;
background-color: #999;
position: absolute;
top: 50%;
left: -0.8em;
}
.vfs-entry-note {
font-style: italic;
}
.vfs-entry-children {
padding-left: 0.8em;
margin-left: 0.2em;
border-left: 1px solid #999;
}

BIN
assets/logo-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

BIN
assets/test-folder.rbxm Normal file

Binary file not shown.

42
benches/build.rs Normal file
View File

@@ -0,0 +1,42 @@
use std::path::Path;
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
use tempfile::{tempdir, TempDir};
use librojo::cli::{build, BuildCommand};
pub fn benchmark_small_place(c: &mut Criterion) {
bench_build_place(c, "Small Place", "test-projects/benchmark_small_place")
}
criterion_group!(benches, benchmark_small_place);
criterion_main!(benches);
fn bench_build_place(c: &mut Criterion, name: &str, path: &str) {
let mut group = c.benchmark_group(name);
// 'rojo build' generally takes a fair bit of time to execute.
group.sample_size(10);
group.bench_function("build", |b| {
b.iter_batched(
|| place_setup(path),
|(_dir, options)| build(options).unwrap(),
BatchSize::SmallInput,
)
});
group.finish();
}
fn place_setup<P: AsRef<Path>>(input_path: P) -> (TempDir, BuildCommand) {
let dir = tempdir().unwrap();
let input = input_path.as_ref().to_path_buf();
let output = dir.path().join("output.rbxlx");
let options = BuildCommand {
project: input,
output,
};
(dir, options)
}

5
bin/dev-plugin.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
watchexec -c -w plugin "sh -c './bin/install-dev-plugin.sh'"

13
bin/install-dev-plugin.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -e
DIR="$( mktemp -d )"
PLUGIN_FILE="$DIR/Rojo.rbxm"
TESTEZ_FILE="$DIR/TestEZ.rbxm"
rojo build plugin -o "$PLUGIN_FILE"
rojo build plugin/testez.project.json -o "$TESTEZ_FILE"
remodel bin/mark-plugin-as-dev.lua "$PLUGIN_FILE" "$TESTEZ_FILE" 2>/dev/null
cp "$PLUGIN_FILE" "$LOCALAPPDATA/Roblox/Plugins/Rojo.rbxm"

5
bin/install-release-plugin.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
rojo build plugin -o "$LOCALAPPDATA/Roblox/Plugins/Rojo.rbxm"

View File

@@ -0,0 +1,12 @@
local pluginPath, testezPath = ...
local plugin = remodel.readModelFile(pluginPath)[1]
local testez = remodel.readModelFile(testezPath)[1]
local marker = Instance.new("Folder")
marker.Name = "ROJO_DEV_BUILD"
marker.Parent = plugin
testez.Parent = plugin
remodel.writeModelFile(plugin, pluginPath)

View File

@@ -0,0 +1,8 @@
local pluginPath, placePath = ...
local plugin = remodel.readModelFile(pluginPath)[1]
local place = remodel.readPlaceFile(placePath)
plugin.Parent = place:GetService("ReplicatedStorage")
remodel.writePlaceFile(place, placePath)

6
bin/run-all-tests.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
set -e
./bin/run-cli-tests.sh
./bin/run-plugin-tests.sh

9
bin/run-cli-tests.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
set -e
cargo test --all --locked
cargo fmt -- --check
touch src/lib.rs # Nudge Rust source to make Clippy actually check things
cargo clippy

16
bin/run-plugin-tests.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
set -e
DIR="$( mktemp -d )"
PLUGIN_FILE="$DIR/Rojo.rbxmx"
PLACE_FILE="$DIR/RojoTestPlace.rbxlx"
rojo build plugin -o "$PLUGIN_FILE"
rojo build plugin/place.project.json -o "$PLACE_FILE"
remodel bin/put-plugin-in-test-place.lua "$PLUGIN_FILE" "$PLACE_FILE"
run-in-roblox -s plugin/testBootstrap.server.lua "$PLACE_FILE"
luacheck plugin/src plugin/log plugin/http

13
clibrojo/Cargo.toml Normal file
View File

@@ -0,0 +1,13 @@
[package]
name = "clibrojo"
version = "0.1.0"
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
edition = "2018"
[lib]
crate-type = ["cdylib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rojo = { path = ".." }

19
clibrojo/README.md Normal file
View File

@@ -0,0 +1,19 @@
# Rojo as a C Library
This is an experiment to expose a C API for Rojo that would be suitable for embedding it into an existing C/C++ application.
I'm hoping to expand it to drop the HTTP layer and communicate through a channel, which could make it feasible to embed into an existing Roblox IDE with minimal changes or additional code.
## Building
This project is currently not built by default and could break/disappear at any time.
```bash
cargo build -p clibrojo
```
On Windows, Cargo will generate a `clibrojo.dll` and associated `.lib` file. Link these into your project.
To generate the associated C header file to include in the project, use [cbindgen](https://github.com/eqrion/cbindgen):
```bash
cbindgen --crate clibrojo --output include/rojo.h
```

14
clibrojo/src/lib.rs Normal file
View File

@@ -0,0 +1,14 @@
use std::{ffi::CStr, os::raw::c_char, path::PathBuf};
use librojo::commands::{serve, ServeOptions};
#[no_mangle]
pub extern "C" fn rojo_serve(path: *const c_char) {
let path = unsafe { PathBuf::from(CStr::from_ptr(path).to_str().unwrap()) };
serve(&ServeOptions {
fuzzy_project_path: path,
port: None,
})
.unwrap();
}

30
design.gv Normal file
View File

@@ -0,0 +1,30 @@
digraph Rojo {
concentrate = true;
node [fontname = "sans-serif"];
plugin [label="Roblox Studio Plugin"]
session [label="Session"]
rbx_tree [label="Instance Tree"]
imfs [label="In-Memory Filesystem"]
fs_impl [label="Filesystem Implementation\n(stubbed in tests)"]
fs [label="Real Filesystem"]
snapshot_subsystem [label="Snapshot Subsystem\n(reconciler)"]
snapshot_generator [label="Snapshot Generator"]
user_middleware [label="User Middleware\n(MoonScript, etc.)"]
builtin_middleware [label="Built-in Middleware\n(.lua, .rbxm, etc.)"]
api [label="Web API"]
file_watcher [label="File Watcher"]
session -> imfs
session -> rbx_tree
session -> snapshot_subsystem
session -> snapshot_generator
session -> file_watcher [dir="both"]
file_watcher -> imfs
snapshot_generator -> user_middleware
snapshot_generator -> builtin_middleware
plugin -> api [style="dotted"; dir="both"; minlen=2]
api -> session
imfs -> fs_impl
fs_impl -> fs
}

View File

@@ -1,6 +0,0 @@
# Home
This is the documentation home for Rojo.
**Rojo** is a flexible multi-tool designed for creating robust Roblox projects.
This documentation is a work in progress, and is incomplete.

View File

@@ -1,3 +0,0 @@
mkdocs
mkdocs-material
pymdown-extensions

6
memofs/CHANGELOG.md Normal file
View File

@@ -0,0 +1,6 @@
# memofs Changelog
## Unreleased Changes
## 0.1.0 (2020-03-10)
* Initial release

15
memofs/Cargo.toml Normal file
View File

@@ -0,0 +1,15 @@
[package]
name = "memofs"
description = "Virtual filesystem with configurable backends."
version = "0.1.0"
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
edition = "2018"
readme = "README.md"
license = "MIT"
homepage = "https://github.com/rojo-rbx/rojo/tree/master/memofs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
notify = "4.0.15"
crossbeam-channel = "0.4.0"

View File

@@ -1,9 +1,7 @@
The MIT License (MIT)
Copyright (c) 2018 Lucien Greathouse
Copyright 2020 The Rojo Developers
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 the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

22
memofs/README.md Normal file
View File

@@ -0,0 +1,22 @@
# memofs
[![Crates.io](https://img.shields.io/crates/v/memofs.svg)](https://crates.io/crates/memofs)
Implementation of a virtual filesystem with a configurable backend and file
watching.
memofs is currently an unstable minimum viable library. Its primary consumer is
[Rojo](https://github.com/rojo-rbx/rojo), a build system for Roblox.
### Current Features
* API similar to `std::fs`
* Configurable backends
* `StdBackend`, which uses `std::fs` and the `notify` crate
* `NoopBackend`, which always throws errors
* `InMemoryFs`, a simple in-memory filesystem useful for testing
### Future Features
* Hash-based hierarchical memoization keys (hence the name)
* Configurable caching (write-through, write-around, write-back)
## License
memofs is available under the terms of the MIT license. See [LICENSE.txt](LICENSE.txt) or <https://opensource.org/licenses/MIT> for more details.

7
memofs/README.tpl Normal file
View File

@@ -0,0 +1,7 @@
# {{crate}}
[![Crates.io](https://img.shields.io/crates/v/memofs.svg)](https://crates.io/crates/memofs)
{{readme}}
## License
memofs is available under the terms of the MIT license. See [LICENSE.txt](LICENSE.txt) or <https://opensource.org/licenses/MIT> for more details.

249
memofs/src/in_memory_fs.rs Normal file
View File

@@ -0,0 +1,249 @@
use std::collections::{BTreeSet, HashMap, VecDeque};
use std::io;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use crossbeam_channel::{Receiver, Sender};
use crate::{DirEntry, Metadata, ReadDir, VfsBackend, VfsEvent, VfsSnapshot};
/// In-memory filesystem that can be used as a VFS backend.
///
/// Internally reference counted to enable giving a copy to
/// [`Vfs`](struct.Vfs.html) and keeping the original to mutate the filesystem's
/// state with.
#[derive(Debug, Clone)]
pub struct InMemoryFs {
inner: Arc<Mutex<InMemoryFsInner>>,
}
impl InMemoryFs {
/// Create a new empty `InMemoryFs`.
pub fn new() -> Self {
Self {
inner: Arc::new(Mutex::new(InMemoryFsInner::new())),
}
}
/// Load a [`VfsSnapshot`](enum.VfsSnapshot.html) into a subtree of the
/// in-memory filesystem.
///
/// This function will return an error if the operations required to apply
/// the snapshot result in errors, like trying to create a file inside a
/// file.
pub fn load_snapshot<P: Into<PathBuf>>(
&mut self,
path: P,
snapshot: VfsSnapshot,
) -> io::Result<()> {
let mut inner = self.inner.lock().unwrap();
inner.load_snapshot(path.into(), snapshot)
}
/// Raises a filesystem change event.
///
/// If this `InMemoryFs` is being used as the backend of a
/// [`Vfs`](struct.Vfs.html), then any listeners be notified of this event.
pub fn raise_event(&mut self, event: VfsEvent) {
let inner = self.inner.lock().unwrap();
inner.event_sender.send(event).unwrap();
}
}
#[derive(Debug)]
struct InMemoryFsInner {
entries: HashMap<PathBuf, Entry>,
orphans: BTreeSet<PathBuf>,
event_receiver: Receiver<VfsEvent>,
event_sender: Sender<VfsEvent>,
}
impl InMemoryFsInner {
fn new() -> Self {
let (event_sender, event_receiver) = crossbeam_channel::unbounded();
Self {
entries: HashMap::new(),
orphans: BTreeSet::new(),
event_receiver,
event_sender,
}
}
fn load_snapshot(&mut self, path: PathBuf, snapshot: VfsSnapshot) -> io::Result<()> {
if let Some(parent_path) = path.parent() {
if let Some(parent_entry) = self.entries.get_mut(parent_path) {
if let Entry::Dir { children } = parent_entry {
children.insert(path.clone());
} else {
return must_be_dir(parent_path);
}
} else {
self.orphans.insert(path.clone());
}
} else {
self.orphans.insert(path.clone());
}
match snapshot {
VfsSnapshot::File { contents } => {
self.entries.insert(path, Entry::File { contents });
}
VfsSnapshot::Dir { children } => {
self.entries.insert(
path.clone(),
Entry::Dir {
children: BTreeSet::new(),
},
);
for (child_name, child) in children {
let full_path = path.join(child_name);
self.load_snapshot(full_path, child)?;
}
}
}
Ok(())
}
fn remove(&mut self, root_path: PathBuf) {
self.orphans.remove(&root_path);
let mut to_remove = VecDeque::new();
to_remove.push_back(root_path);
while let Some(path) = to_remove.pop_front() {
if let Some(Entry::Dir { children }) = self.entries.remove(&path) {
to_remove.extend(children);
}
}
}
}
#[derive(Debug)]
enum Entry {
File { contents: Vec<u8> },
Dir { children: BTreeSet<PathBuf> },
}
impl VfsBackend for InMemoryFs {
fn read(&mut self, path: &Path) -> io::Result<Vec<u8>> {
let inner = self.inner.lock().unwrap();
match inner.entries.get(path) {
Some(Entry::File { contents }) => Ok(contents.clone()),
Some(Entry::Dir { .. }) => must_be_file(path),
None => not_found(path),
}
}
fn write(&mut self, path: &Path, data: &[u8]) -> io::Result<()> {
let mut inner = self.inner.lock().unwrap();
inner.load_snapshot(
path.to_path_buf(),
VfsSnapshot::File {
contents: data.to_owned(),
},
)
}
fn read_dir(&mut self, path: &Path) -> io::Result<ReadDir> {
let inner = self.inner.lock().unwrap();
match inner.entries.get(path) {
Some(Entry::Dir { children }) => {
let iter = children
.clone()
.into_iter()
.map(|path| Ok(DirEntry { path }));
Ok(ReadDir {
inner: Box::new(iter),
})
}
Some(Entry::File { .. }) => must_be_dir(path),
None => not_found(path),
}
}
fn remove_file(&mut self, path: &Path) -> io::Result<()> {
let mut inner = self.inner.lock().unwrap();
match inner.entries.get(path) {
Some(Entry::File { .. }) => {
inner.remove(path.to_owned());
Ok(())
}
Some(Entry::Dir { .. }) => must_be_file(path),
None => not_found(path),
}
}
fn remove_dir_all(&mut self, path: &Path) -> io::Result<()> {
let mut inner = self.inner.lock().unwrap();
match inner.entries.get(path) {
Some(Entry::Dir { .. }) => {
inner.remove(path.to_owned());
Ok(())
}
Some(Entry::File { .. }) => must_be_dir(path),
None => not_found(path),
}
}
fn metadata(&mut self, path: &Path) -> io::Result<Metadata> {
let inner = self.inner.lock().unwrap();
match inner.entries.get(path) {
Some(Entry::File { .. }) => Ok(Metadata { is_file: true }),
Some(Entry::Dir { .. }) => Ok(Metadata { is_file: false }),
None => not_found(path),
}
}
fn event_receiver(&self) -> crossbeam_channel::Receiver<VfsEvent> {
let inner = self.inner.lock().unwrap();
inner.event_receiver.clone()
}
fn watch(&mut self, _path: &Path) -> io::Result<()> {
Ok(())
}
fn unwatch(&mut self, _path: &Path) -> io::Result<()> {
Ok(())
}
}
fn must_be_file<T>(path: &Path) -> io::Result<T> {
Err(io::Error::new(
io::ErrorKind::Other,
format!(
"path {} was a directory, but must be a file",
path.display()
),
))
}
fn must_be_dir<T>(path: &Path) -> io::Result<T> {
Err(io::Error::new(
io::ErrorKind::Other,
format!(
"path {} was a file, but must be a directory",
path.display()
),
))
}
fn not_found<T>(path: &Path) -> io::Result<T> {
Err(io::Error::new(
io::ErrorKind::NotFound,
format!("path {} not found", path.display()),
))
}

404
memofs/src/lib.rs Normal file
View File

@@ -0,0 +1,404 @@
/*!
Implementation of a virtual filesystem with a configurable backend and file
watching.
memofs is currently an unstable minimum viable library. Its primary consumer is
[Rojo](https://github.com/rojo-rbx/rojo), a build system for Roblox.
## Current Features
* API similar to `std::fs`
* Configurable backends
* `StdBackend`, which uses `std::fs` and the `notify` crate
* `NoopBackend`, which always throws errors
* `InMemoryFs`, a simple in-memory filesystem useful for testing
## Future Features
* Hash-based hierarchical memoization keys (hence the name)
* Configurable caching (write-through, write-around, write-back)
*/
mod in_memory_fs;
mod noop_backend;
mod snapshot;
mod std_backend;
use std::io;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex, MutexGuard};
pub use in_memory_fs::InMemoryFs;
pub use noop_backend::NoopBackend;
pub use snapshot::VfsSnapshot;
pub use std_backend::StdBackend;
mod sealed {
use super::*;
/// Sealing trait for VfsBackend.
pub trait Sealed {}
impl Sealed for NoopBackend {}
impl Sealed for StdBackend {}
impl Sealed for InMemoryFs {}
}
/// Trait that transforms `io::Result<T>` into `io::Result<Option<T>>`.
///
/// `Ok(None)` takes the place of IO errors whose `io::ErrorKind` is `NotFound`.
pub trait IoResultExt<T> {
fn with_not_found(self) -> io::Result<Option<T>>;
}
impl<T> IoResultExt<T> for io::Result<T> {
fn with_not_found(self) -> io::Result<Option<T>> {
match self {
Ok(v) => Ok(Some(v)),
Err(err) => {
if err.kind() == io::ErrorKind::NotFound {
Ok(None)
} else {
Err(err)
}
}
}
}
}
/// Backend that can be used to create a `Vfs`.
///
/// This trait is sealed and cannot not be implemented outside this crate.
pub trait VfsBackend: sealed::Sealed + Send + 'static {
fn read(&mut self, path: &Path) -> io::Result<Vec<u8>>;
fn write(&mut self, path: &Path, data: &[u8]) -> io::Result<()>;
fn read_dir(&mut self, path: &Path) -> io::Result<ReadDir>;
fn metadata(&mut self, path: &Path) -> io::Result<Metadata>;
fn remove_file(&mut self, path: &Path) -> io::Result<()>;
fn remove_dir_all(&mut self, path: &Path) -> io::Result<()>;
fn event_receiver(&self) -> crossbeam_channel::Receiver<VfsEvent>;
fn watch(&mut self, path: &Path) -> io::Result<()>;
fn unwatch(&mut self, path: &Path) -> io::Result<()>;
}
/// Vfs equivalent to [`std::fs::DirEntry`][std::fs::DirEntry].
///
/// [std::fs::DirEntry]: https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html
pub struct DirEntry {
pub(crate) path: PathBuf,
}
impl DirEntry {
pub fn path(&self) -> &Path {
&self.path
}
}
/// Vfs equivalent to [`std::fs::ReadDir`][std::fs::ReadDir].
///
/// [std::fs::ReadDir]: https://doc.rust-lang.org/stable/std/fs/struct.ReadDir.html
pub struct ReadDir {
pub(crate) inner: Box<dyn Iterator<Item = io::Result<DirEntry>>>,
}
impl Iterator for ReadDir {
type Item = io::Result<DirEntry>;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
/// Vfs equivalent to [`std::fs::Metadata`][std::fs::Metadata].
///
/// [std::fs::Metadata]: https://doc.rust-lang.org/stable/std/fs/struct.Metadata.html
#[derive(Debug)]
pub struct Metadata {
pub(crate) is_file: bool,
}
impl Metadata {
pub fn is_file(&self) -> bool {
self.is_file
}
pub fn is_dir(&self) -> bool {
!self.is_file
}
}
/// Represents an event that a filesystem can raise that might need to be
/// handled.
#[derive(Debug)]
#[non_exhaustive]
pub enum VfsEvent {
Create(PathBuf),
Write(PathBuf),
Remove(PathBuf),
}
/// Contains implementation details of the Vfs, wrapped by `Vfs` and `VfsLock`,
/// the public interfaces to this type.
struct VfsInner {
backend: Box<dyn VfsBackend>,
}
impl VfsInner {
fn read<P: AsRef<Path>>(&mut self, path: P) -> io::Result<Arc<Vec<u8>>> {
let path = path.as_ref();
let contents = self.backend.read(path)?;
self.backend.watch(path)?;
Ok(Arc::new(contents))
}
fn write<P: AsRef<Path>, C: AsRef<[u8]>>(&mut self, path: P, contents: C) -> io::Result<()> {
let path = path.as_ref();
let contents = contents.as_ref();
self.backend.write(path, contents)
}
fn read_dir<P: AsRef<Path>>(&mut self, path: P) -> io::Result<ReadDir> {
let path = path.as_ref();
let dir = self.backend.read_dir(path)?;
self.backend.watch(path)?;
Ok(dir)
}
fn remove_file<P: AsRef<Path>>(&mut self, path: P) -> io::Result<()> {
let path = path.as_ref();
let _ = self.backend.unwatch(path);
self.backend.remove_file(path)
}
fn remove_dir_all<P: AsRef<Path>>(&mut self, path: P) -> io::Result<()> {
let path = path.as_ref();
let _ = self.backend.unwatch(path);
self.backend.remove_dir_all(path)
}
fn metadata<P: AsRef<Path>>(&mut self, path: P) -> io::Result<Metadata> {
let path = path.as_ref();
self.backend.metadata(path)
}
fn event_receiver(&self) -> crossbeam_channel::Receiver<VfsEvent> {
self.backend.event_receiver()
}
fn commit_event(&mut self, event: &VfsEvent) -> io::Result<()> {
match event {
VfsEvent::Remove(path) => {
let _ = self.backend.unwatch(&path);
}
_ => {}
}
Ok(())
}
}
/// A virtual filesystem with a configurable backend.
///
/// All operations on the Vfs take a lock on an internal backend. For performing
/// large batches of operations, it might be more performant to call `lock()`
/// and use [`VfsLock`](struct.VfsLock.html) instead.
pub struct Vfs {
inner: Mutex<VfsInner>,
}
impl Vfs {
/// Creates a new `Vfs` with the default backend, `StdBackend`.
pub fn new_default() -> Self {
Self::new(StdBackend::new())
}
/// Creates a new `Vfs` with the given backend.
pub fn new<B: VfsBackend>(backend: B) -> Self {
let lock = VfsInner {
backend: Box::new(backend),
};
Self {
inner: Mutex::new(lock),
}
}
/// Manually lock the Vfs, useful for large batches of operations.
pub fn lock(&self) -> VfsLock<'_> {
VfsLock {
inner: self.inner.lock().unwrap(),
}
}
/// Read a file from the VFS, or the underlying backend if it isn't
/// resident.
///
/// Roughly equivalent to [`std::fs::read`][std::fs::read].
///
/// [std::fs::read]: https://doc.rust-lang.org/stable/std/fs/fn.read.html
#[inline]
pub fn read<P: AsRef<Path>>(&self, path: P) -> io::Result<Arc<Vec<u8>>> {
let path = path.as_ref();
self.inner.lock().unwrap().read(path)
}
/// Write a file to the VFS and the underlying backend.
///
/// Roughly equivalent to [`std::fs::write`][std::fs::write].
///
/// [std::fs::write]: https://doc.rust-lang.org/stable/std/fs/fn.write.html
#[inline]
pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(&self, path: P, contents: C) -> io::Result<()> {
let path = path.as_ref();
let contents = contents.as_ref();
self.inner.lock().unwrap().write(path, contents)
}
/// Read all of the children of a directory.
///
/// Roughly equivalent to [`std::fs::read_dir`][std::fs::read_dir].
///
/// [std::fs::read_dir]: https://doc.rust-lang.org/stable/std/fs/fn.read_dir.html
#[inline]
pub fn read_dir<P: AsRef<Path>>(&self, path: P) -> io::Result<ReadDir> {
let path = path.as_ref();
self.inner.lock().unwrap().read_dir(path)
}
/// Remove a file.
///
/// Roughly equivalent to [`std::fs::remove_file`][std::fs::remove_file].
///
/// [std::fs::remove_file]: https://doc.rust-lang.org/stable/std/fs/fn.remove_file.html
#[inline]
pub fn remove_file<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
let path = path.as_ref();
self.inner.lock().unwrap().remove_file(path)
}
/// Remove a directory and all of its descendants.
///
/// Roughly equivalent to [`std::fs::remove_dir_all`][std::fs::remove_dir_all].
///
/// [std::fs::remove_dir_all]: https://doc.rust-lang.org/stable/std/fs/fn.remove_dir_all.html
#[inline]
pub fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
let path = path.as_ref();
self.inner.lock().unwrap().remove_dir_all(path)
}
/// Query metadata about the given path.
///
/// Roughly equivalent to [`std::fs::metadata`][std::fs::metadata].
///
/// [std::fs::metadata]: https://doc.rust-lang.org/stable/std/fs/fn.metadata.html
#[inline]
pub fn metadata<P: AsRef<Path>>(&self, path: P) -> io::Result<Metadata> {
let path = path.as_ref();
self.inner.lock().unwrap().metadata(path)
}
/// Retrieve a handle to the event receiver for this `Vfs`.
#[inline]
pub fn event_receiver(&self) -> crossbeam_channel::Receiver<VfsEvent> {
self.inner.lock().unwrap().event_receiver()
}
/// Commit an event to this `Vfs`.
#[inline]
pub fn commit_event(&self, event: &VfsEvent) -> io::Result<()> {
self.inner.lock().unwrap().commit_event(event)
}
}
/// A locked handle to a [`Vfs`](struct.Vfs.html), created by `Vfs::lock`.
///
/// Implements roughly the same API as [`Vfs`](struct.Vfs.html).
pub struct VfsLock<'a> {
inner: MutexGuard<'a, VfsInner>,
}
impl VfsLock<'_> {
/// Read a file from the VFS, or the underlying backend if it isn't
/// resident.
///
/// Roughly equivalent to [`std::fs::read`][std::fs::read].
///
/// [std::fs::read]: https://doc.rust-lang.org/stable/std/fs/fn.read.html
#[inline]
pub fn read<P: AsRef<Path>>(&mut self, path: P) -> io::Result<Arc<Vec<u8>>> {
let path = path.as_ref();
self.inner.read(path)
}
/// Write a file to the VFS and the underlying backend.
///
/// Roughly equivalent to [`std::fs::write`][std::fs::write].
///
/// [std::fs::write]: https://doc.rust-lang.org/stable/std/fs/fn.write.html
#[inline]
pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(
&mut self,
path: P,
contents: C,
) -> io::Result<()> {
let path = path.as_ref();
let contents = contents.as_ref();
self.inner.write(path, contents)
}
/// Read all of the children of a directory.
///
/// Roughly equivalent to [`std::fs::read_dir`][std::fs::read_dir].
///
/// [std::fs::read_dir]: https://doc.rust-lang.org/stable/std/fs/fn.read_dir.html
#[inline]
pub fn read_dir<P: AsRef<Path>>(&mut self, path: P) -> io::Result<ReadDir> {
let path = path.as_ref();
self.inner.read_dir(path)
}
/// Remove a file.
///
/// Roughly equivalent to [`std::fs::remove_file`][std::fs::remove_file].
///
/// [std::fs::remove_file]: https://doc.rust-lang.org/stable/std/fs/fn.remove_file.html
#[inline]
pub fn remove_file<P: AsRef<Path>>(&mut self, path: P) -> io::Result<()> {
let path = path.as_ref();
self.inner.remove_file(path)
}
/// Remove a directory and all of its descendants.
///
/// Roughly equivalent to [`std::fs::remove_dir_all`][std::fs::remove_dir_all].
///
/// [std::fs::remove_dir_all]: https://doc.rust-lang.org/stable/std/fs/fn.remove_dir_all.html
#[inline]
pub fn remove_dir_all<P: AsRef<Path>>(&mut self, path: P) -> io::Result<()> {
let path = path.as_ref();
self.inner.remove_dir_all(path)
}
/// Query metadata about the given path.
///
/// Roughly equivalent to [`std::fs::metadata`][std::fs::metadata].
///
/// [std::fs::metadata]: https://doc.rust-lang.org/stable/std/fs/fn.metadata.html
#[inline]
pub fn metadata<P: AsRef<Path>>(&mut self, path: P) -> io::Result<Metadata> {
let path = path.as_ref();
self.inner.metadata(path)
}
/// Retrieve a handle to the event receiver for this `Vfs`.
#[inline]
pub fn event_receiver(&self) -> crossbeam_channel::Receiver<VfsEvent> {
self.inner.event_receiver()
}
/// Commit an event to this `Vfs`.
#[inline]
pub fn commit_event(&mut self, event: &VfsEvent) -> io::Result<()> {
self.inner.commit_event(event)
}
}

View File

@@ -0,0 +1,76 @@
use std::io;
use std::path::Path;
use crate::{Metadata, ReadDir, VfsBackend, VfsEvent};
/// `VfsBackend` that returns an error on every operation.
#[non_exhaustive]
pub struct NoopBackend;
impl NoopBackend {
pub fn new() -> Self {
Self
}
}
impl VfsBackend for NoopBackend {
fn read(&mut self, _path: &Path) -> io::Result<Vec<u8>> {
Err(io::Error::new(
io::ErrorKind::Other,
"NoopBackend doesn't do anything",
))
}
fn write(&mut self, _path: &Path, _data: &[u8]) -> io::Result<()> {
Err(io::Error::new(
io::ErrorKind::Other,
"NoopBackend doesn't do anything",
))
}
fn read_dir(&mut self, _path: &Path) -> io::Result<ReadDir> {
Err(io::Error::new(
io::ErrorKind::Other,
"NoopBackend doesn't do anything",
))
}
fn remove_file(&mut self, _path: &Path) -> io::Result<()> {
Err(io::Error::new(
io::ErrorKind::Other,
"NoopBackend doesn't do anything",
))
}
fn remove_dir_all(&mut self, _path: &Path) -> io::Result<()> {
Err(io::Error::new(
io::ErrorKind::Other,
"NoopBackend doesn't do anything",
))
}
fn metadata(&mut self, _path: &Path) -> io::Result<Metadata> {
Err(io::Error::new(
io::ErrorKind::Other,
"NoopBackend doesn't do anything",
))
}
fn event_receiver(&self) -> crossbeam_channel::Receiver<VfsEvent> {
crossbeam_channel::never()
}
fn watch(&mut self, _path: &Path) -> io::Result<()> {
Err(io::Error::new(
io::ErrorKind::Other,
"NoopBackend doesn't do anything",
))
}
fn unwatch(&mut self, _path: &Path) -> io::Result<()> {
Err(io::Error::new(
io::ErrorKind::Other,
"NoopBackend doesn't do anything",
))
}
}

44
memofs/src/snapshot.rs Normal file
View File

@@ -0,0 +1,44 @@
use std::collections::BTreeMap;
/// A slice of a tree of files. Can be loaded into an
/// [`InMemoryFs`](struct.InMemoryFs.html).
#[derive(Debug)]
#[non_exhaustive]
pub enum VfsSnapshot {
File {
contents: Vec<u8>,
},
Dir {
children: BTreeMap<String, VfsSnapshot>,
},
}
impl VfsSnapshot {
pub fn file<C: Into<Vec<u8>>>(contents: C) -> Self {
Self::File {
contents: contents.into(),
}
}
pub fn dir<K: Into<String>, I: IntoIterator<Item = (K, VfsSnapshot)>>(children: I) -> Self {
Self::Dir {
children: children
.into_iter()
.map(|(key, value)| (key.into(), value))
.collect(),
}
}
pub fn empty_file() -> Self {
Self::File {
contents: Vec::new(),
}
}
pub fn empty_dir() -> Self {
Self::Dir {
children: BTreeMap::new(),
}
}
}

111
memofs/src/std_backend.rs Normal file
View File

@@ -0,0 +1,111 @@
use std::fs;
use std::io;
use std::path::Path;
use std::sync::mpsc;
use std::thread;
use std::time::Duration;
use crossbeam_channel::Receiver;
use notify::{watcher, DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
use crate::{DirEntry, Metadata, ReadDir, VfsBackend, VfsEvent};
/// `VfsBackend` that uses `std::fs` and the `notify` crate.
pub struct StdBackend {
watcher: RecommendedWatcher,
watcher_receiver: Receiver<VfsEvent>,
}
impl StdBackend {
pub fn new() -> StdBackend {
let (notify_tx, notify_rx) = mpsc::channel();
let watcher = watcher(notify_tx, Duration::from_millis(50)).unwrap();
let (tx, rx) = crossbeam_channel::unbounded();
thread::spawn(move || {
for event in notify_rx {
match event {
DebouncedEvent::Create(path) => {
tx.send(VfsEvent::Create(path))?;
}
DebouncedEvent::Write(path) => {
tx.send(VfsEvent::Write(path))?;
}
DebouncedEvent::Remove(path) => {
tx.send(VfsEvent::Remove(path))?;
}
DebouncedEvent::Rename(from, to) => {
tx.send(VfsEvent::Remove(from))?;
tx.send(VfsEvent::Create(to))?;
}
_ => {}
}
}
Result::<(), crossbeam_channel::SendError<VfsEvent>>::Ok(())
});
Self {
watcher,
watcher_receiver: rx,
}
}
}
impl VfsBackend for StdBackend {
fn read(&mut self, path: &Path) -> io::Result<Vec<u8>> {
fs::read(path)
}
fn write(&mut self, path: &Path, data: &[u8]) -> io::Result<()> {
fs::write(path, data)
}
fn read_dir(&mut self, path: &Path) -> io::Result<ReadDir> {
let entries: Result<Vec<_>, _> = fs::read_dir(path)?.collect();
let mut entries = entries?;
entries.sort_by_cached_key(|entry| entry.file_name());
let inner = entries
.into_iter()
.map(|entry| Ok(DirEntry { path: entry.path() }));
Ok(ReadDir {
inner: Box::new(inner),
})
}
fn remove_file(&mut self, path: &Path) -> io::Result<()> {
fs::remove_file(path)
}
fn remove_dir_all(&mut self, path: &Path) -> io::Result<()> {
fs::remove_dir_all(path)
}
fn metadata(&mut self, path: &Path) -> io::Result<Metadata> {
let inner = fs::metadata(path)?;
Ok(Metadata {
is_file: inner.is_file(),
})
}
fn event_receiver(&self) -> crossbeam_channel::Receiver<VfsEvent> {
self.watcher_receiver.clone()
}
fn watch(&mut self, path: &Path) -> io::Result<()> {
self.watcher
.watch(path, RecursiveMode::NonRecursive)
.map_err(|inner| io::Error::new(io::ErrorKind::Other, inner))
}
fn unwatch(&mut self, path: &Path) -> io::Result<()> {
self.watcher
.unwatch(path)
.map_err(|inner| io::Error::new(io::ErrorKind::Other, inner))
}
}

View File

@@ -1,20 +0,0 @@
site_name: Rojo Documentation
site_url: https://lpghatguy.github.io/rojo/
repo_name: LPGhatguy/rojo
repo_url: https://github.com/LPGhatguy/rojo
theme:
name: material
palette:
primary: 'Red'
accent: 'Red'
pages:
- Home: index.md
markdown_extensions:
- admonition
- codehilite:
guess_lang: false
- toc:
permalink: true

View File

@@ -1,4 +0,0 @@
[*.lua]
indent_style = tab
trim_trailing_whitespace = true
insert_final_newline = true

1
plugin/.gitignore vendored
View File

@@ -1 +0,0 @@
/luacov.*

View File

@@ -1,8 +0,0 @@
return {
include = {
"^src",
},
exclude = {
"%.spec$",
},
}

View File

@@ -0,0 +1,30 @@
{
"name": "Rojo",
"tree": {
"$className": "Folder",
"Plugin": {
"$path": "src"
},
"Log": {
"$path": "log"
},
"Http": {
"$path": "http"
},
"Fmt": {
"$path": "fmt"
},
"Roact": {
"$path": "modules/roact/src"
},
"Promise": {
"$path": "modules/promise/lib"
},
"t": {
"$path": "modules/t/lib"
},
"RbxDom": {
"$path": "modules/rbx-dom/rbx_dom_lua/src"
}
}
}

245
plugin/fmt/init.lua Normal file
View File

@@ -0,0 +1,245 @@
--[[
This library describes a formatting mechanism akin to Rust's std::fmt.
It has a couple building blocks:
* A new syntax for formatting strings, taken verbatim from Rust. It'd also
be possible to use printf-style formatting specifiers to integrate with
the existing string.format utility.
* An equivalent to Rust's `Display` trait. We're mapping the semantics of
tostring and the __tostring metamethod onto this trait. A lot of types
should already have __tostring implementations, too!
* An equivalent to Rust's `Debug` trait. This library Lua-ifies that idea by
inventing a new metamethod, `__fmtDebug`. We pass along the "extended
form" attribute which is the equivalent of the "alternate mode" in Rust's
Debug trait since it's the author's opinion that treating it as a
verbosity flag is semantically accurate.
]]
--[[
The default implementation of __fmtDebug for tables when the extended option
is not set.
]]
local function defaultTableDebug(buffer, input)
buffer:writeRaw("{")
for key, value in pairs(input) do
buffer:write("[{:?}] = {:?}", key, value)
if next(input, key) ~= nil then
buffer:writeRaw(", ")
end
end
buffer:writeRaw("}")
end
--[[
The default implementation of __fmtDebug for tables with the extended option
set.
]]
local function defaultTableDebugExtended(buffer, input)
-- Special case for empty tables.
if next(input) == nil then
buffer:writeRaw("{}")
return
end
buffer:writeLineRaw("{")
buffer:indent()
for key, value in pairs(input) do
buffer:writeLine("[{:?}] = {:#?},", key, value)
end
buffer:unindent()
buffer:writeRaw("}")
end
--[[
The default debug representation for all types.
]]
local function debugImpl(buffer, value, extendedForm)
local valueType = typeof(value)
if valueType == "string" then
local formatted = string.format("%q", value)
buffer:writeRaw(formatted)
elseif valueType == "table" then
local valueMeta = getmetatable(value)
if valueMeta ~= nil and valueMeta.__fmtDebug ~= nil then
-- This type implement's the metamethod we made up to line up with
-- Rust's 'Debug' trait.
valueMeta.__fmtDebug(value, buffer, extendedForm)
else
if extendedForm then
defaultTableDebugExtended(buffer, value)
else
defaultTableDebug(buffer, value)
end
end
elseif valueType == "Instance" then
buffer:writeRaw(value:GetFullName())
else
buffer:writeRaw(tostring(value))
end
end
--[[
Defines and implements the library's template syntax.
]]
local function writeFmt(buffer, template, ...)
local currentArg = 0
local i = 1
local len = #template
while i <= len do
local openBrace = template:find("{", i)
if openBrace == nil then
-- There are no remaining open braces in this string, so we can
-- write the rest of the string to the buffer.
buffer:writeRaw(template:sub(i))
break
else
-- We found an open brace! This could be:
-- - A literal '{', written as '{{'
-- - The beginning of an interpolation, like '{}'
-- - An error, if there's no matching '}'
local charAfterBrace = template:sub(openBrace + 1, openBrace + 1)
if charAfterBrace == "{" then
-- This is a literal brace, so we'll write everything up to this
-- point (including the first brace), and then skip over the
-- second brace.
buffer:writeRaw(template:sub(i, openBrace))
i = openBrace + 2
else
-- This SHOULD be an interpolation. We'll find our matching
-- brace and treat the contents as the formatting specifier.
-- If there were any unwritten characters before this
-- interpolation, write them to the buffer.
if openBrace - i > 0 then
buffer:writeRaw(template:sub(i, openBrace - 1))
end
local closeBrace = template:find("}", openBrace + 1)
assert(closeBrace ~= nil, "Unclosed formatting specifier. Use '{{' to write an open brace.")
local formatSpecifier = template:sub(openBrace + 1, closeBrace - 1)
currentArg = currentArg + 1
local arg = select(currentArg, ...)
if formatSpecifier == "" then
-- This should use the equivalent of Rust's 'Display', ie
-- tostring and the __tostring metamethod.
buffer:writeRaw(tostring(arg))
elseif formatSpecifier == ":?" then
-- This should use the equivalent of Rust's 'Debug',
-- invented for this library as __fmtDebug.
debugImpl(buffer, arg, false)
elseif formatSpecifier == ":#?" then
-- This should use the equivlant of Rust's 'Debug' with the
-- 'alternate' (ie expanded) flag set.
debugImpl(buffer, arg, true)
else
error("unsupported format specifier " .. formatSpecifier, 2)
end
i = closeBrace + 1
end
end
end
end
local function debugOutputBuffer()
local buffer = {}
local startOfLine = true
local indentLevel = 0
local indentation = ""
function buffer:writeLine(template, ...)
writeFmt(self, template, ...)
self:nextLine()
end
function buffer:writeLineRaw(value)
self:writeRaw(value)
self:nextLine()
end
function buffer:write(template, ...)
return writeFmt(self, template, ...)
end
function buffer:writeRaw(value)
if #value > 0 then
if startOfLine and #indentation > 0 then
startOfLine = false
table.insert(self, indentation)
end
table.insert(self, value)
startOfLine = false
end
end
function buffer:nextLine()
table.insert(self, "\n")
startOfLine = true
end
function buffer:indent()
indentLevel = indentLevel + 1
indentation = string.rep(" ", indentLevel)
end
function buffer:unindent()
indentLevel = math.max(0, indentLevel - 1)
indentation = string.rep(" ", indentLevel)
end
function buffer:finish()
return table.concat(self, "")
end
return buffer
end
local function fmt(template, ...)
local buffer = debugOutputBuffer()
writeFmt(buffer, template, ...)
return buffer:finish()
end
--[[
Wrap the given object in a type that implements the given function as its
Debug implementation, and forwards __tostring to the type's underlying
tostring implementation.
]]
local function debugify(object, fmtFunc)
return setmetatable({}, {
__fmtDebug = function(_, ...)
return fmtFunc(object, ...)
end,
__tostring = function()
return tostring(object)
end,
})
end
return {
debugOutputBuffer = debugOutputBuffer,
fmt = fmt,
debugify = debugify,
}

66
plugin/http/Error.lua Normal file
View File

@@ -0,0 +1,66 @@
local Error = {}
Error.__index = Error
Error.Kind = {
HttpNotEnabled = {
message = "Rojo requires HTTP access, which is not enabled.\n" ..
"Check your game settings, located in the 'Home' tab of Studio.",
},
ConnectFailed = {
message = "Couldn't connect to the Rojo server.\n" ..
"Make sure the server is running -- use 'rojo serve' to run it!",
},
Timeout = {
message = "HTTP request timed out.",
},
Unknown = {
message = "Unknown HTTP error: {{message}}",
},
}
setmetatable(Error.Kind, {
__index = function(_, key)
error(("%q is not a valid member of Http.Error.Kind"):format(tostring(key)), 2)
end,
})
function Error.new(type, extraMessage)
extraMessage = extraMessage or ""
local message = type.message:gsub("{{message}}", extraMessage)
local err = {
type = type,
message = message,
}
setmetatable(err, Error)
return err
end
function Error:__tostring()
return self.message
end
--[[
This method shouldn't have to exist. Ugh.
]]
function Error.fromRobloxErrorString(message)
local lower = message:lower()
if lower:find("^http requests are not enabled") then
return Error.new(Error.Kind.HttpNotEnabled)
end
if lower:find("^httperror: timedout") then
return Error.new(Error.Kind.Timeout)
end
if lower:find("^httperror: connectfail") then
return Error.new(Error.Kind.ConnectFailed)
end
return Error.new(Error.Kind.Unknown, message)
end
return Error

34
plugin/http/Response.lua Normal file
View File

@@ -0,0 +1,34 @@
local HttpService = game:GetService("HttpService")
local stringTemplate = [[
Http.Response {
code: %d
body: %s
}]]
local Response = {}
Response.__index = Response
function Response:__tostring()
return stringTemplate:format(self.code, self.body)
end
function Response.fromRobloxResponse(response)
local self = {
body = response.Body,
code = response.StatusCode,
headers = response.Headers,
}
return setmetatable(self, Response)
end
function Response:isSuccess()
return self.code >= 200 and self.code < 300
end
function Response:json()
return HttpService:JSONDecode(self.body)
end
return Response

66
plugin/http/init.lua Normal file
View File

@@ -0,0 +1,66 @@
local HttpService = game:GetService("HttpService")
local Promise = require(script.Parent.Promise)
local Log = require(script.Parent.Log)
local HttpError = require(script.Error)
local HttpResponse = require(script.Response)
local lastRequestId = 0
local Http = {}
Http.Error = HttpError
Http.Response = HttpResponse
local function performRequest(requestParams)
local requestId = lastRequestId + 1
lastRequestId = requestId
Log.trace("HTTP {}({}) {}", requestParams.Method, requestId, requestParams.Url)
if requestParams.Body ~= nil then
Log.trace("{}", requestParams.Body)
end
return Promise.new(function(resolve, reject)
coroutine.wrap(function()
local success, response = pcall(function()
return HttpService:RequestAsync(requestParams)
end)
if success then
Log.trace("Request {} success, status code {}", requestId, response.StatusCode)
resolve(HttpResponse.fromRobloxResponse(response))
else
Log.trace("Request {} failure: {:?}", requestId, response)
reject(HttpError.fromRobloxErrorString(response))
end
end)()
end)
end
function Http.get(url)
return performRequest({
Url = url,
Method = "GET",
})
end
function Http.post(url, body)
return performRequest({
Url = url,
Method = "POST",
Body = body,
})
end
function Http.jsonEncode(object)
return HttpService:JSONEncode(object)
end
function Http.jsonDecode(source)
return HttpService:JSONDecode(source)
end
return Http

View File

@@ -0,0 +1,5 @@
return function()
it("should load", function()
require(script.Parent)
end)
end

56
plugin/log/init.lua Normal file
View File

@@ -0,0 +1,56 @@
local Fmt = require(script.Parent.Fmt)
local Level = {
Error = 0,
Warning = 1,
Info = 2,
Debug = 3,
Trace = 4,
}
local function getLogLevel()
return Level.Info
end
local function addTags(tag, message)
return tag .. message:gsub("\n", "\n" .. tag)
end
local TRACE_TAG = (" "):rep(15) .. "[Rojo-Trace] "
local INFO_TAG = (" "):rep(15) .. "[Rojo-Info] "
local DEBUG_TAG = (" "):rep(15) .. "[Rojo-Debug] "
local WARN_TAG = "[Rojo-Warn] "
local Log = {}
Log.Level = Level
function Log.setLogLevelThunk(thunk)
getLogLevel = thunk
end
function Log.trace(template, ...)
if getLogLevel() >= Level.Trace then
print(addTags(TRACE_TAG, Fmt.fmt(template, ...)))
end
end
function Log.info(template, ...)
if getLogLevel() >= Level.Info then
print(addTags(INFO_TAG, Fmt.fmt(template, ...)))
end
end
function Log.debug(template, ...)
if getLogLevel() >= Level.Debug then
print(addTags(DEBUG_TAG, Fmt.fmt(template, ...)))
end
end
function Log.warn(template, ...)
if getLogLevel() >= Level.Warning then
warn(addTags(WARN_TAG, Fmt.fmt(template, ...)))
end
end
return Log

5
plugin/log/init.spec.lua Normal file
View File

@@ -0,0 +1,5 @@
return function()
it("should load", function()
require(script.Parent)
end)
end

1
plugin/modules/t Submodule

Submodule plugin/modules/t added at f643b50682

View File

@@ -1,30 +0,0 @@
{
"name": "rojo",
"servePort": 8000,
"partitions": {
"plugin": {
"path": "src",
"target": "ReplicatedStorage.Rojo.plugin"
},
"modules/roact": {
"path": "modules/roact/lib",
"target": "ReplicatedStorage.Rojo.modules.Roact"
},
"modules/rodux": {
"path": "modules/rodux/lib",
"target": "ReplicatedStorage.Rojo.modules.Rodux"
},
"modules/roact-rodux": {
"path": "modules/roact-rodux/lib",
"target": "ReplicatedStorage.Rojo.modules.RoactRodux"
},
"modules/testez": {
"path": "modules/testez/lib",
"target": "ReplicatedStorage.TestEZ"
},
"tests": {
"path": "tests",
"target": "TestService"
}
}
}

View File

@@ -1,69 +0,0 @@
--[[
Loads our library and all of its dependencies, then runs tests using TestEZ.
]]
-- If you add any dependencies, add them to this table so they'll be loaded!
local LOAD_MODULES = {
{"src", "Plugin"},
{"modules/testez/lib", "TestEZ"},
}
-- This makes sure we can load Lemur and other libraries that depend on init.lua
package.path = package.path .. ";?/init.lua"
-- If this fails, make sure you've run `lua bin/install-dependencies.lua` first!
local lemur = require("modules.lemur")
--[[
Collapses ModuleScripts named 'init' into their parent folders.
This is the same result as the collapsing mechanism from Rojo.
]]
local function collapse(root)
local init = root:FindFirstChild("init")
if init then
init.Name = root.Name
init.Parent = root.Parent
for _, child in ipairs(root:GetChildren()) do
child.Parent = init
end
root:Destroy()
root = init
end
for _, child in ipairs(root:GetChildren()) do
if child:IsA("Folder") then
collapse(child)
end
end
return root
end
-- Create a virtual Roblox tree
local habitat = lemur.Habitat.new()
-- We'll put all of our library code and dependencies here
local Root = lemur.Instance.new("Folder")
Root.Name = "Root"
-- Load all of the modules specified above
for _, module in ipairs(LOAD_MODULES) do
local container = lemur.Instance.new("Folder", Root)
container.Name = module[2]
habitat:loadFromFs(module[1], container)
end
collapse(Root)
-- Load TestEZ and run our tests
local TestEZ = habitat:require(Root.TestEZ)
local results = TestEZ.TestBootstrap:run(Root.Plugin, TestEZ.Reporters.TextReporter)
-- Did something go wrong?
if results.failureCount > 0 then
os.exit(1)
end

View File

@@ -1,112 +0,0 @@
local HttpService = game:GetService("HttpService")
local Config = require(script.Parent.Config)
local Promise = require(script.Parent.Promise)
local Version = require(script.Parent.Version)
local Api = {}
Api.__index = Api
Api.Error = {
ServerIdMismatch = "ServerIdMismatch",
}
setmetatable(Api.Error, {
__index = function(_, key)
error("Invalid API.Error name " .. key, 2)
end
})
--[[
Api.connect(Http) -> Promise<Api>
Create a new Api using the given HTTP implementation.
Attempting to invoke methods on an invalid conext will throw errors!
]]
function Api.connect(http)
local context = {
http = http,
serverId = nil,
currentTime = 0,
}
setmetatable(context, Api)
return context:_start()
end
function Api:_start()
return self.http:get("/")
:andThen(function(response)
response = response:json()
if response.protocolVersion ~= Config.protocolVersion then
local message = (
"Found a Rojo dev server, but it's using a different protocol version, and is incompatible." ..
"\nMake sure you have matching versions of both the Rojo plugin and server!" ..
"\n\nYour client is version %s, with protocol version %s. It expects server version %s." ..
"\nYour server is version %s, with protocol version %s." ..
"\n\nGo to https://github.com/LPGhatguy/rojo for more details."
):format(
Version.display(Config.version), Config.protocolVersion,
Config.expectedApiVersionString,
response.serverVersion, response.protocolVersion
)
return Promise.reject(message)
end
self.serverId = response.serverId
self.currentTime = response.currentTime
return self
end)
end
function Api:getInfo()
return self.http:get("/")
:andThen(function(response)
response = response:json()
if response.serverId ~= self.serverId then
return Promise.reject(Api.Error.ServerIdMismatch)
end
return response
end)
end
function Api:read(paths)
local body = HttpService:JSONEncode(paths)
return self.http:post("/read", body)
:andThen(function(response)
response = response:json()
if response.serverId ~= self.serverId then
return Promise.reject(Api.Error.ServerIdMismatch)
end
return response.items
end)
end
function Api:getChanges()
local url = ("/changes/%f"):format(self.currentTime)
return self.http:get(url)
:andThen(function(response)
response = response:json()
if response.serverId ~= self.serverId then
return Promise.reject(Api.Error.ServerIdMismatch)
end
self.currentTime = response.currentTime
return response.changes
end)
end
return Api

236
plugin/src/ApiContext.lua Normal file
View File

@@ -0,0 +1,236 @@
local Http = require(script.Parent.Parent.Http)
local Log = require(script.Parent.Parent.Log)
local Promise = require(script.Parent.Parent.Promise)
local Config = require(script.Parent.Config)
local Types = require(script.Parent.Types)
local Version = require(script.Parent.Version)
local validateApiInfo = Types.ifEnabled(Types.ApiInfoResponse)
local validateApiRead = Types.ifEnabled(Types.ApiReadResponse)
local validateApiSubscribe = Types.ifEnabled(Types.ApiSubscribeResponse)
--[[
Returns a promise that will never resolve nor reject.
]]
local function hangingPromise()
return Promise.new(function() end)
end
local function rejectFailedRequests(response)
if response.code >= 400 then
local message = string.format("HTTP %s:\n%s", tostring(response.code), response.body)
return Promise.reject(message)
end
return response
end
local function rejectWrongProtocolVersion(infoResponseBody)
if infoResponseBody.protocolVersion ~= Config.protocolVersion then
local message = (
"Found a Rojo dev server, but it's using a different protocol version, and is incompatible." ..
"\nMake sure you have matching versions of both the Rojo plugin and server!" ..
"\n\nYour client is version %s, with protocol version %s. It expects server version %s." ..
"\nYour server is version %s, with protocol version %s." ..
"\n\nGo to https://github.com/rojo-rbx/rojo for more details."
):format(
Version.display(Config.version), Config.protocolVersion,
Config.expectedServerVersionString,
infoResponseBody.serverVersion, infoResponseBody.protocolVersion
)
return Promise.reject(message)
end
return Promise.resolve(infoResponseBody)
end
local function rejectWrongPlaceId(infoResponseBody)
if infoResponseBody.expectedPlaceIds ~= nil then
local foundId = false
for _, id in ipairs(infoResponseBody.expectedPlaceIds) do
if id == game.PlaceId then
foundId = true
break
end
end
if not foundId then
local idList = {}
for _, id in ipairs(infoResponseBody.expectedPlaceIds) do
table.insert(idList, "- " .. tostring(id))
end
local message = (
"Found a Rojo server, but its project is set to only be used with a specific list of places." ..
"\nYour place ID is %s, but needs to be one of these:" ..
"\n%s" ..
"\n\nTo change this list, edit 'servePlaceIds' in your .project.json file."
):format(
tostring(game.PlaceId),
table.concat(idList, "\n")
)
return Promise.reject(message)
end
end
return Promise.resolve(infoResponseBody)
end
local ApiContext = {}
ApiContext.__index = ApiContext
function ApiContext.new(baseUrl)
assert(type(baseUrl) == "string")
local self = {
__baseUrl = baseUrl,
__sessionId = nil,
__messageCursor = -1,
__connected = true,
}
return setmetatable(self, ApiContext)
end
function ApiContext:__fmtDebug(output)
output:writeLine("ApiContext {{")
output:indent()
output:writeLine("Connected: {}", self.__connected)
output:writeLine("Base URL: {}", self.__baseUrl)
output:writeLine("Session ID: {}", self.__sessionId)
output:writeLine("Message Cursor: {}", self.__messageCursor)
output:unindent()
output:write("}")
end
function ApiContext:disconnect()
self.__connected = false
end
function ApiContext:setMessageCursor(index)
self.__messageCursor = index
end
function ApiContext:connect()
local url = ("%s/api/rojo"):format(self.__baseUrl)
return Http.get(url)
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(rejectWrongProtocolVersion)
:andThen(function(body)
assert(validateApiInfo(body))
return body
end)
:andThen(rejectWrongPlaceId)
:andThen(function(body)
self.__sessionId = body.sessionId
return body
end)
end
function ApiContext:read(ids)
local url = ("%s/api/read/%s"):format(self.__baseUrl, table.concat(ids, ","))
return Http.get(url)
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end
assert(validateApiRead(body))
return body
end)
end
function ApiContext:write(patch)
local url = ("%s/api/write"):format(self.__baseUrl)
local updated = {}
for _, update in ipairs(patch.updated) do
local fixedUpdate = {
id = update.id,
changedName = update.changedName,
}
if next(update.changedProperties) ~= nil then
fixedUpdate.changedProperties = update.changedProperties
end
table.insert(updated, fixedUpdate)
end
-- Only add the 'added' field if the table is non-empty, or else Roblox's
-- JSON implementation will turn the table into an array instead of an
-- object, causing API validation to fail.
local added
if next(patch.added) ~= nil then
added = patch.added
end
local body = {
sessionId = self.__sessionId,
removed = patch.removed,
updated = updated,
added = added,
}
body = Http.jsonEncode(body)
return Http.post(url, body)
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(function(body)
Log.info("Write response: {:?}", body)
return body
end)
end
function ApiContext:retrieveMessages()
local url = ("%s/api/subscribe/%s"):format(self.__baseUrl, self.__messageCursor)
local function sendRequest()
return Http.get(url)
:catch(function(err)
if err.type == Http.Error.Kind.Timeout then
if self.__connected then
return sendRequest()
else
return hangingPromise()
end
end
return Promise.reject(err)
end)
end
return sendRequest()
:andThen(rejectFailedRequests)
:andThen(Http.Response.json)
:andThen(function(body)
if body.sessionId ~= self.__sessionId then
return Promise.reject("Server changed ID")
end
assert(validateApiSubscribe(body))
self:setMessageCursor(body.messageCursor)
return body.messages
end)
end
return ApiContext

34
plugin/src/Assets.lua Normal file
View File

@@ -0,0 +1,34 @@
local strict = require(script.Parent.strict)
local Assets = {
Sprites = {},
Slices = {
RoundBox = {
asset = "rbxassetid://2773204550",
offset = Vector2.new(0, 0),
size = Vector2.new(32, 32),
center = Rect.new(4, 4, 4, 4),
},
},
Images = {
Logo = "rbxassetid://3405346157",
Icon = "rbxassetid://3405341609",
},
StartSession = "",
SessionActive = "",
Configure = "",
}
local function guardForTypos(name, map)
strict(name, map)
for key, child in pairs(map) do
if type(child) == "table" then
guardForTypos(("%s.%s"):format(name, key), child)
end
end
end
guardForTypos("Assets", Assets)
return Assets

View File

@@ -0,0 +1,228 @@
local Rojo = script:FindFirstAncestor("Rojo")
local Plugin = Rojo.Plugin
local Roact = require(Rojo.Roact)
local Log = require(Rojo.Log)
local ApiContext = require(Plugin.ApiContext)
local Assets = require(Plugin.Assets)
local Config = require(Plugin.Config)
local DevSettings = require(Plugin.DevSettings)
local ServeSession = require(Plugin.ServeSession)
local Version = require(Plugin.Version)
local preloadAssets = require(Plugin.preloadAssets)
local strict = require(Plugin.strict)
local Theme = require(Plugin.Components.Theme)
local ConnectPanel = require(Plugin.Components.ConnectPanel)
local ConnectingPanel = require(Plugin.Components.ConnectingPanel)
local ConnectionActivePanel = require(Plugin.Components.ConnectionActivePanel)
local ErrorPanel = require(Plugin.Components.ErrorPanel)
local e = Roact.createElement
local function showUpgradeMessage(lastVersion)
local message = (
"Rojo detected an upgrade from version %s to version %s." ..
"\nMake sure you have also upgraded your server!" ..
"\n\nRojo plugin version %s is intended for use with server version %s."
):format(
Version.display(lastVersion), Version.display(Config.version),
Version.display(Config.version), Config.expectedServerVersionString
)
Log.info(message)
end
--[[
Check if the user is using a newer version of Rojo than last time. If they
are, show them a reminder to make sure they check their server version.
]]
local function checkUpgrade(plugin)
-- When developing Rojo, there's no use in doing version checks
if DevSettings:isEnabled() then
return
end
local lastVersion = plugin:GetSetting("LastRojoVersion")
if lastVersion then
local wasUpgraded = Version.compare(Config.version, lastVersion) == 1
if wasUpgraded then
showUpgradeMessage(lastVersion)
end
end
plugin:SetSetting("LastRojoVersion", Config.version)
end
local AppStatus = strict("AppStatus", {
NotStarted = "NotStarted",
Connecting = "Connecting",
Connected = "Connected",
Error = "Error",
})
local App = Roact.Component:extend("App")
function App:init()
self:setState({
appStatus = AppStatus.NotStarted,
errorMessage = nil,
})
self.signals = {}
self.serveSession = nil
self.displayedVersion = DevSettings:isEnabled()
and Config.codename
or Version.display(Config.version)
local toolbar = self.props.plugin:CreateToolbar("Rojo " .. self.displayedVersion)
self.toggleButton = toolbar:CreateButton(
"Rojo",
"Show or hide the Rojo panel",
Assets.Images.Icon)
self.toggleButton.ClickableWhenViewportHidden = true
self.toggleButton.Click:Connect(function()
self.dockWidget.Enabled = not self.dockWidget.Enabled
end)
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Right,
false, -- Initially enabled state
false, -- Whether to override the widget's previous state
360, 190, -- Floating size
360, 190 -- Minimum size
)
self.dockWidget = self.props.plugin:CreateDockWidgetPluginGui("Rojo-" .. self.displayedVersion, widgetInfo)
self.dockWidget.Name = "Rojo " .. self.displayedVersion
self.dockWidget.Title = "Rojo " .. self.displayedVersion
self.dockWidget.AutoLocalize = false
self.dockWidget.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
self.signals.dockWidgetEnabled = self.dockWidget:GetPropertyChangedSignal("Enabled"):Connect(function()
self.toggleButton:SetActive(self.dockWidget.Enabled)
end)
end
function App:startSession(address, port)
Log.trace("Starting new session")
local baseUrl = ("http://%s:%s"):format(address, port)
self.serveSession = ServeSession.new({
apiContext = ApiContext.new(baseUrl),
})
self.serveSession:onStatusChanged(function(status, details)
if status == ServeSession.Status.Connecting then
self:setState({
appStatus = AppStatus.Connecting,
})
elseif status == ServeSession.Status.Connected then
self:setState({
appStatus = AppStatus.Connected,
})
elseif status == ServeSession.Status.Disconnected then
self.serveSession = nil
-- Details being present indicates that this
-- disconnection was from an error.
if details ~= nil then
Log.warn("Disconnected from an error: {}", details)
self:setState({
appStatus = AppStatus.Error,
errorMessage = tostring(details),
})
else
self:setState({
appStatus = AppStatus.NotStarted,
})
end
end
end)
self.serveSession:start()
end
function App:render()
local children
if self.state.appStatus == AppStatus.NotStarted then
children = {
ConnectPanel = e(ConnectPanel, {
startSession = function(address, port)
self:startSession(address, port)
end,
cancel = function()
Log.trace("Canceling session configuration")
self:setState({
appStatus = AppStatus.NotStarted,
})
end,
}),
}
elseif self.state.appStatus == AppStatus.Connecting then
children = {
ConnectingPanel = Roact.createElement(ConnectingPanel),
}
elseif self.state.appStatus == AppStatus.Connected then
children = {
ConnectionActivePanel = e(ConnectionActivePanel, {
stopSession = function()
Log.trace("Disconnecting session")
self.serveSession:stop()
self.serveSession = nil
self:setState({
appStatus = AppStatus.NotStarted,
})
Log.trace("Session terminated by user")
end,
}),
}
elseif self.state.appStatus == AppStatus.Error then
children = {
ErrorPanel = Roact.createElement(ErrorPanel, {
errorMessage = self.state.errorMessage,
onDismiss = function()
self:setState({
appStatus = AppStatus.NotStarted,
})
end,
}),
}
end
return Roact.createElement(Theme.StudioProvider, nil, {
UI = Roact.createElement(Roact.Portal, {
target = self.dockWidget,
}, children),
})
end
function App:didMount()
Log.trace("Rojo {} initializing", self.displayedVersion)
checkUpgrade(self.props.plugin)
preloadAssets()
end
function App:willUnmount()
if self.serveSession ~= nil then
self.serveSession:stop()
self.serveSession = nil
end
for _, signal in pairs(self.signals) do
signal:Disconnect()
end
end
return App

View File

@@ -0,0 +1,163 @@
local Rojo = script:FindFirstAncestor("Rojo")
local Plugin = Rojo.Plugin
local Roact = require(Rojo.Roact)
local Config = require(Plugin.Config)
local Theme = require(Plugin.Components.Theme)
local Panel = require(Plugin.Components.Panel)
local FitList = require(Plugin.Components.FitList)
local FitText = require(Plugin.Components.FitText)
local FormButton = require(Plugin.Components.FormButton)
local FormTextInput = require(Plugin.Components.FormTextInput)
local e = Roact.createElement
local ConnectPanel = Roact.Component:extend("ConnectPanel")
function ConnectPanel:init()
self:setState({
address = "",
port = "",
})
end
function ConnectPanel:render()
local startSession = self.props.startSession
return Theme.with(function(theme)
return e(Panel, nil, {
Layout = e("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
}),
Inputs = e(FitList, {
containerProps = {
BackgroundTransparency = 1,
LayoutOrder = 1,
},
layoutProps = {
FillDirection = Enum.FillDirection.Horizontal,
Padding = UDim.new(0, 8),
},
paddingProps = {
PaddingTop = UDim.new(0, 20),
PaddingBottom = UDim.new(0, 10),
PaddingLeft = UDim.new(0, 24),
PaddingRight = UDim.new(0, 24),
},
}, {
Address = e(FitList, {
containerProps = {
LayoutOrder = 1,
BackgroundTransparency = 1,
},
layoutProps = {
Padding = UDim.new(0, 4),
},
}, {
Label = e(FitText, {
Kind = "TextLabel",
LayoutOrder = 1,
BackgroundTransparency = 1,
TextXAlignment = Enum.TextXAlignment.Left,
Font = theme.TitleFont,
TextSize = 20,
Text = "Address",
TextColor3 = theme.Text1,
}),
Input = e(FormTextInput, {
layoutOrder = 2,
width = UDim.new(0, 220),
value = self.state.address,
placeholderValue = Config.defaultHost,
onValueChange = function(newValue)
self:setState({
address = newValue,
})
end,
}),
}),
Port = e(FitList, {
containerProps = {
LayoutOrder = 2,
BackgroundTransparency = 1,
},
layoutProps = {
Padding = UDim.new(0, 4),
},
}, {
Label = e(FitText, {
Kind = "TextLabel",
LayoutOrder = 1,
BackgroundTransparency = 1,
TextXAlignment = Enum.TextXAlignment.Left,
Font = theme.TitleFont,
TextSize = 20,
Text = "Port",
TextColor3 = theme.Text1,
}),
Input = e(FormTextInput, {
layoutOrder = 2,
width = UDim.new(0, 80),
value = self.state.port,
placeholderValue = Config.defaultPort,
onValueChange = function(newValue)
self:setState({
port = newValue,
})
end,
}),
}),
}),
Buttons = e(FitList, {
fitAxes = "Y",
containerProps = {
BackgroundTransparency = 1,
LayoutOrder = 2,
Size = UDim2.new(1, 0, 0, 0),
},
layoutProps = {
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = Enum.HorizontalAlignment.Right,
Padding = UDim.new(0, 8),
},
paddingProps = {
PaddingTop = UDim.new(0, 0),
PaddingBottom = UDim.new(0, 20),
PaddingLeft = UDim.new(0, 24),
PaddingRight = UDim.new(0, 24),
},
}, {
e(FormButton, {
layoutOrder = 2,
text = "Connect",
onClick = function()
if startSession ~= nil then
local address = self.state.address
if address:len() == 0 then
address = Config.defaultHost
end
local port = self.state.port
if port:len() == 0 then
port = Config.defaultPort
end
startSession(address, port)
end
end,
}),
}),
})
end)
end
return ConnectPanel

View File

@@ -0,0 +1,35 @@
local Roact = require(script:FindFirstAncestor("Rojo").Roact)
local Plugin = script:FindFirstAncestor("Plugin")
local Theme = require(Plugin.Components.Theme)
local Panel = require(Plugin.Components.Panel)
local FitText = require(Plugin.Components.FitText)
local e = Roact.createElement
local ConnectingPanel = Roact.Component:extend("ConnectingPanel")
function ConnectingPanel:render()
return Theme.with(function(theme)
return e(Panel, nil, {
Layout = Roact.createElement("UIListLayout", {
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
SortOrder = Enum.SortOrder.LayoutOrder,
Padding = UDim.new(0, 8),
}),
Text = e(FitText, {
Padding = Vector2.new(12, 6),
Font = theme.ButtonFont,
TextSize = 18,
Text = "Connecting...",
TextColor3 = theme.Text1,
BackgroundTransparency = 1,
}),
})
end)
end
return ConnectingPanel

View File

@@ -0,0 +1,47 @@
local Roact = require(script:FindFirstAncestor("Rojo").Roact)
local Plugin = script:FindFirstAncestor("Plugin")
local Theme = require(Plugin.Components.Theme)
local Panel = require(Plugin.Components.Panel)
local FitText = require(Plugin.Components.FitText)
local FormButton = require(Plugin.Components.FormButton)
local e = Roact.createElement
local ConnectionActivePanel = Roact.Component:extend("ConnectionActivePanel")
function ConnectionActivePanel:render()
local stopSession = self.props.stopSession
return Theme.with(function(theme)
return e(Panel, nil, {
Layout = Roact.createElement("UIListLayout", {
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
SortOrder = Enum.SortOrder.LayoutOrder,
Padding = UDim.new(0, 8),
}),
Text = e(FitText, {
Padding = Vector2.new(12, 6),
Font = theme.ButtonFont,
TextSize = 18,
Text = "Connected to Live-Sync Server",
TextColor3 = theme.Text1,
BackgroundTransparency = 1,
}),
DisconnectButton = e(FormButton, {
layoutOrder = 2,
text = "Disconnect",
secondary = true,
onClick = function()
stopSession()
end,
}),
})
end)
end
return ConnectionActivePanel

View File

@@ -0,0 +1,70 @@
local Roact = require(script:FindFirstAncestor("Rojo").Roact)
local Plugin = script:FindFirstAncestor("Plugin")
local Theme = require(Plugin.Components.Theme)
local Panel = require(Plugin.Components.Panel)
local FitText = require(Plugin.Components.FitText)
local FitScrollingFrame = require(Plugin.Components.FitScrollingFrame)
local FormButton = require(Plugin.Components.FormButton)
local e = Roact.createElement
local BUTTON_HEIGHT = 60
local HOR_PADDING = 8
local ErrorPanel = Roact.Component:extend("ErrorPanel")
function ErrorPanel:render()
local errorMessage = self.props.errorMessage
local onDismiss = self.props.onDismiss
return Theme.with(function(theme)
return e(Panel, nil, {
Layout = Roact.createElement("UIListLayout", {
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
SortOrder = Enum.SortOrder.LayoutOrder,
Padding = UDim.new(0, 8),
}),
ErrorContainer = e(FitScrollingFrame, {
containerProps = {
BackgroundTransparency = 1,
BorderSizePixel = 0,
Size = UDim2.new(1, -HOR_PADDING * 2, 1, -BUTTON_HEIGHT),
Position = UDim2.new(0, HOR_PADDING, 0, 0),
ScrollBarImageColor3 = theme.Text1,
VerticalScrollBarInset = Enum.ScrollBarInset.ScrollBar,
ScrollingDirection = Enum.ScrollingDirection.Y,
},
}, {
Text = e(FitText, {
Size = UDim2.new(1, 0, 0, 0),
LayoutOrder = 1,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
FitAxis = "Y",
Font = theme.ButtonFont,
TextSize = 18,
Text = errorMessage,
TextWrap = true,
TextColor3 = theme.Text1,
BackgroundTransparency = 1,
}),
}),
DismissButton = e(FormButton, {
layoutOrder = 2,
text = "Dismiss",
secondary = true,
onClick = function()
onDismiss()
end,
}),
})
end)
end
return ErrorPanel

View File

@@ -0,0 +1,63 @@
local Roact = require(script:FindFirstAncestor("Rojo").Roact)
local Dictionary = require(script.Parent.Parent.Dictionary)
local e = Roact.createElement
local FitList = Roact.Component:extend("FitList")
function FitList:init()
self.sizeBinding, self.setSize = Roact.createBinding(UDim2.new())
end
function FitList:render()
local containerKind = self.props.containerKind or "Frame"
local fitAxes = self.props.fitAxes or "XY"
local containerProps = self.props.containerProps
local layoutProps = self.props.layoutProps
local paddingProps = self.props.paddingProps
local padding
if paddingProps ~= nil then
padding = e("UIPadding", paddingProps)
end
local children = Dictionary.merge(self.props[Roact.Children], {
["$Layout"] = e("UIListLayout", Dictionary.merge({
SortOrder = Enum.SortOrder.LayoutOrder,
[Roact.Change.AbsoluteContentSize] = function(instance)
local contentSize = instance.AbsoluteContentSize
if paddingProps ~= nil then
contentSize = contentSize + Vector2.new(
paddingProps.PaddingLeft.Offset + paddingProps.PaddingRight.Offset,
paddingProps.PaddingTop.Offset + paddingProps.PaddingBottom.Offset)
end
local combinedSize
if fitAxes == "X" then
combinedSize = UDim2.new(0, contentSize.X, containerProps.Size.Y.Scale, containerProps.Size.Y.Offset)
elseif fitAxes == "Y" then
combinedSize = UDim2.new(containerProps.Size.X.Scale, containerProps.Size.X.Offset, 0, contentSize.Y)
elseif fitAxes == "XY" then
combinedSize = UDim2.new(0, contentSize.X, 0, contentSize.Y)
else
error("Invalid fitAxes value")
end
self.setSize(combinedSize)
end,
}, layoutProps)),
["$Padding"] = padding,
})
local fullContainerProps = Dictionary.merge(containerProps, {
Size = self.sizeBinding,
})
return e(containerKind, fullContainerProps, children)
end
return FitList

View File

@@ -0,0 +1,33 @@
local Roact = require(script:FindFirstAncestor("Rojo").Roact)
local Dictionary = require(script.Parent.Parent.Dictionary)
local e = Roact.createElement
local FitScrollingFrame = Roact.Component:extend("FitScrollingFrame")
function FitScrollingFrame:init()
self.sizeBinding, self.setSize = Roact.createBinding(UDim2.new())
end
function FitScrollingFrame:render()
local containerProps = self.props.containerProps
local layoutProps = self.props.layoutProps
local children = Dictionary.merge(self.props[Roact.Children], {
["$Layout"] = e("UIListLayout", Dictionary.merge({
SortOrder = Enum.SortOrder.LayoutOrder,
[Roact.Change.AbsoluteContentSize] = function(instance)
self.setSize(UDim2.new(0, 0, 0, instance.AbsoluteContentSize.Y))
end,
}, layoutProps)),
})
local fullContainerProps = Dictionary.merge(containerProps, {
CanvasSize = self.sizeBinding,
})
return e("ScrollingFrame", fullContainerProps, children)
end
return FitScrollingFrame

View File

@@ -0,0 +1,88 @@
local TextService = game:GetService("TextService")
local Roact = require(script:FindFirstAncestor("Rojo").Roact)
local Dictionary = require(script.Parent.Parent.Dictionary)
local e = Roact.createElement
local FitText = Roact.Component:extend("FitText")
function FitText:init()
self.ref = Roact.createRef()
self.sizeBinding, self.setSize = Roact.createBinding(UDim2.new())
end
function FitText:render()
local kind = self.props.Kind or "TextLabel"
local containerProps = Dictionary.merge(self.props, {
FitAxis = Dictionary.None,
Kind = Dictionary.None,
Padding = Dictionary.None,
MinSize = Dictionary.None,
Size = self.sizeBinding,
[Roact.Ref] = self.ref,
[Roact.Change.AbsoluteSize] = function()
self:updateTextMeasurements()
end
})
return e(kind, containerProps)
end
function FitText:didMount()
self:updateTextMeasurements()
end
function FitText:didUpdate()
self:updateTextMeasurements()
end
function FitText:updateTextMeasurements()
local minSize = self.props.MinSize or Vector2.new(0, 0)
local padding = self.props.Padding or Vector2.new(0, 0)
local fitAxis = self.props.FitAxis or "XY"
local baseSize = self.props.Size
local text = self.props.Text or ""
local font = self.props.Font or Enum.Font.Legacy
local textSize = self.props.TextSize or 12
local containerSize = self.ref.current.AbsoluteSize
local textBounds
if fitAxis == "XY" then
textBounds = Vector2.new(9e6, 9e6)
elseif fitAxis == "X" then
textBounds = Vector2.new(9e6, containerSize.Y - padding.Y * 2)
elseif fitAxis == "Y" then
textBounds = Vector2.new(containerSize.X - padding.X * 2, 9e6)
end
local measuredText = TextService:GetTextSize(text, textSize, font, textBounds)
local computedX = math.max(minSize.X, padding.X * 2 + measuredText.X)
local computedY = math.max(minSize.Y, padding.Y * 2 + measuredText.Y)
local totalSize
if fitAxis == "XY" then
totalSize = UDim2.new(
0, computedX,
0, computedY)
elseif fitAxis == "X" then
totalSize = UDim2.new(
0, computedX,
baseSize.Y.Scale, baseSize.Y.Offset)
elseif fitAxis == "Y" then
totalSize = UDim2.new(
baseSize.X.Scale, baseSize.X.Offset,
0, computedY)
end
self.setSize(totalSize)
end
return FitText

View File

@@ -0,0 +1,64 @@
local Rojo = script:FindFirstAncestor("Rojo")
local Plugin = Rojo.Plugin
local Roact = require(Rojo.Roact)
local Assets = require(Plugin.Assets)
local Theme = require(Plugin.Components.Theme)
local FitList = require(Plugin.Components.FitList)
local FitText = require(Plugin.Components.FitText)
local e = Roact.createElement
local RoundBox = Assets.Slices.RoundBox
local function FormButton(props)
local text = props.text
local layoutOrder = props.layoutOrder
local onClick = props.onClick
local textColor
local backgroundColor
return Theme.with(function(theme)
if props.secondary then
textColor = theme.Brand1
backgroundColor = theme.Background2
else
textColor = theme.TextOnAccent
backgroundColor = theme.Brand1
end
return e(FitList, {
containerKind = "ImageButton",
containerProps = {
LayoutOrder = layoutOrder,
BackgroundTransparency = 1,
Image = RoundBox.asset,
ImageRectOffset = RoundBox.offset,
ImageRectSize = RoundBox.size,
SliceCenter = RoundBox.center,
ScaleType = Enum.ScaleType.Slice,
ImageColor3 = backgroundColor,
[Roact.Event.Activated] = function()
if onClick ~= nil then
onClick()
end
end,
},
}, {
Text = e(FitText, {
Kind = "TextLabel",
Text = text,
TextSize = 18,
TextColor3 = textColor,
Font = theme.ButtonFont,
Padding = Vector2.new(16, 8),
BackgroundTransparency = 1,
}),
})
end)
end
return FormButton

View File

@@ -0,0 +1,82 @@
local Rojo = script:FindFirstAncestor("Rojo")
local Plugin = Rojo.Plugin
local Roact = require(Rojo.Roact)
local Assets = require(Plugin.Assets)
local Theme = require(Plugin.Components.Theme)
local e = Roact.createElement
local RoundBox = Assets.Slices.RoundBox
local TEXT_SIZE = 22
local PADDING = 8
local FormTextInput = Roact.Component:extend("FormTextInput")
function FormTextInput:init()
self:setState({
focused = false,
})
end
function FormTextInput:render()
local value = self.props.value
local placeholderValue = self.props.placeholderValue
local onValueChange = self.props.onValueChange
local layoutOrder = self.props.layoutOrder
local width = self.props.width
local shownPlaceholder
if self.state.focused then
shownPlaceholder = ""
else
shownPlaceholder = placeholderValue
end
return Theme.with(function(theme)
return e("ImageLabel", {
LayoutOrder = layoutOrder,
Image = RoundBox.asset,
ImageRectOffset = RoundBox.offset,
ImageRectSize = RoundBox.size,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = RoundBox.center,
ImageColor3 = theme.Background2,
Size = UDim2.new(width.Scale, width.Offset, 0, TEXT_SIZE + PADDING * 2),
BackgroundTransparency = 1,
}, {
InputInner = e("TextBox", {
BackgroundTransparency = 1,
Size = UDim2.new(1, -PADDING * 2, 1, -PADDING * 2),
Position = UDim2.new(0.5, 0, 0.5, 0),
AnchorPoint = Vector2.new(0.5, 0.5),
Font = theme.InputFont,
ClearTextOnFocus = false,
TextXAlignment = Enum.TextXAlignment.Center,
TextSize = TEXT_SIZE,
Text = value,
PlaceholderText = shownPlaceholder,
PlaceholderColor3 = theme.Text2,
TextColor3 = theme.Text1,
[Roact.Change.Text] = function(rbx)
onValueChange(rbx.Text)
end,
[Roact.Event.Focused] = function()
self:setState({
focused = true,
})
end,
[Roact.Event.FocusLost] = function()
self:setState({
focused = false,
})
end,
}),
})
end)
end
return FormTextInput

View File

@@ -0,0 +1,38 @@
local Roact = require(script:FindFirstAncestor("Rojo").Roact)
local Plugin = script:FindFirstAncestor("Plugin")
local RojoFooter = require(Plugin.Components.RojoFooter)
local Theme = require(Plugin.Components.Theme)
local e = Roact.createElement
local Panel = Roact.Component:extend("Panel")
function Panel:init()
self.footerSize, self.setFooterSize = Roact.createBinding(Vector2.new())
end
function Panel:render()
return Theme.with(function(theme)
return e("Frame", {
Size = UDim2.new(1, 0, 1, 0),
BackgroundColor3 = theme.Background1,
BorderSizePixel = 1,
}, {
Layout = Roact.createElement("UIListLayout", {
HorizontalAlignment = Enum.HorizontalAlignment.Center,
SortOrder = Enum.SortOrder.LayoutOrder,
}),
Body = e("Frame", {
Size = UDim2.new(0, 360, 1, -32),
BackgroundTransparency = 1,
}, self.props[Roact.Children]),
Footer = e(RojoFooter),
})
end)
end
return Panel

View File

@@ -0,0 +1,70 @@
local Rojo = script:FindFirstAncestor("Rojo")
local Plugin = Rojo.Plugin
local Roact = require(Rojo.Roact)
local Config = require(Plugin.Config)
local Version = require(Plugin.Version)
local Assets = require(Plugin.Assets)
local Theme = require(Plugin.Components.Theme)
local e = Roact.createElement
local RojoFooter = Roact.Component:extend("RojoFooter")
function RojoFooter:init()
self.footerSize, self.setFooterSize = Roact.createBinding(Vector2.new())
self.footerVersionSize, self.setFooterVersionSize = Roact.createBinding(Vector2.new())
end
function RojoFooter:render()
return Theme.with(function(theme)
return e("Frame", {
LayoutOrder = 3,
Size = UDim2.new(1, 0, 0, 32),
BackgroundColor3 = theme.Background2,
BorderSizePixel = 0,
ZIndex = 2,
}, {
Padding = e("UIPadding", {
PaddingTop = UDim.new(0, 4),
PaddingBottom = UDim.new(0, 4),
PaddingLeft = UDim.new(0, 8),
PaddingRight = UDim.new(0, 8),
}),
LogoContainer = e("Frame", {
BackgroundTransparency = 1,
Size = UDim2.new(0, 0, 0, 32),
}, {
Logo = e("ImageLabel", {
Image = Assets.Images.Logo,
Size = UDim2.new(0, 80, 0, 40),
ScaleType = Enum.ScaleType.Fit,
BackgroundTransparency = 1,
Position = UDim2.new(0, 0, 1, -10),
AnchorPoint = Vector2.new(0, 1),
}),
}),
Version = e("TextLabel", {
Position = UDim2.new(1, 0, 0, 0),
Size = UDim2.new(0, 0, 1, 0),
AnchorPoint = Vector2.new(1, 0),
Font = theme.TitleFont,
TextSize = 18,
Text = Version.display(Config.version),
TextXAlignment = Enum.TextXAlignment.Right,
TextColor3 = theme.Text2,
BackgroundTransparency = 1,
[Roact.Change.AbsoluteSize] = function(rbx)
self.setFooterVersionSize(rbx.AbsoluteSize)
end,
}),
})
end)
end
return RojoFooter

View File

@@ -0,0 +1,104 @@
--[[
Theming system taking advantage of Roact's new context API.
Doesn't use colors provided by Studio and instead just branches on theme
name. This isn't exactly best practice.
]]
local Studio = settings():GetService("Studio")
local Rojo = script:FindFirstAncestor("Rojo")
local Roact = require(Rojo.Roact)
local Log = require(Rojo.Log)
local strict = require(script.Parent.Parent.strict)
local lightTheme = strict("Theme", {
ButtonFont = Enum.Font.GothamSemibold,
InputFont = Enum.Font.Code,
TitleFont = Enum.Font.GothamBold,
MainFont = Enum.Font.Gotham,
Brand1 = Color3.fromRGB(225, 56, 53),
Text1 = Color3.fromRGB(64, 64, 64),
Text2 = Color3.fromRGB(160, 160, 160),
TextOnAccent = Color3.fromRGB(235, 235, 235),
Background1 = Color3.fromRGB(255, 255, 255),
Background2 = Color3.fromRGB(235, 235, 235),
})
local darkTheme = strict("Theme", {
ButtonFont = Enum.Font.GothamSemibold,
InputFont = Enum.Font.Code,
TitleFont = Enum.Font.GothamBold,
MainFont = Enum.Font.Gotham,
Brand1 = Color3.fromRGB(225, 56, 53),
Text1 = Color3.fromRGB(235, 235, 235),
Text2 = Color3.fromRGB(200, 200, 200),
TextOnAccent = Color3.fromRGB(235, 235, 235),
Background1 = Color3.fromRGB(48, 48, 48),
Background2 = Color3.fromRGB(64, 64, 64),
})
local Context = Roact.createContext(lightTheme)
local StudioProvider = Roact.Component:extend("StudioProvider")
-- Pull the current theme from Roblox Studio and update state with it.
function StudioProvider:updateTheme()
local studioTheme = Studio.Theme
if studioTheme.Name == "Light" then
self:setState({
theme = lightTheme,
})
elseif studioTheme.Name == "Dark" then
self:setState({
theme = darkTheme,
})
else
Log.warn("Unexpected theme '{}'' -- falling back to light theme!", studioTheme.Name)
self:setState({
theme = lightTheme,
})
end
end
function StudioProvider:init()
self:updateTheme()
end
function StudioProvider:render()
return Roact.createElement(Context.Provider, {
value = self.state.theme,
}, self.props[Roact.Children])
end
function StudioProvider:didMount()
self.connection = Studio.ThemeChanged:Connect(function()
self:updateTheme()
end)
end
function StudioProvider:willUnmount()
self.connection:Disconnect()
end
local function with(callback)
return Roact.createElement(Context.Consumer, {
render = callback,
})
end
return {
StudioProvider = StudioProvider,
Consumer = Context.Consumer,
with = with,
}

View File

@@ -1,7 +1,13 @@
return {
pollingRate = 0.2,
version = {0, 4, 4},
expectedServerVersionString = "0.4.x",
protocolVersion = 1,
dev = false,
}
local strict = require(script.Parent.strict)
local isDevBuild = script.Parent.Parent:FindFirstChild("ROJO_DEV_BUILD") ~= nil
return strict("Config", {
isDevBuild = isDevBuild,
codename = "Epiphany",
version = {0, 6, 0, "-alpha.3"},
expectedServerVersionString = "0.6.0 or newer",
protocolVersion = 3,
defaultHost = "localhost",
defaultPort = 34872,
})

View File

@@ -1,7 +0,0 @@
return function()
local Config = require(script.Parent.Config)
it("should have 'dev' disabled", function()
expect(Config.dev).to.equal(false)
end)
end

151
plugin/src/DevSettings.lua Normal file
View File

@@ -0,0 +1,151 @@
local Config = require(script.Parent.Config)
local Environment = {
User = "User",
Dev = "Dev",
Test = "Test",
}
local DEFAULT_ENVIRONMENT = Config.isDevBuild and Environment.Dev or Environment.User
local VALUES = {
LogLevel = {
type = "IntValue",
values = {
[Environment.User] = 2,
[Environment.Dev] = 4,
[Environment.Test] = 4,
},
},
TypecheckingEnabled = {
type = "BoolValue",
values = {
[Environment.User] = false,
[Environment.Dev] = true,
[Environment.Test] = true,
},
},
UnstableTwoWaySync = {
type = "BoolValue",
values = {
[Environment.User] = false,
[Environment.Dev] = false,
[Environment.Test] = false,
},
},
}
local CONTAINER_NAME = "RojoDevSettings" .. Config.codename
local function getValueContainer()
return game:FindFirstChild(CONTAINER_NAME)
end
local valueContainer = getValueContainer()
game.ChildAdded:Connect(function(child)
local success, name = pcall(function()
return child.Name
end)
if success and name == CONTAINER_NAME then
valueContainer = child
end
end)
local function getStoredValue(name)
if valueContainer == nil then
return nil
end
local valueObject = valueContainer:FindFirstChild(name)
if valueObject == nil then
return nil
end
return valueObject.Value
end
local function setStoredValue(name, kind, value)
local object = valueContainer:FindFirstChild(name)
if object == nil then
object = Instance.new(kind)
object.Name = name
object.Parent = valueContainer
end
object.Value = value
end
local function createAllValues(environment)
assert(Environment[environment] ~= nil, "Invalid environment")
valueContainer = getValueContainer()
if valueContainer == nil then
valueContainer = Instance.new("Folder")
valueContainer.Name = CONTAINER_NAME
valueContainer.Parent = game
end
for name, value in pairs(VALUES) do
setStoredValue(name, value.type, value.values[environment])
end
end
local function getValue(name)
assert(VALUES[name] ~= nil, "Invalid DevSettings name")
local stored = getStoredValue(name)
if stored ~= nil then
return stored
end
return VALUES[name].values[DEFAULT_ENVIRONMENT]
end
local DevSettings = {}
function DevSettings:createDevSettings()
createAllValues(Environment.Dev)
end
function DevSettings:createTestSettings()
createAllValues(Environment.Test)
end
function DevSettings:hasChangedValues()
return valueContainer ~= nil
end
function DevSettings:resetValues()
if valueContainer then
valueContainer:Destroy()
valueContainer = nil
end
end
function DevSettings:isEnabled()
return valueContainer ~= nil
end
function DevSettings:getLogLevel()
return getValue("LogLevel")
end
function DevSettings:shouldTypecheck()
return getValue("TypecheckingEnabled")
end
function DevSettings:twoWaySyncEnabled()
return getValue("UnstableTwoWaySync")
end
function _G.ROJO_DEV_CREATE()
DevSettings:createDevSettings()
end
return DevSettings

33
plugin/src/Dictionary.lua Normal file
View File

@@ -0,0 +1,33 @@
--[[
This is a placeholder module waiting for Cryo to become available.
]]
local None = newproxy(true)
getmetatable(None).__tostring = function()
return "None"
end
local function merge(...)
local output = {}
for i = 1, select("#", ...) do
local source = select(i, ...)
if source ~= nil then
for key, value in pairs(source) do
if value == None then
output[key] = nil
else
output[key] = value
end
end
end
end
return output
end
return {
None = None,
merge = merge,
}

View File

@@ -1,67 +0,0 @@
local HttpService = game:GetService("HttpService")
local HTTP_DEBUG = false
local Promise = require(script.Parent.Promise)
local HttpError = require(script.Parent.HttpError)
local HttpResponse = require(script.Parent.HttpResponse)
local function dprint(...)
if HTTP_DEBUG then
print(...)
end
end
local Http = {}
Http.__index = Http
function Http.new(baseUrl)
assert(type(baseUrl) == "string", "Http.new needs a baseUrl!")
local http = {
baseUrl = baseUrl
}
setmetatable(http, Http)
return http
end
function Http:get(endpoint)
dprint("\nGET", endpoint)
return Promise.new(function(resolve, reject)
spawn(function()
local ok, result = pcall(function()
return HttpService:GetAsync(self.baseUrl .. endpoint, true)
end)
if ok then
dprint("\t", result, "\n")
resolve(HttpResponse.new(result))
else
reject(HttpError.fromErrorString(result))
end
end)
end)
end
function Http:post(endpoint, body)
dprint("\nPOST", endpoint)
dprint(body)
return Promise.new(function(resolve, reject)
spawn(function()
local ok, result = pcall(function()
return HttpService:PostAsync(self.baseUrl .. endpoint, body)
end)
if ok then
dprint("\t", result, "\n")
resolve(HttpResponse.new(result))
else
reject(HttpError.fromErrorString(result))
end
end)
end)
end
return Http

View File

@@ -1,60 +0,0 @@
local HttpError = {}
HttpError.__index = HttpError
HttpError.Error = {
HttpNotEnabled = {
message = "Rojo requires HTTP access, which is not enabled.\n" ..
"Check your game settings, located in the 'Home' tab of Studio.",
},
ConnectFailed = {
message = "Rojo plugin couldn't connect to the Rojo server.\n" ..
"Make sure the server is running -- use 'Rojo serve' to run it!",
},
Unknown = {
message = "Rojo encountered an unknown error: {{message}}",
},
}
function HttpError.new(type, extraMessage)
extraMessage = extraMessage or ""
local message = type.message:gsub("{{message}}", extraMessage)
local err = {
type = type,
message = message,
}
setmetatable(err, HttpError)
return err
end
function HttpError:__tostring()
return self.message
end
--[[
This method shouldn't have to exist. Ugh.
]]
function HttpError.fromErrorString(err)
err = err:lower()
if err:find("^http requests are not enabled") then
return HttpError.new(HttpError.Error.HttpNotEnabled)
end
if err:find("^curl error") then
return HttpError.new(HttpError.Error.ConnectFailed)
end
return HttpError.new(HttpError.Error.Unknown, err)
end
function HttpError:report()
warn(self.message)
if self.type == HttpError.Error.HttpNotEnabled then
game:GetService("Selection"):Set{game:GetService("HttpService")}
end
end
return HttpError

View File

@@ -1,20 +0,0 @@
local HttpService = game:GetService("HttpService")
local HttpResponse = {}
HttpResponse.__index = HttpResponse
function HttpResponse.new(body)
local response = {
body = body,
}
setmetatable(response, HttpResponse)
return response
end
function HttpResponse:json()
return HttpService:JSONDecode(self.body)
end
return HttpResponse

Some files were not shown because too many files have changed in this diff Show More