scaffoldroid
============

A simple Content Provider scaffolding tool for Android

Installation
------------

  1. Download and install [node.js](http://nodejs.org/) and [npm](http://npmjs.org/)

  2. Install scaffoldroid via npm:

		$ npm install -g scaffoldroid

Usage
-----

  1. In a directory of your choice, create a file called 'scaffoldroid.json' which describes your database structure (see the section below for detailed information and some examples)

  2. To generate your code, cd to this directory and just execute

		$ scaffoldroid

  3. You're done! :>

scaffoldroid.json
-----------------

This file describes your database structure in a very simple way.
Here's a minimal example:

	{
		"contentprovider": "0.0.4",
		"app": "Example",
		"database": "example.db",
		"package": "com.scaffoldroid.example",
		"tables": [
			
			{
				"name": "users",
				"columns": [
					{ "name": "first_name", "type": "text" },
					{ "name": "last_name", "type": "text" },
					{ "name": "zip_code", "type": "integer" }
				]
			}

		]
	}

This will create one table called 'users' in the example.db database with three columns:

	_id             [integer primary key autoincrement] - generated automatically
	user_first_name [text]
	user_last_name  [text]
	user_zip_code   [integer]

You can also add some more properties for each column:

	"primary_key": true      if this column is a primary key (default false)
	"autoincrement": true    if you wanna provide autoincrement functionality for this column (default false)
	"default": 0             if you wanna provide a default value for this column (default: no default value)
	"not_null": true         if you wanna provide not null functionality for this column (default: false)

Example 1: Todo-Database
------------------------

	{
		"contentprovider": "0.0.4",
		"app": "Todo",
		"database": "todo.db",
		"package": "com.scaffoldroid.todo",
		"tables": [

			{
				"name": "groups",
				"columns": [
					{ "name": "title", "type": "text", "not_null": true }
				]
			},
			
			{
				"name": "tasks",
				"columns": [
					{ "name": "title", "type": "text", "not_null": true },
					{ "name": "description", "type": "text", "not_null": true },
					{ "name": "done", "type": "integer", "default": 0, "not_null": true },
					{ "name": "group_id", "type": "integer", "not_null": true }
				]
			}

		]
	}

Developed by
------------

 * Andreas St&uuml;tz - <andreas.stuetz@gmail.com>

License
-------

    Copyright 2012 Andreas Stuetz

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.