module FileGrabber

Constants

CONFIG_FILENAME
HTTP_BASIC_AUTH
Log
VERSION

Public Class Methods

create_default_config() click to toggle source
# File lib/filegrabber/grab.rb, line 4
  def self.create_default_config
    if File.exist? CONFIG_FILENAME
      FileGrabber::Log.error "Can't overwrite existing config file."
    else
      File.open CONFIG_FILENAME, 'w+' do |file|
        file.write <<-EOF.gsub(/^\s{10}/, '')
          # vim: ft=ruby
          grabber 'default' do
            set_http_basic_username 'admin'
            set_http_basic_password ENV['HTTP_BASIC_PASSWORD']
            index 'http://www.example.com/files', 'div ul li a'
            download 'div a'
          end
        EOF
      end
    end
  end