Sha256: 6d395e1e78fb59ff9b0674bdfb35465a32dec6ff346c78e1e1edccfa1b049171

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

class Andrake::Commands
  def parse(argv = nil)
    return {:command => "new"} if argv.nil?
    command = argv.shift
    command = aliases[command] || command
    {:command => command}
  end

  def aliases
    {"g" => "generate", "d" => "destroy" }
  end

  def run(argv)
    command = parse(argv)
    case command[:command]
    when 'generate'
      puts 'generate'
    when 'destroy'
      puts 'destroy'
    when 'new'
      Andrake::Generator::Rakefile.run!
    else
      puts "hogehoge"
    end
  end

  class << self
    def run!(argv)
      self.new.run(argv)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
andrake-1.1.1 lib/andrake/commands.rb