Sha256: e378f3470571cfae021d345d938674e0d620272f222c858bb8f3fab87a14a253

Contents?: true

Size: 1023 Bytes

Versions: 1

Compression:

Stored size: 1023 Bytes

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

  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.1 bin/download_files