cluster/lib/cluster/commands_generator.rb in sct-0.1.28 vs cluster/lib/cluster/commands_generator.rb in sct-0.1.29

- old
+ new

@@ -7,114 +7,91 @@ def self.start self.new.run end - def run + def run program :name, 'cluster' program :version, Sct::VERSION program :description, 'CLI for \'cluster\' - Manage your local kubernetes cluster' global_option('--verbose') { $verbose = true } - command :up do |c| + command :start do |c| + c.syntax = "sct cluster start" + c.description = "start the cluster" - c.syntax = "sct cluster up" - c.description = "Start the cluster" - c.option '--clean', 'start a clean cluster. Old cluster will be purged if available.' - - c.action do |args, options| - if options.clean - Cluster::Runner.new.reset - else - Cluster::Runner.new.launch - end + c.action do |args, options| + Cluster::Runner.new.start end end - command :down do |c| - - c.syntax = 'sct cluster down' + command :stop do |c| + c.syntax = 'sct cluster stop' c.description = 'stop the cluster' - c.action do |args, options| - Cluster::Runner.new.down + c.action do |args, options| + Cluster::Runner.new.stop end end command :restart do |c| + c.syntax = "sct cluster restart" + c.description = "restart the cluster" - c.syntax = 'sct cluster restart' - c.description = 'restart the cluster (this is a short hand for sct cluster down && sct cluster up)' - c.action do |args, options| - Cluster::Runner.new.down - Cluster::Runner.new.launch + Cluster::Runner.new.restart end + end - command :reset do |c| + command :delete do |c| + c.syntax = "sct cluster delete" + c.description = "delete the cluster" + c.action do |args, options| + Cluster::Runner.new.delete + end + + end + + command :reset do |c| c.syntax = 'sct cluster reset' - c.description = 'reset your cluster and start with a clean cluster' + c.description = 'delete the cluster and start a new cluster' - c.action do |args, options| + c.action do |args, options| Cluster::Runner.new.reset end end - alias_command :'setup', :'reset' - command :status do |c| - c.syntax = 'sct cluster status' c.description = 'see the status of your cluster' - c.action do |args, options| + c.action do |args, options| Cluster::Runner.new.status end end command :'update config' do |c| - c.syntax = 'sct cluster update config' c.description = 'update the cluster configuration' c.action do |args, options| Cluster::Runner.new.update_config end end - command :'delete pods' do |c| - c.syntax = 'sct cluster delete stalled pods' - c.description = 'delete stalled pods from the cluster' - c.option '--stalled', 'delete stalled pods' - c.option '--all', 'delete all pods' + command :'apply deployments' do |c| + c.syntax = 'sct cluster apply deployments' + c.description = 'apply deployments from the k8s folder' c.action do |args, options| - - Cluster::Runner.new.delete_stalled_pods if options.stalled - Cluster::Runner.new.delete_all_pods if options.all - - Cluster::Runner.new.delete_pods(args) if !args.empty? - + Cluster::Runner.new.apply_deployments end end - command :'apply pods' do |c| - c.syntax = 'sct cluster apply pods' - c.description = 'apply pods from the k8s folder' - - c.action do |args, options| - - Cluster::Runner.new.apply_pods - - end - end - - default_command :status - run! end end -end \ No newline at end of file +end