Skip to content

Refactoring #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .idea/android-cli.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ import {GenerateController} from "./scripts/controllers/GenerateController";
import {MANIFAST_PATH} from "./scripts/constants/ManifestPath";
import {DependencyController} from "./scripts/controllers/DependencyController";
import {PackageManager} from "./scripts/utils/PackageManager";
// import * as pkg from "./scripts/constants/Package";


const chalk = require('chalk'),
figlet = require('figlet'),
commander = require('commander');
commander = require('commander'),
pkg = require('./package.json');

commander.arguments('<name>')
.version('0.0.1')
.version(pkg.version)
.option('-g, --generate [name]', 'component (e.g activity, fragment etc..)')
.option('-p, --permission <permission>', 'add uses-permission to manifest file(e.g INTERNET)')
.option('-d, --dependency <dependency>', 'add dependency to build.gradle and sync gradle')
.action((name: string) => {
if (commander.generate) {
const generateManager: GenerateController = new GenerateController();
const generateController: GenerateController = new GenerateController();
console.log(chalk.yellow(`${changeCase.pascalCase(commander.generate)} will generated by Android CLI`));
PackageManager.getApplicationPackage(packageName => {
PackageManager.getPackages(packageName, packageList => {
Expand All @@ -29,7 +32,7 @@ commander.arguments('<name>')
choices: packageList,
}];
inquirer.prompt(questions).then(answers => {
generateManager.generateRenderedOutFile(commander.generate, name, answers.package);
generateController.generateRenderedOutFile(commander.generate, name, answers.package);
});
})
})
Expand All @@ -39,8 +42,8 @@ commander.arguments('<name>')
presentInitialMessage();

if (commander.permission) {
const permissionManager: PermissionController = new PermissionController();
permissionManager.addPermissionToManifest(commander.permission, xml => {
const permissionController: PermissionController = new PermissionController();
permissionController.addPermissionToManifest(commander.permission, xml => {
try {
fs.writeFileSync(MANIFAST_PATH, xml);
console.log(chalk.green(`Successful adding permission`));
Expand All @@ -50,8 +53,8 @@ if (commander.permission) {
}
});
} else if (commander.dependency) {
const dependencyManager: DependencyController = new DependencyController();
dependencyManager.addDependency(commander.dependency, (code, stdout, stderr) => {
const dependencyController: DependencyController = new DependencyController();
dependencyController.addDependency(commander.dependency, (code, stdout, stderr) => {
if (stderr) {
console.log(chalk.red(`Complete with some error. Please check gradle sync result.`));
} else {
Expand Down
17 changes: 0 additions & 17 deletions boilerplates/activity/index.ac.layout

This file was deleted.

13 changes: 0 additions & 13 deletions boilerplates/activity/index.ac.src

This file was deleted.

13 changes: 0 additions & 13 deletions boilerplates/fragment/index.ac.layout

This file was deleted.

108 changes: 0 additions & 108 deletions boilerplates/fragment/index.ac.src

This file was deleted.

77 changes: 0 additions & 77 deletions boilerplates/login-activity/index.ac.layout

This file was deleted.

Loading