# frozen_string_literal: true require "thor" require_relative "config_vars/commands" require_relative "access/commands" require_relative "execute" require_relative "stack" require_relative "autoscaling_config" require_relative "maintenance_window" module Neetob class CLI module Heroku class Commands < Thor desc "execute", "Run the given Heroku CLI command or Rails console command on Heroku apps" option :command, type: :string, aliases: "-c", required: true, desc: "Command to run on Heroku apps" option :rails, type: :boolean, aliases: "-r", default: false, desc: "Use this flag to run the given command in the Rails console" option :apps, type: :array, aliases: "-a", required: true, desc: "Heroku app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web-staging\"" def execute Execute.new(options[:apps], options[:command], options[:rails], options[:sandbox]).process end desc "config_vars", "Interact with the config(env) variables on Heroku apps" subcommand "config_vars", ConfigVars::Commands desc "access", "Interact with the users of the Heroku apps" subcommand "access", Access::Commands desc "stack", "Check the stack of the app on Heroku" option :app, type: :string, aliases: "-a", required: "true", desc: "Name of your app in Heroku" def stack Stack.new(options[:app]).process end desc "autoscaling_config", "Check the stack of the app on Heroku" option :app, type: :string, aliases: "-a", required: "true", desc: "Name of your app in Heroku" def autoscaling_config AutoscalingConfig.new(options[:app]).process end desc "maintenance_window", "Check the maintenance windows of addons of an app in Heroku" option :app, type: :string, aliases: "-a", required: "true", desc: "Name of your app in Heroku" def maintenance_window MaintenanceWindow.new(options[:app]).process end end end end end