Installing JavaScriptMVC is as easy as making tea, but faster.
There are three methods.
Download the complete package from the official website (http://javascriptmvc.com) or build a custom package including the components we want to use (http://javascriptmvc.com/builder.html)
Pull code from the Git repositories hosted on GitHub.
Use Vagrant
The last two methods are the preferred way, for the following reasons:
Easy update to the latest version
Easy switch to another version by the
checkout
tagContribution to the project; how awesome is that? For more information about contributing, visit http://javascriptmvc.com/docs.html#!developwithgit
The third method seems to be the best one, because it contains all the advantages from the second one, plus it creates an encapsulated environment, which we can easily and quickly create or delete without affecting our current development environment setup.
For a fast tryout library, choose the first method. For the actual development, definitely choose the second one.
In this method, we will use a web interface on the JavaScriptMVC web page to configure and download the package:
Download the complete package from http://javascriptmvc.com and unpack its content.
Create a folder named
Todo
under the local web server working directory.Copy all files from
javascriptmvc-3.2.2
to theTodo
folder and start the web server.$ mkdir Todo && cp -r javascriptmvc-3.2.2/* Todo && cd Todo
That is it; we are all set and ready to go.
We assume that the reader knows and has installed Git.
If not, the following resources might be helpful:
Installing Git: http://git-scm.com/book/en/Getting-Started-Installing-Git
Free book Pro Git: http://git-scm.com/book
Git reference: http://gitref.org
In the following steps, we are going to install JavaScriptMVC for our Todo
example project:
Under local web server directory, create new folder named
Todo
:$ mkdir Todo && cd Todo
Inside the
Todo
folder, create a new Git repository:$ git init
Add JavaScriptMVC components as submodules to the project:
$ git submodule add git://github.com/bitovi/steal.git $ git submodule add git://github.com/bitovi/documentjs.git $ git submodule add git://github.com/bitovi/funcunit.git $ git submodule add git://github.com/jupiterjs/jquerymx jquery
Install and update the submodules:
$ git submodule init $ git submodule update
The last module we need to install is
Syn
. Since it is already a submodule to theFuncUnit
project, all we need to do is initialize and update it:$ cd funcunit $ git submodule init $ git submodule update
Switch
Syn
to themaster
branch:$ cd syn/ $ git checkout master
Go back to the root directory of the project:
$ cd ../..
Move the
js
command to the root directory of the project:$ ./steal/js steal/make.js
The project directory should have following folder structure:
.git .gitmodules documentjs funcunit jquery js js.bat steal
That is it; we are all set and ready to go.
Note
More about submodules in Git: http://git-scm.com/book/en/Git-Tools-Submodules
To install JavaScriptMVC using this method, we need to install Vagrant, which is a virtualized development tool wrapper around Oracle VM VirtualBox, an x86 and AMD64/Intel64 virtualization software package.
Download and install Oracle VM VirtualBox (https://www.virtualbox.org).
Download and install Vagrant (http://downloads.vagrantup.com).
Download an unpack the JavaScriptMVC kick-starter (https://github.com/wbednarski/JavaScriptMVC_kick-starter/archive/master.zip).
Inside JavaScriptMVC kick-starter folder type
vagrant up
.This command creates a virtual environment and a projects directory. It also installs the web server. JavaScriptMVC framework will be placed in the
Todo
directory.
Any changes we make inside the projects directory are immediately visible in web browser at http://192.168.111.111/
.