Sha256: 54e41e777bec1006bc5a1ea54c365b9701e333b550e976dd271867802cd00ca6

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby

require 'fileutils'
require 'optparse'
require 'methadone'
require_relative '../lib/download_files.rb'

class App
  include Methadone::Main
  include Methadone::CLILogging

  main do |page_address, pattern|
    FileUtils.mkdir_p(options['directory']) unless File.directory?(options['directory'])
    DownloadFiles.download_files(
      page_address,
      pattern,
      options['directory'],
      options['ssl-verify'],
      options['verbose'],
      logger
    )
  end

  description "Downloads files from the web page at the given address on the given domain that match the given regular expression pattern."

  arg :page_address
  arg :pattern
  arg :directory, :optional

  options['directory'] = FileUtils.pwd
  on('-d DIRECTORY', '--directory', 'Directory for scrapped content')

  options['ssl-verify'] = true
  on "--[no]-ssl-verify", 'Do no SSL verification of target website.'

  options['verbose'] = false
  on '-v', "--verbose", 'Verbose output'

  version DownloadFiles::VERSION

  use_log_level_option

  go!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
download_files-1.0.0 bin/download_files