Package com.cloudbees.sdk.cli

Examples of com.cloudbees.sdk.cli.ACommand


        Object context = CommandScopeImpl.begin();
        try {
            // If it is the init command, execute before anything else
            if (args[0].equalsIgnoreCase("init")) {
                // Setup the configuration file
                ACommand setupCommand = commandService.getCommand(args[0]);
                if (setupCommand == null)
                    throw new Error("Panic: init error");
                setupCommand.run(Arrays.asList(args));

                // Initialize the SDK
                initialize(false);

                // Install plugins
                installPlugins(args);

                return 0;
            } else {
                // Initialize the SDK
                initialize(false);

                // Install plugins
                installPlugins(args);

                ACommand command = commandService.getCommand(args[0]);
                if (command == null) {
                    // no such command. print help
                    System.err.println("No such command: " + args[0]);
                    command = commandService.getCommand("help");
                    if (command == null)
                        throw new Error("Panic: command " + args[0] + " was not found, and even the help command was not found");
                }

                int r = command.run(Arrays.asList(args));
                if (r == 99) {
                    initialize(true);
                }
                return r;
            }
View Full Code Here


    }

    private void installPlugins(String[] args) throws Exception {
        Set<Map.Entry<String, GAV>> set = pluginsToInstallList.entrySet();
        if (set.size() > 0) {
            ACommand installPluginCmd = commandService.getCommand(SDK_PLUGIN_INSTALL);
            Iterator<Map.Entry<String, GAV>> it = set.iterator();
            while (it.hasNext()) {
                Map.Entry<String, GAV> entry = it.next();
                System.out.println("Installing plugin: " + entry.getValue());
                List<String> piArgs;
                if (isVerbose(args))
                    piArgs = Arrays.asList(SDK_PLUGIN_INSTALL, entry.getValue().toString(), "-f", "-v");
                else
                    piArgs = Arrays.asList(SDK_PLUGIN_INSTALL, entry.getValue().toString(), "-f");
                installPluginCmd.run(piArgs);
                pluginsToInstallList.remove(entry.getKey());
            }
            // Reload the plugins commands
            CommandServiceImpl service = (CommandServiceImpl) commandService;
            service.loadCommandProperties();
View Full Code Here

        Object context = CommandScopeImpl.begin();
        try {
            // If it is the init command, execute before anything else
            if (args[0].equalsIgnoreCase("init")) {
                // Setup the configuration file
                ACommand setupCommand = commandService.getCommand(args[0]);
                if (setupCommand == null)
                    throw new Error("Panic: init error");
                setupCommand.run(Arrays.asList(args));

                // Initialize the SDK
                initialize(false);

                // Install plugins
                installPlugins(args);

                return 0;
            } else {
                // Initialize the SDK
                initialize(false);

                // Install plugins
                installPlugins(args);

                ACommand command = commandService.getCommand(args[0]);
                if (command == null) {
                    // no such command. print help
                    System.err.println("No such command: " + args[0]);
                    command = commandService.getCommand("help");
                    if (command == null)
                        throw new Error("Panic: command " + args[0] + " was not found, and even the help command was not found");
                }

                int r = command.run(Arrays.asList(args));
                if (r == 99) {
                    initialize(true);
                }
                return r;
            }
View Full Code Here

    }

    private void installPlugins(String[] args) throws Exception {
        Set<Map.Entry<String, GAV>> set = pluginsToInstallList.entrySet();
        if (set.size() > 0) {
            ACommand installPluginCmd = commandService.getCommand(SDK_PLUGIN_INSTALL);
            Iterator<Map.Entry<String, GAV>> it = set.iterator();
            while (it.hasNext()) {
                Map.Entry<String, GAV> entry = it.next();
                System.out.println("Installing plugin: " + entry.getValue());
                List<String> piArgs;
                if (isVerbose(args))
                    piArgs = Arrays.asList(SDK_PLUGIN_INSTALL, entry.getValue().toString(), "-f", "-v");
                else
                    piArgs = Arrays.asList(SDK_PLUGIN_INSTALL, entry.getValue().toString(), "-f");
                installPluginCmd.run(piArgs);
                pluginsToInstallList.remove(entry.getKey());
            }
            // Reload the plugins commands
            CommandServiceImpl service = (CommandServiceImpl) commandService;
            service.loadCommandProperties();
View Full Code Here

        Object context = CommandScopeImpl.begin();
        try {
            // If it is the init command, execute before anything else
            if (args[0].equalsIgnoreCase("init")) {
                // Setup the configuration file
                ACommand setupCommand = commandService.getCommand(args[0]);
                if (setupCommand == null)
                    throw new Error("Panic: init error");
                setupCommand.run(Arrays.asList(args));

                // Initialize the SDK
                initialize(false);

                // Install plugins
                installPlugins(args);

                return 0;
            } else {
                // Initialize the SDK
                initialize(false);

                // Install plugins
                installPlugins(args);

                ACommand command = commandService.getCommand(args[0]);
                if (command == null) {
                    // no such command. print help
                    System.err.println("No such command: " + args[0]);
                    command = commandService.getCommand("help");
                    if (command == null)
                        throw new Error("Panic: command " + args[0] + " was not found, and even the help command was not found");
                }

                int r = command.run(Arrays.asList(args));
                if (r == 99) {
                    initialize(true);
                }
                return r;
            }
View Full Code Here

    }

    private void installPlugins(String[] args) throws Exception {
        Set<Map.Entry<String, GAV>> set = pluginsToInstallList.entrySet();
        if (set.size() > 0) {
            ACommand installPluginCmd = commandService.getCommand(SDK_PLUGIN_INSTALL);
            Iterator<Map.Entry<String, GAV>> it = set.iterator();
            while (it.hasNext()) {
                Map.Entry<String, GAV> entry = it.next();
                System.out.println("Installing plugin: " + entry.getValue());
                List<String> piArgs;
                if (isVerbose(args))
                    piArgs = Arrays.asList(SDK_PLUGIN_INSTALL, entry.getValue().toString(), "-f", "-v");
                else
                    piArgs = Arrays.asList(SDK_PLUGIN_INSTALL, entry.getValue().toString(), "-f");
                installPluginCmd.run(piArgs);
                pluginsToInstallList.remove(entry.getKey());
            }
            // Reload the plugins commands
            CommandServiceImpl service = (CommandServiceImpl) commandService;
            service.loadCommandProperties();
View Full Code Here

    @Option(name="-all",usage="Show all commands, including those that are experimental")
    public boolean all;

    @Override
    public int main() throws Exception {
        ACommand cmd = null;

        if (subCommand!=null)
            cmd = commandService.getCommand(subCommand);
        if (cmd!=null) {
            List<String> args = new ArrayList<String>();
            args.add(subCommand);
            if (all)
                args.add("-all");
            cmd.printHelp(args);
        } else
            printHelp(all);

        return 1;
    }
View Full Code Here

                    install = Helper.promptMatches("Do you want to install the latest version [" + newestVersion + "]: (y/n) ", "[yY].*");
                }
                System.out.println();
                GAV newGAV = new GAV(gav.groupId, gav.artifactId, newestVersion.toString());
                if (install) {
                    ACommand installPluginCmd = commandService.getCommand(Bees.SDK_PLUGIN_INSTALL);
                    System.out.println("Installing plugin: " + newGAV);
                    installPluginCmd.run(Arrays.asList(Bees.SDK_PLUGIN_INSTALL, newGAV.toString()));
                } else {
                    System.out.println("You can install the latest version with:");
                    System.out.println("> bees " + Bees.SDK_PLUGIN_INSTALL + " " + newGAV.toString());
                }
            } else {
View Full Code Here

TOP

Related Classes of com.cloudbees.sdk.cli.ACommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.