Sha256: 4bea583228f038faca4cd8218100217081a1e1486bec1d5c8de60727eb55bb37

Contents?: true

Size: 956 Bytes

Versions: 10

Compression:

Stored size: 956 Bytes

Contents

module Shell
    class Runner
        # define launch work
        def launch 

            tool_name = ARGV.first ? ARGV.first.downcase : nil

            if tool_name && Shell::TOOLS.include?(tool_name.to_sym)
                
                require_relative "docker/#{tool_name}"
                command = "#{ARGV[1..(ARGV.length+1)].join(" ")}"

                case ARGV.first
                when 'php'
                    Shell::Php.exec(command)
                when 'composer'
                    Shell::Composer.exec(command)
                when 'yarn'
                    Shell::Yarn.exec(command)
                else
                    show_error
                end
                
            else
                show_error
            end
        end

        def show_error 
            tools = Shell::TOOLS.map { |tool| tool.to_s }.join(", ")
            UI.error("Tool not found. Try one of these: #{tools}")
        end
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sct-0.1.28 shell/lib/shell/runner.rb
sct-0.1.27 shell/lib/shell/runner.rb
sct-0.1.26 shell/lib/shell/runner.rb
sct-0.1.25 shell/lib/shell/runner.rb
sct-0.1.24 shell/lib/shell/runner.rb
sct-0.1.23 shell/lib/shell/runner.rb
sct-0.1.22 shell/lib/shell/runner.rb
sct-0.1.21 shell/lib/shell/runner.rb
sct-0.1.20 shell/lib/shell/runner.rb
sct-0.1.19 shell/lib/shell/runner.rb