vijumathew / playbot

CLI and JavaScript library to manage Google Play tasks
Apache License 2.0
13 stars 3 forks source link

PlayBot - The Google Play Robot

A CLI and JavaScript library to manage Google Play tasks. Uses Selenium for easy maintenance and flexibility.

Requirements

PlayBot requires NodeJS.

Installation

$ npm install playbot
# or
$ npm install playbot -g

Usage

Commands

JSON Manifests

Most commands take in options - you can either pass them individually, or use a JSON manifest file like this:

{
    "title": "My new app",
    "short_description": "This app is great!"
}

For example, the following commands are equivalent usng this JSON manifest:

$ playbot app:create --title 'My new app' --short_description 'This app is great!'
$ playbot app:create --manifest ./manifest.json
// JavaScript
PlayBot.app.create({title: "My new app", short_description: "This app is great!"});
PlayBot.app.create({manifest: "./manifest.json"});

CLI

PlayBot installs an playbot command, which you can explore with -h flags:

$ playbot -h

  Commands:
    app:create           Create App
    app:update           Update App
    app:delete           Delete App
    app:publish          Publish App
    app:unpublish        Unpublish App
    app:list             List Apps
    help                 Display global or [command] help documentation.

  Global Options:
    --manifest FILE.json Use a JSON file to load options for each command
    --username USERNAME  Username to login to Google Play, or $PLAYBOT_USERNAME
    --password PASSWORD  Password to login to Google Play, or $PLAYBOT_PASSWORD
    --format FORMAT      Output format - ['json', 'pretty']
    --verbose            Verbose output

Authentication

For every command, you can pass --username and --password flags to enter you auth credentials; you can also set $PLAYBOT_USERNAME and $PLAYBOT_PASSWORD environment variables.

JavaScript/Node

The Node package uses a PlayBot object, and its properties map to the CLI commands:

var PlayBot = require('playbot');
PlayBot.app.create({options: here});

Authentication

The JavaScript library has a few shortcuts for logging in to Google Play:

// pass as options
PlayBot.app.create({username: "username", password: "password"});

// run in closure
PlayBot.with_credentials({username: "username", password: "password"}, function() {
  PlayBot.app.create(options);
});

// set globally
PlayBot.set_credentials({username: "username", password: "password"});

Output

The :list commands are meant to return some data. If you're using the JavaScript library, you'll receive an Array when the command is done; if you're using the CLI, the command will output a JSON object with one entry.

PlayBot.app.list({options}, function(err, res) {
  // res = ["com.usepropeller.myapp"]
});
$ playbot app:list
{"apps": ["com.usepropeller.myapp"]}

If you're using any other command (which generally create side-effects), the end result will be true in Javascript, or exit code 0 on the CLI.

Verbose & Pretty Output

You can base a --verbose flag (or a verbose: true option in JavaScript) to see all of the output as each script processes. There are two output formats, json and pretty, which you are set with either the --format flag or format: 'format_string' options in JavaScript.

Contact

Viju Mathew

Clay Allsopp

License

PlayBot is available under the MIT license. See the LICENSE file for more info.