Module: FileGrabber
- Defined in:
- lib/filegrabber/cli.rb,
lib/filegrabber/log.rb,
lib/filegrabber/url.rb,
lib/filegrabber/grab.rb,
lib/filegrabber/version.rb,
lib/filegrabber/index_page.rb,
lib/filegrabber/document_page.rb,
lib/filegrabber/remote_document.rb,
lib/filegrabber/downloaded_document.rb
Defined Under Namespace
Classes: CLI, DocumentPage, DownloadedDocument, Grab, IndexPage, RemoteDocument, URL
Constant Summary collapse
- Log =
Logger.new(STDOUT)
- HTTP_BASIC_AUTH =
{username: nil, password: nil}
- CONFIG_FILENAME =
'Grabfile'
- VERSION =
"0.1.0"
Class Method Summary collapse
Class Method Details
.create_default_config ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |