Installing JavaScriptMVC

Installing JavaScriptMVC is as easy as making tea, but faster.

Choosing your method

There are three methods.

The last two methods are the preferred way, for the following reasons:

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.

Which method is right for me?

For a fast tryout library, choose the first method. For the actual development, definitely choose the second one.

The first method – download the package

In this method, we will use a web interface on the JavaScriptMVC web page to configure and download the package:

  1. Download the complete package from http://javascriptmvc.com and unpack its content.
  2. Create a folder named Todo under the local web server working directory.
  3. Copy all files from javascriptmvc-3.2.2 to the Todo 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.

The second method – pull the code from Git repositories

We assume that the reader knows and has installed Git.

If not, the following resources might be helpful:

In the following steps, we are going to install JavaScriptMVC for our Todo example project:

  1. Under local web server directory, create new folder named Todo:
    $ mkdir Todo && cd Todo
  2. Inside the Todo folder, create a new Git repository:
    $ git init
  3. 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
  4. Install and update the submodules:
    $ git submodule init
    $ git submodule update
  5. The last module we need to install is Syn. Since it is already a submodule to the FuncUnit project, all we need to do is initialize and update it:
    $ cd funcunit
    $ git submodule init
    $ git submodule update
  6. Switch Syn to the master branch:
    $ cd syn/
    $ git checkout master
  7. Go back to the root directory of the project:
    $ cd ../..
  8. Move the js command to the root directory of the project:
    $ ./steal/js steal/make.js

Verifying Installation

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

The third method – Vagrant

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.

  1. Download and install Oracle VM VirtualBox (https://www.virtualbox.org).
  2. Download and install Vagrant (http://downloads.vagrantup.com).
  3. Download an unpack the JavaScriptMVC kick-starter (https://github.com/wbednarski/JavaScriptMVC_kick-starter/archive/master.zip).
  4. 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/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.79.147