Every repository with this icon (
Every repository with this icon (
Newbie FAQ
NOTE: This is a work in progress and is meant to be a guide for Newbies by Newbies… Please post any questions that you’d like to see answered here in the Sproutcore Google Groups with the 1st line of the body set to ‘## newbie_faq_question ##’. I will search on that term and update this FAQ based on the replies. Or if there is already a good Newbie question that been answered either in the Google Group or elsewhere, send me the link to it. — gskluzacek (Greg)
NOTE: I’m thinking of redoing the format where each question would be a separate section as the current format is getting a little cluttered. I’m also thinking about changing this to a FAQ / How To
Questions
Below are questions that I have and think it would be helpful to have answered and found an answer or are still unanswered, or questions that I think might help others starting off in SproutCore.
- What are the required components to develop in SproutCore — on Mac OS X, Windows and Debian, and how do I get and install each?
- I’m behind a firewall and get an error when trying to install the SproutCore gem.
- How do you start and stop the sc-server?
- How do I tell what version of SproutCore I have installed?
- What’s the best way to update SproutCore to the latest version?
- What’s the easiest way to get the sample and or demo code?
- How do I build and deploy my SproutCore application?
- Can I use PHP (or insert other programing language) to dynamical create my SproutCore pages?
- How would one post in JSON with SproutCore?
- What should be included in source control and in what structure?
Answers
NOTE: For commands entered in the Terminal (Mac OS X) or at the Command Line (Windows), I will only enter the command as need by Mac OS X as will save me some typing. Some of the commands will start with ‘sudo’. This is only required for Mac OS X [ sudo isn’t required for all Mac OS commands when using gem/sproutcore is it? Which ones is it needed for? ] and is not needed to run the command to run it on Windows.
- What are the required components to develop in SproutCore — on Mac OS X, Windows and Debian, and how do I get and install each?
Components: Ruby, the SproutCore Framework and Git if you want to contribute to the SproutCore project.- Mac OS X:
- If you are running Mac OS 10.5.x Ruby is already installed, but if you haven’t done so yet, you will need to install the developer tools [ should I include instructions on how to do that? If they are developing, they should know how to do that, right? ].
- Earlier version of Mac OS may or may not have Ruby installed or may have issues installing gems [ some one else will have to write this up as all my Macs have Leopard installed on them. Or I will have to install 10.4.x on a separate drive and try it. How many versions of the Mac OS should we go back? I have all of them including the Beta still ]
- As an administrator, open up the terminal (located in the Utilities directory in side the Applications directory) and enter ‘sudo gem install sproutcore’ Enter your password if requested.
- After the installation is finished you can tackle the hello world tutorial
- Next I would take a look the sample SproutCode. Please see the related Question within this FAQ
- Visit the SproutCore Reference and review the classes and methods there.
- Lastly if you’re interested in developing for the SproutCore framework you will need to install git and make sure to visit the Hacking SproutCode pages here and here .
- To install git for Mac OS X, 1st get the binary distribution and install it. After you’ve installed git you need to either need to execute ‘source .bash_profile’ in an existing terminal window or open up a new terminal window so that terminal can find git.
- Next you will need to set up git and retrieve the source code. From the terminal enter ‘git config —global user.email [ your-email-address@example.com ]’ then enter ‘git clone git://github.com/sproutit/sproutcore-samples.git’ to retrieve the source code files. A directory containing the source code will be created in the directory where you entered the git clone command from.
- Windows – coming soon …
- Debian
- Set debian repo to testing and install following packages: ruby rubygems ruby1.8-dev build-essential and git-core
back
- Set debian repo to testing and install following packages: ruby rubygems ruby1.8-dev build-essential and git-core
- Mac OS X:
- To install a gem from behind a firewall you must use the the proxy option and pass the URL to your proxy server. It should look something like this ‘gem install sproutcore -p http://wwwgate.example.com:8080’ Things to note: you need to include the http:// and the port number. [ need to see if ruby/gem can handle proxy servers that require authentication, last time I checked I didn’t see this support yet ]
back - To start the sc-server change directory to the your SproutCore Project directory. This will be the directory that contains the client directory. Next enter ‘sc-server’. To exit the sc-server, type control-c. If you are on Windows type Y to terminate the batch job.
back - You can type ‘sproutcore -v’ at the command line or alternatively ‘gem list sproutcore’
back - From the command line type ‘sudo gem update’ which will update all installed gems [ need to check if update automatically resolves any needed dependencies ], this will result in multiple versions of the updated gems. To remove older versions execute ‘gem cleanup’. For both of the above commands, you can also list the specific gems you want to update e.g. ‘gem update sproutcore’ and ‘gem cleanup sproutcore’
back - If you don’t have git installed, the easiest way to get the sample code is to go to the SproutCore Sample Repository and click the download button towards the top the web page. On Windows, be careful with how you uncompress the archive. You should probably use WinRar as WinZip does not seam correctly expand all of the directories and files in the archive. You will probably want to rename and or move the main directory (also called the project directory) that the code was extracted into, as it will have a very long and cryptic name. Next go into the project directory and then into the frameworks directory. In the frameworks directory there should be a sproutcore and a prototype directory, delete these. Go back up to the project directory and from the command line enter ‘sc-server’ You should now be able to go to http://localhost:4020/contacts in your web browser to see the contacts sample application. See the README file in the project directory for a list of the other sample applications.
back - To build your SproutCore application, in the terminal, go to the SproutCore application’s project directory and execute ‘sc-build’ and wait while the program assembles your application files. When the build finishes, your assembled application will be located in the static directory of the tmp/build directory of your SproutCore application project directory. To deploy your application copy the static directory and place it within you web server’s web root. For example, application was named sample and your domain was www.example.com then if you place the static directory directly in the web root, the URL to your application would be http://www.example.com/static/sample . If you wanted the url to http://www.example.com instead, you could create a symbolic link to static/sample/index.html i.e., while in your web root execute ‘ln -s static/sample/index.html index.html’. If you multiple pages in the client directory, for example: sample_search and sample_details and wanted the URLs to be http://www.example.com/search and http://www.example.com/search then create the following two symbolic links: ‘ln -s static/sample_search search’ and ‘ln -s static/sample_details details’
back - Short answer: It’s possible, but not recommend. With the old way of doing things PHP does everything: generating both HTML and the dynamic content. Sproutcore is an AJAX web application framework which enables you to create web applications as you would create a regular desktop computer application. This means that the interfaces are mostly static, but with elements that are dynamic. With SproutCore the function PHP is to retrieve data from the database, sending it back to SproutCore as JSON encoded data and managing state.
<pre> var url = "http://127.0.0.1:8000"; var jsonBody = '{"request":"contacts"}'; new Ajax.Request( url, { method: 'post', contentType: 'application/json', postBody: jsonBody, onSuccess: function(response) { /* handle success */ }, onFailure: function() { /* handle failure */ } }); </pre>
back- Working on getting an recommended best practice for the layout of the source control structure and what files should be placed under source control. Refer to this post in the SproutCore Goog Groups SproutCore Version Control Setup
back
Related Links
- Browser and Flash Support – Official position on SproutCore’s support for web browsers and Flash.
Comments
OK, how do you disable or escape some of the Textile markup? Like if I just want to use two asterisks (like before and after a string) it instead makes my text bold and with only 1 asterisk — gskluzacek






