Sha256: 26e077192e12c1ad09279cb66751412b041afc725f70f4398d940dfb5f56e945

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

module Stack
  class Runner
    attr_accessor :configuration
    attr_accessor :command
    attr_accessor :arguments
    
    def initialize(argv)
      @argv = argv
      @options = { }
      
      parse!
    end
    
    # Parse options, command and arguments 
    def parse!
      options = Stack::parse! @argv
      
      @configuration = Stack::Configuration.new(options)
      
      @command = @argv.shift
      @arguments = @argv
    end
    
    # Run stack!
    def run!
      if @command.nil?
        @command = "generate"
      end
      
      if Stack::COMMANDS.include?(@command)
        run_command
      else
        abort "Unknown command: #{@command}. Use one of #{Stack::COMMANDS.join(", ")}."
      end
    end
    
    # Runs the specified command 
    def run_command
      Stack::Generator.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stack-0.0.2 lib/stack/runner.rb