iskugor / tern-titanium

Appcelerator Titanium API definition file generator for TernJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tern-titanium

This small script generates Tern definition files from Appcelerator Titanium API documentation YAML files. Tern is code-analysis engine for JavaScript which adds intellisense capabilities to text editors, it uses definition files to autocomplete object model member names and infer their types.

How to use

Prerequisites

You should have tern already installed and text editor configured. Refer to tern docs.

Generating definition file

Clone tern-titanium repository:

$ git clone git@github.com:x-cray/tern-titanium.git

Then you'll need Titanium Mobile source code which can be obtained from titanium_mobile repository:

$ git clone git@github.com:appcelerator/titanium_mobile.git

Optionally, you may want to checkout specific titanium_mobile release:

$ cd titanium_mobile
$ git checkout 3_1_2_GA
$ cd ..

Run generate.py supplying path to source API documentation and output file:

$ tern-titanium/generate.py titanium_mobile/apidoc titanium.json

Copy generated titanium.json file to your project directory. Then create .tern-project file in project directory (refer to tern documentation) with the following contents:

{
	"libs": [
		"titanium",
		"ecma5"
	],
	"plugins": {
		"requirejs": {
			"baseURL": "./app",
			"paths": {}
		}
	}
}

Libs entry titanium tells tern to look for titanium.json in project directory first and then in tern distribution defs/ directory.

That's it. Now Titanium Mobile API autocomplete should work in your text editor.

Contribution

Pull requests and ideas are welcome.

About

Appcelerator Titanium API definition file generator for TernJS

License:MIT License


Languages

Language:Python 100.0%