M Init - mway-io/Espresso GitHub Wiki
M-Init
Introduction
Status: 16.01.2012 - work in progress
The init
tool is to generate a new and empty project or a hello world application, as a demo case. This tool is called from inside the Espresso folder by typing: path/to//Espresso/bin/espresso.js --project myApp
on the command line. This will generate a new empty project called: 'myApp'.
Parameters
a new empty project, with the given name
- **-p, --project [project name] **
a new HelloWorld application, with the given name
- **-w, --projectHelloWorld [project name] **
print the help
- **-h, --help **
Usage
To use espresso init, check out the Espresso project here from git. Browse into the Espresso root folder and
run: path/to//Espresso/bin/espresso.js --project myFirstApp
type: cd ..
A new folder called: Apps
was generated during the espresso init run. All projects, generated with espresso init
are stored as a subfolder in the Apps
directory -> Apps/myFirstApp
. This folder will gather all of the projects.
Go into your project folder, the folder has the same name as specified in the m-init parameter. Build the application by running: path/to//Espresso/bin/espresso.js build.js
from the projects folder. Your builded application will appear in the special build folder example:.
Apps/myFirstApp/build/1291019025993/
To run the application open the index.html in your web browser.
If you had run: init --example --project myFirstApp
you´ll see the "Hello World" application, shown in the image at the bottom of this page.
The Workflow (how espresso works behind the scene)
This diagram shows the workflow that is been triggered when running: node m-init.js -project:myApp
.
The first action is to generate the folder structure for the project, which is located inside the 'Apps' folder, which sits next to Espresso. Folder that are generated are for: the app, and the framework.
After making the folder structure the relevant tools: build
and server
are generated, marked with the name of the application (here myApp) and saved in the root directory of the new application.
The next step is to copy the framework date, resources and files.
The init
tool will have a special option to generate a "Hello World" application. This application will differ from a empty project in that way, that the generated main.js files
contains extra code, to print out "Welcome to The-M-Project" with a head and a footer. The propose of the "Hello World" application is to provide a simple application for demo case and to begin work with.
And the init is done!
Here is a screenshot of the "Hello World" application, how it will look like in the Safari desktop browser: