Module: Apmate::CLI::Command
- Defined in:
- lib/apmate/commands/get.rb,
lib/apmate/commands/base.rb,
lib/apmate/commands/help.rb,
lib/apmate/commands/apply.rb,
lib/apmate/commands/promote.rb,
lib/apmate/commands/execution.rb,
lib/apmate/commands/mass_promote.rb,
lib/apmate/commands/publish_artifact.rb
Defined Under Namespace
Modules: Get
Constant Summary collapse
- GET =
Cri::Command.define do name 'get' usage "get <command> [<args>]\n\nCommands: artifact, artifact_environment, artifact_name" summary 'Returns the requested object or data from the datastore.' description 'Returns the requested object or data from the datastore.' end
- BASE =
Cri::Command.define do name 'apmate' usage 'apmate <command> [<args>]' summary 'Environment datastore CLI' description 'Apmate is responsible for managing data in the Apmate environment datastore.' flag :h, :help, 'show help for this command' do |value, cmd| puts cmd.help exit 0 end flag :v, :verbose, 'be verbose' flag :q, :quiet, 'Do not output Apmate reponse.' required :o, :output, 'Name of file to write operation output.' optional :l, :log, 'Write to log file if passed. Set a value for a custom location.' end
- HELP =
Cri::Command.define do name 'help' usage 'help' summary 'Prints help screen.' description 'This command prints the help screen.' flag :h, :help, 'show help for this command' do |value, cmd| puts cmd.help exit 0 end run do |opts, args, cmd| command.run ['-h'] end end
- APPLY =
Cri::Command.define do name 'apply' usage 'apply [options] <path>' summary 'Creates or updates objects in the Apmate environment datastore.' description 'Creates or updates objects in the Apmate environment datastore.' flag :h, :help, 'show help for this command' do |value, cmd| puts cmd.help exit 0 end run do |opts, args, cmd| Apmate::Logger.log_level(opts) Apmate::Logger.verbosity(opts) Apmate::Logger.logger.debug "opts: #{opts}" Apmate::Logger.logger.debug "args: #{args}" Apmate::Logger.logger.debug "cmd: #{cmd.to_s}" cmd.run(['-h']) unless args[0] if args[0] if File.directory? args[0] Apmate::CLI.apply_dir args[0], opts else Apmate::CLI.apply_file args[0], opts end else puts cmd.help exit 0 end end end
- PROMOTE =
Cri::Command.define do name 'promote' usage 'promote <environment_from> <environment_to> [artifact]' summary 'Promotes artifact environment values from one environment to another environment.' description %q( Promotes artifact environment values from one environment to another environment. Default behavior promotes all artifact environment values from one environment to another environment. Optionally, you may specify a single artifact to be promoted. ) flag :h, :help, 'show help for this command' do |value, cmd| puts cmd.help exit 0 end run do |opts, args, cmd| Apmate::Logger.log_level(opts) Apmate::Logger.verbosity(opts) Apmate::Logger.logger.debug "opts: #{opts}" Apmate::Logger.logger.debug "args: #{args}" Apmate::Logger.logger.debug "cmd: #{cmd.to_s}" cmd.run(['-h']) unless (args.count == 2 || args.count == 3) artifact = args[2] || nil Apmate::CLI.apmate_promote(args[0], args[1], artifact, opts) end end
- CREATE_EXECUTION =
Cri::Command.define do name 'create_execution' usage 'create_execution <application_name> <environment_name> <component_name> <action>' summary 'Creates a StackStorm execution.' description 'Creates a StackStorm execution.' flag :h, :help, 'show help for this command' do |value, cmd| puts cmd.help exit 0 end run do |opts, args, cmd| Apmate::Logger.log_level(opts) Apmate::Logger.verbosity(opts) Apmate::Logger.logger.debug "opts: #{opts}" Apmate::Logger.logger.debug "args: #{args}" Apmate::Logger.logger.debug "cmd: #{cmd.to_s}" cmd.run(['-h']) unless args.count == 4 Apmate::CLI.apmate_create_execution(args[0], args[1], args[2], args[3], opts) end end
- MASS_PROMOTE =
Cri::Command.define do name 'mass_promote' usage 'mass_promote <environment_from> <environment_to> [artifact]' summary "Promotes all artifacts' environment values from one general environment to another environment." description %q( Promotes all artifacts' environment values from one general environment to another environment. WARNING: Use with caution. There is no "undo" for this. Take a backup first. ) flag :h, :help, 'show help for this command' do |value, cmd| puts cmd.help exit 0 end run do |opts, args, cmd| Apmate::Logger.log_level(opts) Apmate::Logger.verbosity(opts) Apmate::Logger.logger.debug "opts: #{opts}" Apmate::Logger.logger.debug "args: #{args}" Apmate::Logger.logger.debug "cmd: #{cmd.to_s}" cmd.run(['-h']) unless (args.count == 2) Apmate::CLI.apmate_mass_promote(args[0], args[1], opts) end end
- PUBLISH_ARTIFACT =
Cri::Command.define do name 'publish_artifact' usage 'publish_artifact [options] <name> <environment_name>' summary "Publishes artifact information to Apmate for each environment with environment_name." description %q( Publishes artifact information to Apmate for each environment with environment_name. Must have at least one option specified. WARNING: Use with caution. There is no "undo" for this. Take a backup first. ) flag :h, :help, 'show help for this command' do |value, cmd| puts cmd.help exit 0 end option nil, :version, 'set artifact version', argument: :required option nil, :checksum, 'set artifact checksum (SHA256)', argument: :required option nil, :repository, 'set artifact repository', argument: :required option nil, :promote, 'mark artifact for promotion', argument: :required run do |opts, args, cmd| Apmate::Logger.log_level(opts) Apmate::Logger.verbosity(opts) Apmate::Logger.logger.debug "opts: #{opts}" Apmate::Logger.logger.debug "args: #{args}" Apmate::Logger.logger.debug "cmd: #{cmd.to_s}" cmd.run(['-h']) unless (args.count == 2) cmd.run(['-h']) unless (opts.count > 0) Apmate::CLI.publish_artifact(args[0], args[1], opts) end end