Skip to content

Commit

Permalink
Merge pull request #50 from appcelerator/timob-11869
Browse files Browse the repository at this point in the history
Lots of updates
  • Loading branch information
nebrius committed Aug 2, 2013
2 parents 58c6af7 + 79827ff commit f8617d9
Show file tree
Hide file tree
Showing 112 changed files with 7,813 additions and 1,864 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
._*
.DS_Store
node_modules
npm-debug*.log
lib-cov
coverage.html
en-us.js
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
node_modules
*.sublime-project
*.sublime-workspace
docs
tests
lib-cov
coverage.html
forge
forge-tools
en-us.js
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
0.1.31
0.2.0
-------------------
* Added try/catch around analytics processing with showErrors flag to display errors
* Added check to see if session file is writable when logging in or out of Appc network [TIMOB-13908]
* Improved AppcException to include a toString() function and improved dump() function
* Added isFileWritable() function to fs library
* Fixed bug with Android SDK add-ons with missing manifest.ini files to crash the CLI [TIMOB-13634]
* Added code coverage reporting
* Added unit tests for 30 libraries (currently 72% code coverage)
* Added JSDoc comments for nearly entire code base
* Complete rewrite of i18n-tool that analyzes Titanium CLI, node-appc, and Titanium SDK Node code and syncs i18n strings with webtranslateit.com
* Migrated old zip library from using built-in unzip, zip, and 7zip commands to use the adm-zip module
* Updated a number of APIs to have better dependency injection and less hard-coded parameters (needed for unit tests)
* Added HAXM environment detection
* Moved Java environment detection from Android detection library into standalone library and greatly improved Android SDK detection
* Better Titanium CLI plugin detection
* Removed deprecated astwalker library
* Added new subprocess library to make finding and calling subprocesses easier
* Removed deprecated hitch() util function
* Major cleanup to authentication library
* Added gateway interface detection to network library
* Updated nearly all dependencies on appc.fs.exists() to fs.existsSync()
* Added i18n support for entire files
* Added better plist parsing and serializing support
* Added new string utility functions wrap() and renderColumns()
* Internationalized strings in the time library
* Better/cleaner Titanium module and CLI plugin detection

0.1.30
-------------------
Expand Down
64 changes: 54 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,66 @@
## Overview

This is a common library used by Appcelerator Node.js-based software products such as the
This is a common library used by Appcelerator Node.js-based software products such as the
[Titanium CLI](http://github.com/appcelerator/titanium).

<a name="Installation"></a>
## Prerequisites

node-appc requires [Node.js 0.8.x](http://nodejs.org/dist/) or newer.

## Installation

[sudo] npm install node-appc -g

<a name="License"></a>
## License
### Running Unit Tests

To run the unit tests, simply run:

node forge test

### Running Code Coverage

To generate the code coverage, you first must install
[node-jscoverage](https://github.com/visionmedia/node-jscoverage). The easist
way to do this is run:

git clone git@github.com:visionmedia/node-jscoverage.git
cd node-jscoverage
./configure
make
sudo make install

This project is open source and provided under the Apache Public License (version 2). Please make sure you see the `LICENSE` file
included in this distribution for more details on the license. Also, please take notice of the privacy notice at the end of the file.
Then run:

### imgscalr
node forge test-cov

It will generate a file called _coverage.html_ in the node-appc directory.

## Contributing

Titanium is an open source project. Titanium wouldn't be where it is now without
contributions by the community. Please consider forking this repo to improve,
enhance or fix issues. If you feel like the community will benefit from your
fork, please open a pull request.

To protect the interests of the Titanium contributors, Appcelerator, customers
and end users we require contributors to sign a Contributors License Agreement
(CLA) before we pull the changes into the main repository. Our CLA is simple and
straightforward - it requires that the contributions you make to any
Appcelerator open source project are properly licensed and that you have the
legal authority to make those changes. This helps us significantly reduce future
legal risk for everyone involved. It is easy, helps everyone, takes only a few
minutes, and only needs to be completed once.

[You can digitally sign the CLA](http://bit.ly/app_cla) online. Please indicate
your e-mail address in your first pull request so that we can make sure that
will locate your CLA. Once you've submitted it, you no longer need to send one
for subsequent submissions.

## License

The [imgscalr](https://github.com/thebuzzmedia/imgscalr) Java-based image-scaling library is licensed under the Apache v2.0 license.
Copyright 2011 The Buzz Media, LLC.
This project is open source and provided under the Apache Public License
(version 2). Please make sure you see the `LICENSE` file included in this
distribution for more details on the license. Also, please take notice of the
privacy notice at the end of the file.

#### (C) Copyright 2012-2013, [Appcelerator](http://www.appcelerator.com) Inc. All Rights Reserved.
#### (C) Copyright 2012-2013, [Appcelerator](http://www.appcelerator.com/) Inc. All Rights Reserved.
63 changes: 63 additions & 0 deletions forge
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env node

/**
* forge - make-like tool
*
* @copyright
* Copyright (c) 2009-2013 by Appcelerator, Inc. All Rights Reserved.
*
* @license
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/

var toolsDir = './forge-tools',
spawn = require('child_process').spawn,
fs = require('fs'),
path = require('path'),
colors = require('colors');

global.which = function which(program, fn) {
if (process.platform == 'win32') {
fn(); // no 'which' on windows
} else {
spawn('which', [ program ]).on('exit', fn);
}
};

global.rootDir = __dirname;

var tools = {};
fs.readdirSync(toolsDir = path.resolve(toolsDir)).forEach(function (name) {
var m, file = path.join(toolsDir, name);
if (fs.statSync(file).isDirectory()) {
if (fs.existsSync(m = path.join(file, 'index.js'))) {
tools[name] = m;
}
} else if (m = name.match(/^(?!\.|_)(.+)\.js$/)) {
tools[m[1]] = file;
}
});

function help(err) {
console.log('Forge'.cyan.bold + ' - Copyright (c) 2012-' + (new Date).getFullYear() + ', Appcelerator, Inc. All Rights Reserved.\n');
console.log('Usage: ' + 'forge <tool> [options]'.cyan + '\n');
err && console.error(err.red + '\n');
console.error('Available tools:');
Object.keys(tools).sort().forEach(function (t) {
console.log(' ' + t.cyan);
});
console.log();
process.exit(err ? 1 : 0);
}

var args = process.argv.slice(2),
tool = args.shift();

if (tool && !tools[tool]) {
help('ERROR: Invalid tool "' + tool + '"');
} else if (!tool) {
help();
}

require(tools[tool]).apply(null, args);
93 changes: 93 additions & 0 deletions forge-tools/docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/**
* Generates API docs in both markdown and html.
*
* @copyright
* Copyright (c) 2009-2013 by Appcelerator, Inc. All Rights Reserved.
*
* @license
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/

module.exports = function () {
var spawn = require('child_process').spawn,
async = require('async'),
wrench = require('wrench'),
colors = require('colors'),
startTime = Date.now();

console.log('Documentation Tool'.cyan.bold + ' - Copyright (c) 2012-' + (new Date).getFullYear() + ', Appcelerator, Inc. All Rights Reserved.\n');

spawn('which', [ 'jsdoc' ]).on('exit', function (code) {
if (code) {
console.error('ERROR: Unable to find "jsdoc".\n\n'.red
+ 'Please install it by running "npm install -g jsdoc".\n');
process.exit(1);
} else {
var docsdir = path.join(rootDir, 'docs'),
libdir = path.join(rootDir, 'lib'),
jsdox = require("jsdox"),
jsfile = /\.js$/,
ignore = /^[\.|_]/;

wrench.rmdirSyncRecursive(docsdir, true);
wrench.mkdirSyncRecursive(docsdir);

async.series(wrench.readdirSyncRecursive(libdir).map(function (file) {
return function (cb) {
if (jsfile.test(file) && !ignore.test(file)) {
var src = path.join(libdir, file),
dest = path.join(docsdir, path.dirname(file));
fs.existsSync(dest) || wrench.mkdirSyncRecursive(dest);
console.log(src, '=>', path.join(dest, file.replace(jsfile, '.md')));
jsdox.generateForDir(src, dest, function () {
cb();
});
} else {
cb();
}
};
}), function () {
console.log('Docs generated successfully in ' + ((Date.now() - startTime) / 1000).toFixed(1) + ' seconds\n');
});

/*
var apidox = require('apidox'),
jsfile = /\.js$/,
ignore = /^[\.|_]/;
wrench.mkdirSyncRecursive(docsdir);
wrench.readdirSyncRecursive(libdir).forEach(function (n) {
if (jsfile.test(n) && !ignore.test(n)) {
var src = path.join(libdir, n),
dest = path.join(docsdir, n.replace(jsfile, '.md'));
fs.existsSync(path.dirname(dest)) || wrench.mkdirSyncRecursive(path.dirname(dest));
fs.writeFileSync(path.join(docsdir, n.replace(jsfile, '.md')), apidox.create()
.set('input', src)
.parse()
.convert());
}
});
*/

/*
var child = spawn('jsdoc', [ '-c', path.join('tools', 'docs', 'conf.json') ], params),
out = '',
outFn = function (data) { out += data.toString(); };
child.stdout.on('data', outFn);
child.stderr.on('data', outFn);
child.on('exit', function (code) {
if (code) {
console.error('Error building docs:\n' + out + '\n');
} else {
console.log('Docs generated successfully in ' + (Math.round((Date.now() - startTime) / 100) / 10) + ' seconds\n');
}
});
*/
//console.log('Docs generated successfully in ' + (Math.round((Date.now() - startTime) / 100) / 10) + ' seconds\n');
}
});
};
42 changes: 42 additions & 0 deletions forge-tools/i18n/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# i18n Tool

This i18n tool makes it easy to analyze projects for i18n information and to sync that data with
webtranslateit.com.

## Usage

forge i18n <action> [options]

## Configuration

This tool is configured via a config file located at `<home-directory>/.titanium/i18n-sync.json`.
The file contains Appcelerator's webtranslateit.com private key and a list of projects locations.

Copy the `i18n-sync.example.json` file to `<home-directory>/.titanium/i18n-sync.json`, then
edit the file and specify the private key and the correct local path for each project.

## Actions

### analyze

forge i18n analyze [--write]

This will scan all projects listed in the config file for all __(), __n(), and __f() function
calls. If `--write` is specified, then the strings passed into the i18n functions are updated
into each project's `<project-location>/locales/en.js` file.

### prepare

forge i18n prepare [--write]

This will scan all projects listed in the config file for all __(), __n(), and __f() function
calls, then assemble all strings into a single master locale file that can be manually uploaded
to the "Titanium CLI" webtranslateit.com project. This performs an `analyze` action prior to
assembling the master locale file.

### pull

forge i18n pull [--write]

Downloads the i18n strings from the "Titanium CLI" webtranslateit.com project and updates each
project's i18n string files defined in the project's `<project-location>/locales/` directory.
File renamed without changes.

0 comments on commit f8617d9

Please sign in to comment.