Class: Rake::FtpUploader

### Home Classes Methods

### In Files

- lib/rake/contrib/ftptools.rb

### Parent

Object

### Methods

- ::connect
- ::new
- #close
- #makedirs
- #upload_files

### Files

- MIT-LICENSE
- README.rdoc
- TODO
- command_line_usage.rdoc
- glossary.rdoc
- proto_rake.rdoc
- rakefile.rdoc
- rational.rdoc
- rake-0.4.14.rdoc
- rake-0.4.15.rdoc
- rake-0.5.0.rdoc
- rake-0.5.3.rdoc
- rake-0.5.4.rdoc
- rake-0.6.0.rdoc
- rake-0.7.0.rdoc
- rake-0.7.1.rdoc
- rake-0.7.2.rdoc
- rake-0.7.3.rdoc
- rake-0.8.0.rdoc
- rake-0.8.4.rdoc
- rake-0.8.5.rdoc
- rake-0.8.6.rdoc
- rake-0.8.7.rdoc

### Class/Module Index

Quicksearch

- Rake
- Rake::AltSystem
- Rake::Application
- Rake::Backtrace
- Rake::Cloneable
- Rake::CompositePublisher
- Rake::DSL
- Rake::DefaultLoader
- Rake::EarlyTime
- Rake::FileCreationTask
- Rake::FileList
- Rake::FileTask
- Rake::FileUtilsExt
- Rake::FtpFile
- Rake::FtpUploader
- Rake::InvocationChain
- Rake::InvocationChain::EmptyInvocationChain
- Rake::InvocationExceptionMixin
- Rake::MakefileLoader
- Rake::MultiTask
- Rake::NameSpace
- Rake::PackageTask
- Rake::PseudoStatus
- Rake::RubyForgePublisher
- Rake::RuleRecursionOverflowError
- Rake::SshDirPublisher
- Rake::SshFilePublisher
- Rake::SshFreshDirPublisher
- Rake::Task
- Rake::TaskArgumentError
- Rake::TaskArguments
- Rake::TaskLib
- Rake::TaskManager
- Rake::TestTask
- Rake::TraceOutput
- Rake::Win32
- Rake::Win32::Win32HomeError
- CompositePublisher
- FileUtils
- Module
- Object
- SshDirPublisher
- SshFilePublisher
- SshFreshDirPublisher
- String
- Time

No matching classes.

# Rake::FtpUploader

Manage the uploading of files to an FTP account.

### Attributes

verbose[RW]

Log uploads to standard output when true.

### Public Class Methods

connect(path, host, account, password) click to toggle source

Create an uploader and pass it to the given block as `up`. When the block is complete, close the uploader.

    # File lib/rake/contrib/ftptools.rb, line 93
    def connect(path, host, account, password)
      up = self.new(path, host, account, password)
      begin
        yield(up)
      ensure
        up.close
      end
    end

new(path, host, account, password) click to toggle source

Create an FTP uploader targeting the directory `path` on `host` using the given account and password. `path` will be the root path of the uploader.

    # File lib/rake/contrib/ftptools.rb, line 106
    def initialize(path, host, account, password)
      @created = Hash.new
      @path = path
      @ftp = Net::FTP.new(host, account, password)
      makedirs(@path)
      @ftp.chdir(@path)
    end

### Public Instance Methods

close() click to toggle source

Close the uploader.

    # File lib/rake/contrib/ftptools.rb, line 137
    def close
      @ftp.close
    end

makedirs(path) click to toggle source

Create the directory `path` in the uploader root path.

    # File lib/rake/contrib/ftptools.rb, line 115
    def makedirs(path)
      route = []
      File.split(path).each do |dir|
        route << dir
        current_dir = File.join(route)
        if @created[current_dir].nil?
          @created[current_dir] = true
          $stderr.puts "Creating Directory  #{current_dir}" if @verbose
          @ftp.mkdir(current_dir) rescue nil
        end
      end
    end

upload_files(wildcard) click to toggle source

Upload all files matching `wildcard` to the uploader's root path.

    # File lib/rake/contrib/ftptools.rb, line 130
    def upload_files(wildcard)
      FileList.glob(wildcard).each do |fn|
        upload(fn)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.