SproutCore 0.9.17 - “Gem Fixes” Release

This release focuses on gem fixes, as the SproutCore build tools are not compatible with Merb 0.9.5. You can install Merb 0.9.4 like this:

sudo gem install merb-core -v 0.9.4

In addition, Erich Ocean is now able to publish gem updates. Expect SproutCore 0.9.18 in the near future with tons of bug fixes and tests contributed by users over the last 3 weeks.

Build Tools

  • Ticket [158] Fix requirements to load correct version of merb (Paul Barry)
  • Ticket [124] Proxy doesn’t forward GET params with merb 0.9.4 (Lawrence Pit)

Framework

  • require() fixes Fix require()’s for server/rest_server.js and server/rails_server.js (Lawrence Pit)

Keeping Control

A lot of folks ask questions about how to use controller’s in SproutCore.  Well, now you have some answers.  Thanks to rollerdexter who wrote up the majority of this article.

If I am unavailable…

On August 31 I am getting married to my college sweetheart and taking a month-long honeymoon that will last until early October.  Because of this we’ll be running “reduced service” in the SproutCore project in a few ways:

  1. No Bay Area SproutCore meetup is planned for August or September.  We will resume in October, unless someone else wants to pick up the effort to arrange a meetup during this time.  Feel free to email us at contact@sproutit.com if you are interested.
  2. No new releases of the SproutCore gem are planned until October. If an emergency release is required,  Erich Ocean will be able to do so.  In the mean time, you can still contribute patches and send me pull requests.  I will integrate them when I return in October. 

Thankfully, SproutCore is driven by a rapidly growing community of developers that extend well beyond myself so you can still find help for all of your SproutCore questions both on our mailing list and in our IRC channel #sproutcore (on freenode.net). If you have questions, please go ask!

This is a big moment for me and I appreciate your patience.  Normal service will resume in October.  I will do my best to answer all of my pending email at that time.  SproutCore’s future is very bright and I’m really looking forward to the cool things we are going to do in the fall.  Thanks everyone for your involvement!

Cheers,

-Charles

 

SproutCore 0.9.15 - “Out with the outlets” Release

A new SproutCore gem is rolling your way this morning and this one has some big milestones in it.  There are some big changes both on the build-tools side and in the framework itself, so I will address both separately.  Before I get to that though, a big “Thank You” to everyone who has contributed to this release.  SproutCore has now taken commits from over 2-dozen people, which is pretty astounding given how new it is.  Something this big is always a huge team effort and your work is greatly appreciated.  

Build Tools

  • No more :outlet.  When using the view helpers in your RHTML, you have in the past needed to add the :outlet => true option to any non-top level helper.  This has caused endless confusion for new developers and was always a tad pointless since computers are good at automatic things like that.  Starting with 0.9.15 you no longer need to add :outlet => true to your view helpers.  SproutCore will figure out whether your views should be outlets or not.  And there was much rejoicing.
  • Experimental HAML support.  HAML is an interesting new templating language that seeks to make it easier to create HTML in less code.  If you hate mixing HTML and the view helpers in your code, HAML might be a good option for you instead.  Trek, who initiated this feature change, wrote a great blog post explaining HAML and how to use it in SproutCore.
  • Debug Directory Support.  If you ever need to add some debug code to your app, you now have a place to put it.  Create a debug directory in your client or framework and place your JS files in there.  They will be included in development mode but excluded when you do a production build.  The SproutCore framework now bundles the unittest.js code this way so you don’t have to load that code in production.

Framework

  • Introducing SC.Enumerable.  Working with collections is always a big challenge in any framework.  SproutCore in particular devotes a large part of its codebase to helping you efficiently download and display large collections of data.  In the future, a lot of these features will depend on being able to treat objects other than simple arrays as collections, so we’re working on adding the API to support this.  SC.Enumerable is one of the first steps in this direction.  A blog post delving into this further will be forthcoming.
  • Reduced Properties.  Along those lines, the framework now includes support for some special new properties that return summary information about a collection of data.  For example, calling [1,2,3].get(’@max’) will return the maximum number in the array.  Best of all, these properties are bindable so you can use them to display automatically update summary info in your UI.
  • New SC.RailsServer & SC.RestServer.  The server classes are getting some love by Lawrence Pit who has given us both a RestServer and a RailsServer.  If you are building with a REST or Rails backend, these can save you some coding time.  See the online docs for more info.

And Much Much More

As usual, there are a ton of extra little fixes and updates included thanks to contributions from you!  Here is the full list of changes:

 

Build Tools

 

  • Fixed bug that would sometimes convert “faked” HTTP methods sent for Rails apps into real HTTP methods, breaking Rails. (Ticket #115) [Lawrence Pit]
  • Experimental support for rendering templates using HAML (Ticket #114) [Trek, Lawrence Pit]
  • During sc-build, by default the build tools will now calculate a digest key to append to the end of URLs instead of simply using a timestamp.  This will ensure that the URLs generated are properly cacheable even when building on different machines. [CAJ]
  • Regex for replacing occurrences of static_url() are no longer greedy. (Closes #87) [nciagra]
  • Added support for the autobuild config option.  If specified, then the named bundle will be skipped when you run sc-build by itself.  It will still be built if you name the bundle explictly (i.e. sc-build mybundle) or if you pass the -r option and the bundle is required by another bundle that is also being built.  
  • Along those lines, the default config was also changes so that the doc tool and the test runner will no longer autobuild.
  • Added support for the build_languages config option.  If specified, then simply runnig sc-build will automatically build all of the languages named here, even if there are no specific locatizations for said language in your project.
  • Added support for the debug directory.  Any JS files in the debug directory will now be loaded in development mode but excluded from production builds. You can use this to include added instrumentation and benchmarks for use in dev mode.
  • Following with the debug enhancement, the SproutCore JavaScript now includes the unittest.js in its own debug directory so that this library will no longer be included in production builds.
  • Bundles are now reloaded on each request to the development server.  This both allows the server to recover from exceptions when building a file and eliminates a memory leak that caused an eventual slow-down.
  • Eliminated need for :outlet option.  And there was much rejoicing.

 

JavaScript

 

  • Added titleize() helper for Strings.  Also imported various other helpers from Prototype.
  • Ajax requests sent by SproutCore’s SC.Server object will now add a custom header “SproutCore-Version: 1.0″ to every request.  You can use this to detect requests coming from SproutCore on the server side. Fixes #85 [trek]
  • SC.Record does a better job of matching null values.  Fixed #96 [Fredrik  Blomqvist]
  • SC.Server now handles created records with no attributes yet.  Fixed #98 [CAJ]
  • Added support for reduced properties.  These properties begin with “@” and will automatically calculate some kind of summary information about the receiving array.  They are also bindable so you can bind to myArray.@average and it will update whenever the average changes. [CAJ]
  • Cleaned up SC.Array support to incorporate new SC.Enumerable functions.  The Enumerable methods from Prototype are no longer supported. [CAJ]
  • Removed Array.asArray().  This helper has been deprecated for 6mo now.  Use SC.$A() or Array.from() instead.  [CAJ]
  • Added SC.$A() helper.  This works like Prototype’s SC.$A() except that it  will work with any enumerable.  It is also namespaced properly. [CAJ]
  • Added “application/json” to the default Accept header for all servers. Required for proper support of json format. [Lawrence Pit]
  • Added experimental support for SC.RailsServer which works with resource oriented Rails applications.  [Lawrence Pit, Simon Harris]
  • [FIX] SplitView now resizes in both directions properly.  Closes #110 [Christoph Angerer]
  • Added support for the SC.Enumerable mixin and SC.Enumerators.  These items provide the basis for our standard enumeration API.  This will replace relying on iterators provided by Prototype eventually.  See docs on those classes for full information. [CAJ]
  • SC.guidFor() now works consistantly with strings, numbers and other primitive objects.  Before it would differentiate between different instances of these objects.  Now it treats them the same if they are the same value. [CAJ]
  • Added SC.hashFor() method which can be used to determine if two objects are equal.  Normally this returns the same value as guidFor() but if you implement the hash() method on your object, it will return that value instead.  This gives you an easy way to indicate that two objects are equal even if they are different instances. [CAJ]
  • Updated SC.isEqual() to respect SC.hashFor().
  • Added support for hasSelection, hasContent, and other useful properties on controllers for activating UI.
  • Added newObject() and insertNewObjectAt() methods to ArrayController.  These methods will create and register new records automatically.
  • SC.Record’s changeCount now increments whenever a member array’s attributes change.
  • Optimized SC.Object.objectForPropertyPath() to use less memory.
  • You can now pass a string path as a :target and it will be converted to an object. (thanks Peter Blazejewicz!)
  • SC.CollectionView will now call destroyObject on the content array instead of removeObject if that method is defined.  This allows you to implement arrays with a more specific handling of the destroyObject method.
  • Added support for checkbox views in ListItemViews.  Since this is a fairly common requirement, checkbox views are now built in.

 

 

A Page a Day…

Erich pointed out today that in the last 62 days the community has added 62 pages to the wiki covering all sorts of topics including:

Thanks to everyone who has helped out with this resource.  It has become an invaluable tool.  Now is a great time to check it out and contribute!

 

Kickoff SproutCore Meetup Tonight!

If you are in the SF Bay Area and haven’t yet heard about tonight’s kickoff meetup, then check it out at http://javascript.meetup.com/6/ and let us know if you are coming.

Here’s what will will be up to:
7:00 - Meet and greet, get name tags and drinks
7:15 - pizza, pizza, and pizza (feel free to get another drink, too)
7:30 - Welcome from Charles
7:35 - View DEMO apps built for SproutCore site and announce winner
7:50 - Building SproutCore apps for NOKIA phones
8:05 - Hooking up SproutCore apps to the servers
8:20 - Q&A, mix and mingle

*****During the mix and mingle section, if you have code that you have questions about, Charles will be standing by to help you work through it, so bring your code with you.******

SproutCore 0.9.14 - “Github is Fun” Edition

SproutCore 0.9.14 was just released today with lots of bugs fixes and minor feature enhancements contributed by you and one really big new feature from me.  

Introducing Easy Install Frameworks

The SproutCore build tools have always had support for frameworks - basically libraries of JavaScript code that you can install and share between your applications.  In fact, both SproutCore and Prototype are included as frameworks.  When you do a build, you will see their output included with your own project.  

Installing and sharing frameworks has never been easy, however, until now.  0.9.14 includes three new utilities: sc-install, sc-update, and sc-remove.  These utilities will download and install, update or remove SproutCore frameworks from your project using Github.  It’s really easy.  For example, let’s say you wanted to get the latest bleeding-edge version of SproutCore installed in your project.  Just do the following:

cd MY_PROJECT_NAME
sc-install sproutcore

That’s it.  You should now find the latest version of SproutCore installed in a new frameworks directory.  If you want to later update it, just do:
sc-update sproutcore
Getting the latest SproutCore is one thing, but what about sharing frameworks of your own?  Well, this is easy to thanks to the power of Github.  Just open a github account and upload your framework (the contents of the folder you would put into the frameworks directory) as a new project.  The project name should begin with “sproutcore-YOUR_FRAMEWORK_NAME”.  For example, if you had created a sproutcore-enabled plotkit, you might name it sproutcore-plotkit.

Once you have this project available via git, you are all done!  Just tell anyone to go to their project and do:

sc-install YOUR_GITHUB_USERNAME-YOUR_FRAMEWORK_NAME

For example, if your Github username were “johndoe” and your project was called sproutcore-plotkit, then someone might install:

sc-install johndoe-plotkit

This will install the framework in their directory and they can get right to work using it.  sc-update will also work to let everyone receive your updates.

To use these tools, you will need to have Git installed.  There are installers available for every platform.  Easy install frameworks are just one new feature we have planned to deliver with our friends at Github, so getting this tool on your computer is a good idea for the future as well.

Updated Documentation

Also notable for this release, Onitunes has done some great work updating our JSDoc utility to run the latest version (version 2.0), which also improves the docs quite a bit.  Check out the docs on your machine or head on over to the hosted version to check them out.

Thanks

Finally, a special thank you to everyone who has contributed to this release.  This version has fixes and small feature enhancements submitted by more people than ever before.  Special congratulations to mguymon, YoNoSoyTu, Maurits Lamers, Gareth, Juan, and gskluzacek who had their first fixes applied.  Also a thank you to pbergtr, jdickens, chuck, Erich, and Andy who also have more features and fixes.

Full details of this release are below.

Release Details

 

Build Tools

 

  • The long form of sc-build -e is not –environment. It was misspelled.  (Thanks zoowar)
  • Fixed README for new apps to use the correct sc-build command.  (Thanks Spencer Ho!) 
  • Added sc-install, sc-update, and sc-remove.  These utilities work with github to automatically install and update plugin JavaScript libraries.
  • [FIX] Removed warning about NO_BODY_METHOD
  • Upgraded to a newer version of JSDoc that can provide a much more accurate description of the inline documentation for SproutCore.
  • sc_super() now works automatically and does not require you to pass this.
  • sc-server now autodetects Merb.root.  This means that you can start sc-server from any directory inside of your project and it will do the right thing.

 

Framework

 

  • Fixed bug in SC.SourceListView that could incorrectly hide groups. Closes #57. (Thanks mguymon)
  • Fixed bug in SC.ObjectController that would sometimes not commit all pending changes because the model object would clear the changes hash.  Also a test for this was added.  Closes #66.  (Thanks YoNoSoyTu!)
  • default index.html now has text/javascript added to script tags. Closes #71
  • server.js now handles namespaced prefixes. Closes #74
  • label_view now defaults to the span tag.  Closes #75.  (Thanks Erich!)
  • Added support for posting data in both URL-encoded and JSON formats via SC.server.  This makes for a much cleaner round-trip.  To use this, set the postFormat: property to SC.JSON_FORMAT in SC.server.  Closes #49. (Thanks Mauris Lamers!)
  • The newRecord property is now set to false once a record has been successfully sent back to the server.  A new internal property tracks when you are waiting on a record to be created on the server and refuses to submit it a second time. Closes #81 (Thanks Gareth!)
  • All internal calls for arguments.callee.base.apply() have now been switched to sc_super().  This means you MUST use version 0.9.13 or later of the build tools to work with the javascript.
  • Fixed a memory leak in IE that was caused by a self-reference to document. (Thanks Juan)
  • Improved documentation for a variety of classes. (Thanks gskluzacek)
  • SC.Server can now handled nested Server prefixes in case you have multi-level namespaces.

 

 

 

 

 

Writing SproutCore Apps with a Rails Backend

Lawrence Pit has written a great tutorial on building a SproutCore application and hooking it to a Rails backend.  This is by far one of the most common requests for new SproutCore developers and I’m really glad Lawrence has taken the time to share his knowledge.  Thanks Lawrence!

Read Sproutcore + Rails

PS.  Lawrence mentions that SproutCore’s built-in REST API is not well developed and he is generally right.  The current Server class in SproutCore was written before ActiveResource, GData or many other solid REST implementations were around.  It will be updated before SproutCore 1.0 but the current version will work just great as long as you adopt the semi-REST SproutCore model as Lawrence describes.  

 

A Day at the Forum

Danny Brewer created a SproutCore forum today. You can check it out at:

http://sproutcoredev.com/

I don’t know if anyone of us will be hanging out there but the more conversation the better!

Thanks Danny

SproutCore 0.9.13 - “Baker’s Dozen” Release (was SproutCore 0.9.12)

UPDATE: A late breaking bug in 0.9.12 was discovered this morning that prevented sc-build from functioning properly. It was fixed in a new release, 0.9.13.  Everything below is the same for 0.9.13, just with an extra bug fix.

SproutCore 0.9.12 release just rolled with some fabulous bug fixes and new features.  Here are the highlights:

 

  • Finally, Windows Goes Final.  The last two SproutCore gems have included experimental support for using the build tools on Windows.  Experimental as in, did not work.  In 0.9.12 the build tools are officially supported, as in, they finally work.  At least on my Windows machine.
  • Better Proxy Support.  0.9.11 included the debut of a new built-in proxy support which makes it uber-easy to test SproutCore with your favorite backend service.  There were a few bugs however, with both posts and query parameters.  These have both been fixed now.  The proxy also handles both cookies and redirects better.
  • sc_super().  SproutCore has always had built-in support for “calling super” in  your JavaScript.  The only problem was that to call your super’s method, you had  to use an elaborate string “arguments.callee.base.apply…”.  Now thanks to the build tools, you can call super with a nice shorthand:  sc_super().  This is replaced at build time on the server so if you are debugging, you will still see the old-style call in your code.
  • Combining Stylesheets & JavaScript in Dev Mode.  In development mode, the build tools normally server your CSS and JavaScript as individual files.  This makes it easier to debug and its faster for the page to reload.  In some browsers, however, (notably IE), having more than 31 CSS files can break it.  To solve this, you can use some new config options to have the build tools combine either your Stylesheets or JavaScript in development mode.  You can also use this new option to turn minification on or off in production or dev modes. See the release notes below for more info.  
  • OpenSocial.  Some folks are building SproutCore applications that work with OpenSocial, which is a really cool idea.  This release adds a useful feature allowing you to @import stylesheets instead of using link tags if needed.  If you are building an OpenSocial app or need this feature for some other reason, ask on the mailing list and someone it will be happy to help you out.
  • Bug Fixes!  A variety of bug fixes contributed by lots of different people.  Full details are below.

Special thanks and congratulations to august, onitunes, maloninc, schwa32, juan, and Johannes Fahrenkrug who all had patches included in this release.

To get the update, just do:

sudo gem update sproutcore

SproutCore Build Tools 0.9.12 Release Notes

 

Build Tools

 

  • Added :include_method = :link|:import option to the stylesheets_for_client helper.  This allows you to select between inclusion using link tags vs @import (which is required for OpenSocial apps) - Thanks Johannes Fahrenkrug!
  • Proxy now handles posts and rewrites Location headers so they stay in the same domain.  Should make this feature far more robust.
  • Proxy now handles query parameters. 
  • Build tools now replace all occurrences of “sc_super()” with a call to arguments.callee.base.apply().  This way you don’t have to remember the crazy-ass string to call super. (Thanks onitunes)
  • You can now start sc-server down inside of a project and it will find the proper level to work at.
  • Finally fixed all remaining known issues with using tools in Windows.  Works for me in my install.
  • sc-config.rb is now named sc-config.  The old name will still work.
  • sc-config now supports three extra options in the all config:
    • :minify_javascript :: name one or more modes that you want the JavaScript to be minified in.  Normally JS is minified in production mode, but you can use this to turn that behavior off if necessary for debugging.
    • :combine_javascript :: name one or more modes that you want JavaScripts to be combined in.  Normally JS is combined in production mode, but you can turn this on or off for mode as needed for debugging.
    • :combine_stylesheets :: name one or more modes that you want stylesheets to be combined in.  Normally CSS is combined in both production and development modes, but you can turn this on or off as needed.
  • [FIX] Build tools were not appending a timestamp to resource URLs like they should in order to gaurantee clean caching. 

 

 

Framework

 

  • SC.ButtonView & SC.MenuItemView now removes and adds the ‘active’ class name on mouseExited and mouseEntered when the mouse is pressed to provide better indication of whether an action will occur on mouse up. (Thanks schwa23)
  • SC.Record#toString now shows record type in description.
  • [FIX] SC.Timer now computes the next fire time before it executes your callback action.  This should avoid the situation where a timer would call your action, which would then take it past the last time it should fire and hence the last fire would never happen. (Thanks August)
  • [FIX] SC.Record#matchCondition() did not behave correctly when comparing record instances.  Fix by onitunes includes both a faster comparison method along with correct behavior + kickin’ unit tests
  • [FIX] some settings on the inline editor for multi-line edits were wrong.  Now fixed thanks to maloninc (#38)