Sha256: 553bf166231330654593e257c524944a44a09ab10c14ed1a4b6d12a4b026e6fb

Contents?: true

Size: 594 Bytes

Versions: 2

Compression:

Stored size: 594 Bytes

Contents

#!/usr/bin/env ruby
require 'krawler'
require 'optparse'

options = {}
optparse = OptionParser.new do |opts|
  opts.banner = "Usage: krawl [url] [options]"

  opts.separator ""
  opts.separator "Specific options:"

  opts.on("-ex [regex]", "Exclude matching paths") do |ex|
    options[:ex] = ex
  end

  opts.on("-r", "Restrict to sub paths") do |r|
    options[:r] = true
  end
end
optparse.parse!

if ARGV.empty? || !(ARGV[0] =~ /^http/)
  puts optparse
  exit(-1)
end

Krawler::Base.new(ARGV[0] || 'http://localhost:3000/', {
  :exclude  => options[:ex],
  :restrict => options[:r]
}).base

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
krawler-0.1.2 bin/krawl
krawler-0.1.1 bin/krawl