Class: Cfruby::FileOps::HTTPFileCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/libcfruby/fileops.rb

Overview

FileCommand interface for http operations

Instance Method Summary collapse

Instance Method Details

#copy(filename, targetdir, options = {}) ⇒ Object

Options:

:recursive

Recursive

:flags

Passed directly to the rsync command



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/libcfruby/fileops.rb', line 270

def copy(filename, targetdir, options = {})
	flags = Array.new()
	if(options[:flags])
		flags << options[:flags]
	end

	wgetcommand="cd #{targetdir} && "

	if(options[:recursive])
		wgetcommand=wgetcommand + "wget -q -np -nH -r -l inf --cut-dirs=#{filename.split(/\//).length} #{flags} http://#{filename}"
	else
		wgetcommand=wgetcommand + "wget -q #{flags} http://#{filename}"
	end

	Cfruby.controller.attempt(wgetcommand, 'destructive', 'unknown') {
		Cfruby::Exec.exec(wgetcommand)
	}
end

#move(filename, newfilename, options = {}) ⇒ Object

Raises:

  • (Exception)


263
264
265
# File 'lib/libcfruby/fileops.rb', line 263

def move(filename, newfilename, options = {})
	raise(Exception, "HTTP move not implemented")
end