This is all licensed under MIT except for
which are Apache 2.0.
Verve combines the use of the following open source projects:
- CoffeeScript Scripting
- Stylus CSS
- Nib Stylus Library
- Hogan HTML Templates
- Mocha Test engine
- Should BDD style assertions
- Casper.js Functional testing
- L Localization
- Zepto DOM, AJAX
- spin.js No image, no CSS spinner
- docco Docs
- Coffeelint Lint code
How it works
The core of the Verve engine is the
Cakefile which watches all CoffeeScript, Stylus and Hogan files. Whenever a file changes it automatically gets compiled into the output directory. You can invoke the Cakefile directly:
$ cake --config ios.json dev
or invoke it with the short handle through the Makefile:
$ make ios
make is not found you need to install the Command Line Tools: XCode->Settings->Downloads
For Growl notifications support install growlnotify. On OS X 10.8, Notification Center is supported using terminal-notifier. To install:
$ sudo gem install terminal-notifier
In order to use Verve you need to install node.js and Coffeescript:
$ sudo npm install -g coffee-script
Clone PhoneGap and Verve:
$ git clone email@example.com:phonegap/phonegap.git $ git clone firstname.lastname@example.org:srohde/Verve.git
Create a new project, install dependencies and compile resources:
$ phonegap/lib/ios/bin/create <project_dir> <package_name> <project_name> $ ditto Verve <project_dir> $ cd <project_dir> $ rm -rf .git $ npm install . $ make ios
Open the project with XCode and run it in the simulator. You should see "Hello Verve."
When you try to preview
www/index.html in your browser you'll get this error: Origin null is not allowed by Access-Control-Allow-Origin.
To preview in your browser instead of the iOS simulator the usage of Chrome Canary is recommended. Open Canary with the necessary flags:
$ make canary
NOTE: Don't use this browser instance for anything but development since it has disabled web security.
Open your favorite editor and start hacking on:
The project configuration is defined in
You can change the source and destination directories for
CoffeeScript, Stylus, Hogan.js and HTML page. For now you will need one configuration for each platform (iOS, Android, ...) since the cordova.js is platform specific. This will change in a future release of Verve to avoid duplication.
Stylus for CSS
Stylus is a great minimalistic CSS language with lots of great features to take the pain out of writing plain CSS.
Verve comes with some default styles and mixins:
Localization is done using L. Declare your locales in
L.initFile "locales.json", => console.log L.get("greeting", "Verve")
Zepto.js is included from
template = new Hogan.Template T.main $someDiv.append template.render(partial)
Spin.js is included to have an awesome "no image, no CSS" spinner:
$('body').spin "large", "white"
Unit Tests with Mocha and Should
expressive, readable, test framework agnostic, assertion library.
Both combined together offer a very minimalistic but powerful way to unit test your code. See
test/client/LTest.coffee for an example test.
$ make tddClient
All tests get executed whenever a file changes. TDD FTW.
Note: To test your client side CoffeeScript classes your exports at the bottom of the class file look like this:
window?.<class_name> = <class_name> module?.exports = <class_name>
Functional Tests with CasperJS
$ brew install casperjs
Run it with:
$ make casper
Check out the screenshot in the temp directory.
build.properties and add the name of your XCode project and scheme name.
Create the IPA file using:
You can use the IPA file to distribute your app to test users using Testflight.
$ sudo easy_install Pygments $ make docs
CoffeeLint is used to lint the code.
Run it with:
$ make lint
You'll see a couple of errors about trailing whitespaces which is because of this open issue.
(The MIT License)
Copyright (c) 2012 Sönke Rohde http://soenkerohde.com
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.