Class: Middleman::Deploy::Methods::Ftp

Inherits:
Base
  • Object
show all
Defined in:
lib/middleman-deploy/methods/ftp.rb

Direct Known Subclasses

Sftp

Instance Attribute Summary collapse

Attributes inherited from Base

#options, #server_instance

Instance Method Summary collapse

Constructor Details

#initialize(server_instance, options = {}) ⇒ Ftp

Returns a new instance of Ftp.



11
12
13
14
15
16
17
18
19
# File 'lib/middleman-deploy/methods/ftp.rb', line 11

def initialize(server_instance, options={})
  super(server_instance, options)

  @host = self.options.host
  @user = self.options.user
  @pass = self.options.password
  @path = self.options.path
  @port = self.options.port
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



9
10
11
# File 'lib/middleman-deploy/methods/ftp.rb', line 9

def host
  @host
end

#passObject (readonly)

Returns the value of attribute pass.



9
10
11
# File 'lib/middleman-deploy/methods/ftp.rb', line 9

def pass
  @pass
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/middleman-deploy/methods/ftp.rb', line 9

def path
  @path
end

#portObject (readonly)

Returns the value of attribute port.



9
10
11
# File 'lib/middleman-deploy/methods/ftp.rb', line 9

def port
  @port
end

#userObject (readonly)

Returns the value of attribute user.



9
10
11
# File 'lib/middleman-deploy/methods/ftp.rb', line 9

def user
  @user
end

Instance Method Details

#processObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/middleman-deploy/methods/ftp.rb', line 21

def process
  puts "## Deploying via ftp to #{self.user}@#{self.host}:#{self.path}"

  ftp = open_connection

  Dir.chdir(self.server_instance.build_dir) do
    filtered_files.each do |filename|
      if File.directory?(filename)
        upload_directory(ftp, filename)
      else 
        upload_binary(ftp, filename)
      end
    end
  end

  ftp.close
end