Sha256: 70e5c56f6d0bce542acb6cb7208b073e1992be6442518d597a894aa59a8f0f2e

Contents?: true

Size: 1.85 KB

Versions: 11

Compression:

Stored size: 1.85 KB

Contents

module Rascal
  module CLI
    class Main < Thor
      def help(subcommand = false)
        if subcommand
          super
        else
          say
          say 'Usage:'
          say '  rascal <command> <args>'
          say 'For example:'
          say '  rascal shell 2.6'
          say
          super
          say 'For Further information about the commands, you can use "rascal help <command>".'
          say
        end
      end

      def self.exit_on_failure?
        # return non-zero exit code for failures
        true
      end

      def self.start(*)
        IOHelper.setup
        super
      end


      map "shell" => "_shell"
      desc 'shell ENVIRONMENT', 'Start a docker shell for the given environment'
      def _shell(environment_name = nil)
        handle_error do
          Shell.new(self, options, environment_name).run
        end
      end

      desc 'clean ENVIRONMENT', 'Stop and remove docker containers for the given environment'
      method_option :volumes, type: :boolean, default: false, desc: 'Remove (cache) volumes'
      method_option :all, type: :boolean, default: false, desc: 'Clean all environments'
      def clean(environment_name = nil)
        handle_error do
          Clean.new(self, options, environment_name).run
        end
      end

      desc 'update ENVIRONMENT', 'Update all docker images'
      method_option :all, type: :boolean, default: false, desc: 'update all available environments'
      def update(environment_name = nil)
        handle_error do
          Update.new(self, options, environment_name).run
        end
      end

      class_option :config_file, aliases: ['-c'], default: '.', required: true, desc: 'path to configuration file or directory containing it'

      private

      def handle_error
        yield
      rescue Rascal::Error => e
        raise Thor::Error, e.message
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rascal-0.3.8 lib/rascal/cli/main.rb
rascal-0.3.7 lib/rascal/cli/main.rb
rascal-0.3.6 lib/rascal/cli/main.rb
rascal-0.3.5 lib/rascal/cli/main.rb
rascal-0.3.4 lib/rascal/cli/main.rb
rascal-0.3.3 lib/rascal/cli/main.rb
rascal-0.3.2 lib/rascal/cli/main.rb
rascal-0.3.1 lib/rascal/cli/main.rb
rascal-0.3.0 lib/rascal/cli/main.rb
rascal-0.2.1 lib/rascal/cli/main.rb
rascal-0.2.0 lib/rascal/cli/main.rb