Treema
So, you want to work on this open source project? Awesome! Here's what you need to know.
Setting Up Your Environment
The Github Repository has everything you need to work on Treema. You'll need Node, NPM and Git installed.
-
Clone the repository
git clone https://github.com/sderickson/treema.git
-
Go to the directory and NPM install
npm install
Bam. You're done.
Running The Environment
From the treema directory, run:
bin/treema-brunch
To make starting the dev environment easier, put the bin folder in your PATH. Do that by putting in a line like this in your .profile file:
PATH=$PATH:~/path/to/treema/bin
I also like to set up Mac OS X Window Groups to really make it easy. To do that:
- Go to Terminal preferences and add a Treema profile under the Settings tab, running treema-brunch when it opens (in the Shell inner tab).
- Open a Terminal with that profile (double clicking it works) and set it just where you want it.
- Close all other open terminals.
- Under the Window menu, choose "Save Windows As Group..." and make one for Treema.
Now, whenever you want to work on Treema, open that Window group from the same menu. So easy.
The environment is a Node.js server. It's used for several things:
- Statically serving scratch.html, which is intended as a sandbox for messing with whatever you're building.
- Statically serving test.html, which runs all the Jasmine tests.
- Statically serving all of these Github pages to make it easy to work on them.
- Handling requests for testing subclasses that might use them, such as the DatabaseSearchTreemaNode. The current handler for that one goes to sleep for a split second to give a feel for server wait time.
- Whatever else you might like!
Brunch both runs this server, and also handles trans-compiling from Sass and CoffeeScript to CSS and JavaScript. Assuming you've started brunch, you should be able to access the test page at
http://localhost:9090/test.html
If that worked, you can edit the CoffeeScript files and view changes in scratch.html or any of the html files in /dev.
Things to keep in mind
- Keep everything in CoffeeScript and Sass. They are so good.
- Remember to create tests in the /test folder. jQuery actually works really well (and really efficiently) for testing interface behavior. You never need to insert the treema element into the DOM, you can just trigger events directly through functions like .click(). Check out some of the existing tests on interface behavior for examples.
- Organize new subclasses in new files in /src. All files have access to TreemaNode and its class methods.
What to work on?
We have a handful of advanced features we, ourselves, want next:
- Undo/redo functionality. Use JsonDiffPatch.
- Backup sortable system. Right now it relies on the jQuery UI Sortable component, and if that fails there's so support for rearranging Array entities).
- Icons. Many native interface implementations of this structure supports icons for each element. And they look spiffy.
- Interface for changing the data or schema from without. That way if some other interface makes an edit to the data, Treema can quietly update things.
- Make errors more human friendly.
You could always also add more tests, add more nodes for common cases, or handle reported issues.