Introduction
Hacking SproutCore can be both easy and fun. If you’re writing a SproutCore application and you would like to see a bug fixed or a new feature added, you can get a copy of the framework yourself, make the change, and submit it here. The instructions below well tell you everything you need to get started.
NOTE: These instructions assume you are using the new build system installed using Ruby Gems. If you are not using the build system or if you are using the old Rails plugin, then please ask on the Google Group list and consider contributing the instructions for others to benefit.
Step 1: Get the framework code
When you get the SproutCore build tools from ruby gems, it includes a version of the SproutCore JavaScript. To make changes to this code, however, you will need to get a copy of the framework that you can edit. SproutCore’s source code is hosted using git. Make sure you have git installed and then:
cd MY_PROJECT_DIRECTORY (the directory with an sc-config.rb file in it). mkdir -p frameworks cd frameworks git clone git://github.com/sproutit/sproutcore.git sproutcore
This will checkout a copy of the SproutCore javascript into your frameworks directory. Now, just restart your instance of sc-server and it should automatically load this version of the framework instead of the one found in the build tools.
Step 2: Make some changes!
Now the fun part. Fix a bug. Add a feature! Edits you make to the framework you have just checked out will appear immediately when you refresh the page in your client.
Step 3: Run some tests
Once you have made your change, you should run all the tests at http://localhost:4020/sproutcore/-tests. Make sure they all pass. If you are adding a new feature or fixing a nasty bug, you should consider adding a test for your fix as well. Most changes will not be accepted unless it is covered by a new or existing test. (To test documentation, rebuild the docs and make sure they generate properly).
Be sure you run your tests on at least Firefox and Safari. IE7 will soon become a requirement as well.
Step 4: Submit a patch
Now you are ready to share your code! To submit your change, just create a patch and then submit it as a ticket. Creating a patch to submit is really easy in git. Just type the following:
cd MY_PROJECT/frameworks/sproutcore git commit -a -m"Write a message explaining your fix" git format-patch HEAD^
This will generate patch files for a commit that you can attach to a ticket for inclusion in the framework. Visit our Lighthouse ticket system and open a ticket. Describe your fix and include your patch. Don’t forget to include the tests!
Step 5: Update SproutCore and celebrate your newfound fame
We try to process patch submissions as quickly as possible. If other changes have made it in since you submitted your patch that prevent your patch from being applied, we may ask you to update your SproutCore code and rebuild the patch. This way you can make sure your fix works.
Congratulations, your code change is now part of SproutCore for all the world to use!
When you are ready to send your change in to be applied to SproutCore, simply generate a patch