Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

executable file 58 lines (46 sloc) 2.144 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#!/usr/bin/env coffee
program = require 'commander'

Utils = require './utils'
Commands = require './commands'


program
    .version(Utils.getVersion())

program
    .command('init <project_name>')
    .description('Initializes a project scaffold.')
    .option('-d, --directory <dir>', 'Directory to pull the project scaffold from')
    .action Commands.init

program
    .command('preview')
    .description('Runs a local server you can preview against.')
    .option('-p, --port <port>', 'port to bind to [8080]', parseInt, 8080)
    .option('-a, --address <address>', 'address to bind to [0.0.0.0]', '0.0.0.0')
    .option('-m, --minify', 'enable minification')
    .option('-t, --tag', 'runs a tag injecting proxy, requires sudo')
    .option('-u, --tag-version <version>', 'version of the tags to use [6]', '6')
    .action Commands.preview

program
    .command('push')
    .description('Builds and uploads the current project to Mobify Cloud.')
    .option('-m, --message <message>', 'message for bundle information')
    .option('-l, --label <label>', 'label the bundle')
    .option('-e, --endpoint <endpoint>', 'set the API endpoint eg. https://cloud.mobify.com/api/')
    .option('-u, --auth <auth>', 'username and API Key eg. username:apikey')
    .option('-p, --project <project>', 'override the project name in project.json for the push destination')
    .option('-x, --proxy <proxy url>', 'use the specified proxy. URL in the format http://[username:password@]PROXY_HOST:PROXY_PORT/')
    .action Commands.push

program
    .command('build')
    .description('Builds your project and places it into a bld folder')
    .action Commands.build

program
    .command('login')
    .description('Saves credentials to global settings.')
    .option('-u, --auth <auth>', 'Username and API Key eg. username:apikey')
    .action Commands.login


program.on '*', (command) ->
    console.log "Unknown command: '#{command}'."
    console.log "Get help and usage information with: mobify --help"

program.parse process.argv

# Print help if no command was given
if process.argv.length < 3
    process.stdout.write program.helpInformation()
Something went wrong with that request. Please try again.